X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2FBattleState.cpp;h=bd039ff588c7e86bb278065dad1a49bd092a1c5d;hb=8639675fbf1d232ab8188dd283149ab650e10336;hp=95f2f118d9e618f45b928180bad1698240b0969d;hpb=d4609ba1798d82cce128b5985d60cb212b760246;p=l2e.git diff --git a/src/battle/BattleState.cpp b/src/battle/BattleState.cpp index 95f2f11..bd039ff 100644 --- a/src/battle/BattleState.cpp +++ b/src/battle/BattleState.cpp @@ -211,7 +211,6 @@ void BattleState::ExitState(Application &ctrl, SDL_Surface *screen) { } void BattleState::ResumeState(Application &ctrl, SDL_Surface *screen) { - // TODO: check for victory or defeat if (ranAway) { ctrl.PopState(); // quit the battle scene return; @@ -376,15 +375,20 @@ void BattleState::ApplyDamage() { 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 { for (int i(0); i < NumHeroes(); ++i) { + Hero &hero(HeroAt(i)); if (ts.IsBad(i)) { - HeroAt(i).SubtractHealth(ts.GetAmount(i)); + hero.SubtractHealth(ts.GetAmount(i)); } } }