X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.cpp;h=66097fbd46d05a8d5315196fb161fef1bc5a34cb;hb=092a2dd175a4001a495c84ee85211734fb928c83;hp=0171e1480f56a7d52b905a86e577525d0a2597a0;hpb=2255d436a0c2acc10b015827366a72b2ece86094;p=l2e.git diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index 0171e14..66097fb 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -12,6 +12,7 @@ #include "../common/Spell.h" #include "../graphics/Frame.h" #include "../graphics/Sprite.h" +#include "../math/Vector.h" #include #include @@ -24,7 +25,7 @@ using common::Inventory; using common::Item; using common::Spell; using common::Stats; -using geometry::Vector; +using math::Vector; using graphics::Menu; using std::rand; @@ -192,7 +193,7 @@ void BattleState::CalculateAttackOrder() { attackOrder.push_back(Order(Order::MONSTER, i)); MonsterAt(i).GetAttackChoice() = AttackChoice(this); } - if (capsule.Health() > 0) { + if (capsule.Active() && capsule.Health() > 0) { attackOrder.push_back(Order(Order::CAPSULE)); } std::sort(attackOrder.begin(), attackOrder.end(), OrderCompare(this)); @@ -210,7 +211,7 @@ void BattleState::NextAttack() { } else if (attackOrder[attackCursor].IsHero()) { if (HeroAt(attackOrder[attackCursor].index).Health() > 0) break; } else { - if (capsule.Health() > 0) break; + if (capsule.Active() && capsule.Health() > 0) break; } ++attackCursor; } @@ -389,7 +390,7 @@ void BattleState::HandleEvents(const Input &input) { } -void BattleState::UpdateWorld(float deltaT) { +void BattleState::UpdateWorld(Uint32 deltaT) { } @@ -438,7 +439,7 @@ void BattleState::RenderHeroes(SDL_Surface *screen, const Vector &offset) { } void BattleState::RenderCapsule(SDL_Surface *screen, const Vector &offset) { - if (capsule.Health() <= 0) return; + if (!capsule.Active() || capsule.Health() <= 0) return; if (capsule.GetAnimation().Running()) { capsule.GetAnimation().DrawCenter(screen, capsule.Position() + offset); } else {