]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/BattleState.h
moved attack order to battle state
[l2e.git] / src / battle / BattleState.h
index 3acc0b7699c79dd9ffeaef66c686d263c2a4d29e..5898a2d4aa93920ffc9a5a20a1d366240d46de5c 100644 (file)
@@ -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,12 @@ public:
                bool isMonster;
        };
 
-       void WriteOrder(std::vector<Order> &);
+       void CalculateAttackOrder();
+       void NextAttack();
+       bool AttacksFinished() const { return attackCursor >= int(attackOrder.size()); }
+       void CalculateDamage();
+       const Order &CurrentAttack() const { return attackOrder[attackCursor]; };
+       void ClearAllAttacks();
 
 public:
        geometry::Vector<int> CalculateScreenOffset(SDL_Surface *screen) const {
@@ -158,6 +164,8 @@ private:
        std::vector<geometry::Point<int> > monsterPositions;
        std::vector<geometry::Point<int> > heroesPositions;
        std::vector<Monster> monsters;
+       std::vector<AttackChoice> monsterAttacks;
+       std::vector<Order> attackOrder;
        Hero heroes[4];
        graphics::Menu<const common::Spell *> spellMenus[4];
        graphics::Menu<const common::Item *> itemMenu;
@@ -169,6 +177,7 @@ private:
        AttackChoice attackChoices[4];
        int numHeroes;
        int activeHero;
+       int attackCursor;
        bool ranAway;
 
 };