X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.h;h=7d65c14a23d8a1d08890ac0d7c52a4512351287c;hb=51c5ffb4958968827b93624f7849c1b7d3a1eacb;hp=3acc0b7699c79dd9ffeaef66c686d263c2a4d29e;hpb=8f6a2452408f4ae35396cd7008a6fab0ecb03a46;p=l2e.git diff --git a/src/battle/BattleState.h b/src/battle/BattleState.h index 3acc0b7..7d65c14 100644 --- a/src/battle/BattleState.h +++ b/src/battle/BattleState.h @@ -55,6 +55,7 @@ public: , moveMenu(res->moveIcons) , numHeroes(0) , activeHero(-1) + , attackCursor(-1) , ranAway(false) { } public: @@ -103,6 +104,7 @@ public: bool HasChosenAttackType() const { return attackChoices[activeHero].GetType() != AttackChoice::UNDECIDED; } AttackChoice &ActiveHeroAttackChoice() { return attackChoices[activeHero]; } const AttackChoice &ActiveHeroAttackChoice() const { return attackChoices[activeHero]; } + AttackChoice &AttackChoiceAt(int index) { return attackChoices[index]; } const AttackChoice &AttackChoiceAt(int index) const { return attackChoices[index]; } bool AttackSelectionDone() const { return activeHero >= numHeroes; } @@ -116,7 +118,6 @@ public: bool HeroPositionOccupied(int index) const { return index >= 0 && index < numHeroes; } void SetRunaway() { ranAway = true; } - void ClearAllAttacks(); struct Order { Order(int index, bool isMonster) @@ -125,7 +126,16 @@ public: bool isMonster; }; - void WriteOrder(std::vector &); + void CalculateAttackOrder(); + void NextAttack(); + bool AttacksFinished() const { return attackCursor >= int(attackOrder.size()); } + void CalculateDamage(); + void ApplyDamage(); + const Order &CurrentAttack() const { return attackOrder[attackCursor]; }; + void ClearAllAttacks(); + + bool Victory() const; + bool Defeat() const; public: geometry::Vector CalculateScreenOffset(SDL_Surface *screen) const { @@ -158,6 +168,8 @@ private: std::vector > monsterPositions; std::vector > heroesPositions; std::vector monsters; + std::vector monsterAttacks; + std::vector attackOrder; Hero heroes[4]; graphics::Menu spellMenus[4]; graphics::Menu itemMenu; @@ -169,6 +181,7 @@ private: AttackChoice attackChoices[4]; int numHeroes; int activeHero; + int attackCursor; bool ranAway; };