mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 15:50:20 +00:00
Add single-player local combat system with auto-attack, NPC aggro, and death
This commit is contained in:
parent
b16578e2b9
commit
ed5d10ec01
6 changed files with 273 additions and 4 deletions
|
|
@ -437,6 +437,13 @@ void GameScreen::processTargetInput(game::GameHandler& gameHandler) {
|
|||
auto unit = std::static_pointer_cast<game::Unit>(target);
|
||||
if (unit->getHealth() == 0 && unit->getMaxHealth() > 0) {
|
||||
gameHandler.lootTarget(target->getGuid());
|
||||
} else if (gameHandler.isSinglePlayerMode()) {
|
||||
// Single-player: toggle auto-attack
|
||||
if (gameHandler.isAutoAttacking()) {
|
||||
gameHandler.stopAutoAttack();
|
||||
} else {
|
||||
gameHandler.startAutoAttack(target->getGuid());
|
||||
}
|
||||
} else {
|
||||
// Try NPC interaction first (gossip), fall back to attack
|
||||
gameHandler.interactWithNpc(target->getGuid());
|
||||
|
|
@ -494,6 +501,12 @@ void GameScreen::renderPlayerFrame(game::GameHandler& gameHandler) {
|
|||
}
|
||||
}
|
||||
|
||||
// Override with local player stats in single-player mode
|
||||
if (gameHandler.isSinglePlayerMode() && gameHandler.getLocalPlayerMaxHealth() > 0) {
|
||||
playerHp = gameHandler.getLocalPlayerHealth();
|
||||
playerMaxHp = gameHandler.getLocalPlayerMaxHealth();
|
||||
}
|
||||
|
||||
// Health bar
|
||||
float pct = static_cast<float>(playerHp) / static_cast<float>(playerMaxHp);
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, ImVec4(0.2f, 0.8f, 0.2f, 1.0f));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue