X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.h;h=1c994e4f88a664c2d572173fd79c156d1daf0687;hb=2255d436a0c2acc10b015827366a72b2ece86094;hp=0f51f237cd2a47138ac222127f269a15f477aca8;hpb=cc3d698b8c1ad09d7a3f9e3f28bc84e0ac1735ea;p=l2e.git diff --git a/src/battle/BattleState.h b/src/battle/BattleState.h index 0f51f23..1c994e4 100644 --- a/src/battle/BattleState.h +++ b/src/battle/BattleState.h @@ -3,6 +3,7 @@ #include "fwd.h" #include "AttackTypeMenu.h" +#include "Capsule.h" #include "Hero.h" #include "HeroTag.h" #include "Monster.h" @@ -47,6 +48,7 @@ public: public: void AddMonster(const Monster &); void AddHero(const Hero &); + void SetCapsule(const Capsule &); public: virtual void HandleEvents(const app::Input &); @@ -76,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; } @@ -89,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(); @@ -120,6 +134,7 @@ public: void RenderBackground(SDL_Surface *screen, const geometry::Vector &offset); void RenderMonsters(SDL_Surface *screen, const geometry::Vector &offset); void RenderHeroes(SDL_Surface *screen, const geometry::Vector &offset); + void RenderCapsule(SDL_Surface *screen, const geometry::Vector &offset); void RenderHeroTags(SDL_Surface *screen, const geometry::Vector &offset); void RenderSmallHeroTags(SDL_Surface *screen, const geometry::Vector &offset); @@ -134,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; @@ -154,6 +170,7 @@ private: SmallHeroTag smallHeroTags[4]; geometry::Vector heroTagPositions[4]; geometry::Vector smallHeroTagPositions[4]; + Capsule capsule; int numHeroes; int activeHero; int attackCursor;