+void BattleState::ApplyDamage() {
+ if (attackCursor < 0) return;
+ AttackChoice &ac = CurrentAttack().GetAttackChoice(*this);
+ TargetSelection &ts(ac.Selection());
+ if (ts.TargetsMonsters()) {
+ for (int i(0); i < MaxMonsters(); ++i) {
+ Monster &monster(MonsterAt(i));
+ if (ts.IsBad(i)) {
+ monster.SubtractHealth(ts.GetAmount(i));
+ if (monster.Health() == 0) {
+ expReward += monster.ExpReward();
+ goldReward += monster.GoldReward();
+ }
+ }
+ }
+ } else {
+ for (int i(0); i < NumHeroes(); ++i) {
+ Hero &hero(HeroAt(i));
+ if (ts.IsBad(i)) {
+ hero.SubtractHealth(ts.GetAmount(i));
+ }
+ }
+ }
+}
+
+AttackChoice &BattleState::CurrentAttackAttackChoice() {
+ return CurrentAttack().GetAttackChoice(*this);
+}
+
+void BattleState::ClearAllAttacks() {
+ attackCursor = -1;
+ activeHero = -1;
+ for (int i(0); i < NumHeroes(); ++i) {
+ HeroAt(i).GetAttackChoice() = AttackChoice(this);
+ }
+ for (int i(0); i < MaxMonsters(); ++i) {
+ MonsterAt(i).GetAttackChoice() = AttackChoice(this);
+ }
+ capsule.GetAttackChoice() = AttackChoice(this);
+ attackOrder.clear();
+}
+
+
+void BattleState::HandleEvents(const Input &input) {
+
+}
+
+void BattleState::UpdateWorld(Uint32 deltaT) {