X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.h;h=4a07f8e7396ab1fe8c41f2bc0b6e8ac973a39b9b;hb=f6e55f72530b2d01fbbe8f5745f830d17231c2c4;hp=a10ff7e8fae2b6947dd651c4a403c9b33c57e76d;hpb=d2f44bfe5d159647431cee8ab29898bd3618d980;p=l2e.git diff --git a/src/battle/BattleState.h b/src/battle/BattleState.h index a10ff7e..4a07f8e 100644 --- a/src/battle/BattleState.h +++ b/src/battle/BattleState.h @@ -8,7 +8,6 @@ #ifndef BATTLE_BATTLESTATE_H_ #define BATTLE_BATTLESTATE_H_ -#include "AttackChoice.h" #include "AttackTypeMenu.h" #include "Hero.h" #include "HeroTag.h" @@ -41,6 +40,7 @@ namespace graphics { namespace battle { +class AttackChoice; class PartyLayout; class Stats; @@ -58,6 +58,8 @@ public: , numHeroes(0) , activeHero(-1) , attackCursor(-1) + , expReward(0) + , goldReward(0) , ranAway(false) { assert(background && res); } public: @@ -82,19 +84,15 @@ public: AttackTypeMenu &GetAttackTypeMenu() { return attackTypeMenu; } MoveMenu &GetMoveMenu() { return moveMenu; } - graphics::Menu &GetSpellMenu() { return spellMenus[activeHero]; } - const graphics::Menu &GetSpellMenu() const { return spellMenus[activeHero]; } - graphics::Menu &GetIkariMenu() { return ikariMenus[activeHero]; } - const graphics::Menu &GetIkariMenu() const { return ikariMenus[activeHero]; } - graphics::Menu &GetItemMenu() { return itemMenu; } - const graphics::Menu &GetItemMenu() const { return itemMenu; } + graphics::Menu &ItemMenu() { return itemMenu; } + const graphics::Menu &ItemMenu() const { return itemMenu; } void NextHero(); bool BeforeFirstHero() const { return activeHero < 0; } - void PreviousHero() { --activeHero; } + void PreviousHero(); void SwapHeroes(int lhs, int rhs); - Hero &ActiveHero() { return heroes[activeHero]; } - const Hero &ActiveHero() const { return heroes[activeHero]; } + Hero &ActiveHero() { assert(activeHero >= 0 && activeHero < NumHeroes()); return heroes[activeHero]; } + const Hero &ActiveHero() const { assert(activeHero >= 0 && activeHero < NumHeroes()); return heroes[activeHero]; } Hero &HeroAt(int index) { assert(index >= 0 && index < NumHeroes()); return heroes[index]; } const Hero &HeroAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroes[index]; } @@ -104,13 +102,7 @@ public: const HeroTag &HeroTagAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTags[index]; } const geometry::Point &HeroTagPositionAt(int index) const { assert(index >= 0 && index < NumHeroes()); return heroTagPositions[index]; } - bool HasChosenAttackType() const { return ActiveHeroAttackChoice().GetType() != AttackChoice::UNDECIDED; } - AttackChoice &ActiveHeroAttackChoice() { return AttackChoiceAt(activeHero); } - const AttackChoice &ActiveHeroAttackChoice() const { return AttackChoiceAt(activeHero); } - AttackChoice &AttackChoiceAt(int index) { assert(index >= 0 && index < NumHeroes()); return attackChoices[index]; } - const AttackChoice &AttackChoiceAt(int index) const { assert(index >= 0 && index < NumHeroes()); return attackChoices[index]; } - AttackChoice &MonsterAttackChoiceAt(int index) { assert(index >= 0 && index < MaxMonsters()); return monsterAttacks[index]; } - const AttackChoice &MonsterAttackChoiceAt(int index) const { assert(index >= 0 && index < MaxMonsters()); return monsterAttacks[index]; } + bool HasChosenAttackType() const { return ActiveHero().GetAttackChoice().GetType() != AttackChoice::UNDECIDED; } bool AttackSelectionDone() const { return activeHero >= numHeroes; } int NumHeroes() const { return numHeroes; } @@ -159,8 +151,6 @@ public: void RenderSmallHeroTags(SDL_Surface *screen, const geometry::Vector &offset); private: - void LoadSpellMenu(std::vector::size_type heroIndex); - void LoadIkariMenu(std::vector::size_type heroIndex); void LoadInventory(); Uint16 CalculateDamage(const Stats &attacker, const Stats &defender) const; @@ -176,20 +166,18 @@ 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; - graphics::Menu ikariMenus[4]; HeroTag heroTags[4]; SmallHeroTag smallHeroTags[4]; geometry::Point heroTagPositions[4]; geometry::Point smallHeroTagPositions[4]; - AttackChoice attackChoices[4]; int numHeroes; int activeHero; int attackCursor; + int expReward; + int goldReward; bool ranAway; };