X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.h;h=1c994e4f88a664c2d572173fd79c156d1daf0687;hb=67f6bb1d9727e7d1e2140cf2913aa89ebba84bf5;hp=3a9500c5d5228d41c2bd71ba42a27d593c41a4a3;hpb=e1edc92c4fb834c8061118e89c0d7e239742b030;p=l2e.git diff --git a/src/battle/BattleState.h b/src/battle/BattleState.h index 3a9500c..1c994e4 100644 --- a/src/battle/BattleState.h +++ b/src/battle/BattleState.h @@ -78,6 +78,8 @@ public: const HeroTag &HeroTagAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTags[index]; } const geometry::Vector &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;