]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/BattleState.h
added capsule attack/animation handling
[l2e.git] / src / battle / BattleState.h
index 3a9500c5d5228d41c2bd71ba42a27d593c41a4a3..1c994e4f88a664c2d572173fd79c156d1daf0687 100644 (file)
@@ -78,6 +78,8 @@ public:
        const HeroTag &HeroTagAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTags[index]; }
        const geometry::Vector<int> &HeroTagPositionAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTagPositions[index]; }
 
+       Capsule &GetCapsule() { return capsule; }
+
        bool HasChosenAttackType() const { return ActiveHero().GetAttackChoice().GetType() != AttackChoice::UNDECIDED; }
        bool AttackSelectionDone() const { return activeHero >= numHeroes; }
 
@@ -91,10 +93,20 @@ public:
        void SetRunaway() { ranAway = true; }
 
        struct Order {
-               Order(int index, bool isMonster)
-               : index(index), isMonster(isMonster) { }
+               enum Performer {
+                       HERO,
+                       CAPSULE,
+                       MONSTER,
+               };
+               Order(Performer by, int index = 0)
+               : index(index), by(by) { }
+               AttackChoice &GetAttackChoice(BattleState &) const;
+               common::Stats &GetStats(BattleState &) const;
+               bool IsHero() const { return by == HERO; }
+               bool IsCapsule() const { return by == CAPSULE; }
+               bool IsMonster() const { return by == MONSTER; }
                int index;
-               bool isMonster;
+               Performer by;
        };
 
        void CalculateAttackOrder();
@@ -137,7 +149,8 @@ private:
 private:
        void LoadInventory();
 
-       void DecideMonsterAttack(Monster &) const;
+       void DecideMonsterAttack(Monster &);
+       void DecideCapsuleAttack();
        void CalculateDamage(const common::Stats &attackerStats, TargetSelection &targets) const;
        Uint16 CalculateDamage(const common::Stats &attacker, const common::Stats &defender) const;