}
void BattleState::ResumeState(Application &ctrl, SDL_Surface *screen) {
- // TODO: check for victory or defeat
if (ranAway) {
ctrl.PopState(); // quit the battle scene
return;
TargetSelection &ts(ac.Selection());
if (ts.TargetsEnemies()) {
for (int i(0); i < MaxMonsters(); ++i) {
+ Monster &monster(MonsterAt(i));
if (ts.IsBad(i)) {
- MonsterAt(i).SubtractHealth(ts.GetAmount(i));
- // TODO: collect reward if dead
+ monster.SubtractHealth(ts.GetAmount(i));
+ if (monster.Health() == 0) {
+ expReward += monster.ExpReward();
+ goldReward += monster.GoldReward();
+ }
}
}
} else {
}
}
+AttackChoice &BattleState::CurrentAttackAttackChoice() {
+ if (CurrentAttack().isMonster) {
+ return monsterAttacks[CurrentAttack().index];
+ } else {
+ return AttackChoiceAt(CurrentAttack().index);
+ }
+}
+
void BattleState::ClearAllAttacks() {
attackCursor = -1;
activeHero = -1;