X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2Fstates%2FVictoryState.cpp;h=409f0846aa380b4a8153f53a12aaa287f616cda6;hb=8f4cb4e8ad954ba73fb78a030c969c933a7ed60c;hp=a0b09ceb5b93d7996c71317f88765b80cce45bad;hpb=e8283bf94624b2f184d50dc1401bf45225c529d6;p=l2e.git diff --git a/src/battle/states/VictoryState.cpp b/src/battle/states/VictoryState.cpp index a0b09ce..409f084 100644 --- a/src/battle/states/VictoryState.cpp +++ b/src/battle/states/VictoryState.cpp @@ -8,7 +8,6 @@ #include "../../common/Capsule.h" #include "../../common/GameConfig.h" #include "../../common/GameState.h" -#include "../../common/Hero.h" #include "../../math/Vector.h" #include "../../graphics/Font.h" #include "../../graphics/Frame.h" @@ -43,11 +42,15 @@ void VictoryState::LoadResults() { lines.push_back(""); - for (std::vector::const_iterator + vector upgrade; + for (std::vector::iterator i(battle->HeroesBegin()), end(battle->HeroesEnd()); i != end; ++i) { if (i->Health() <= 0) continue; - const common::Hero &hero = i->Master(); + upgrade.clear(); + common::Hero &hero = i->Master(); + hero.AddExperience(battle->ExpReward(), upgrade); + LoadResults(hero.Name(), upgrade, lines); s.str(""); s << hero.Name() << " next level " << hero.NextLevel(); lines.push_back(s.str()); @@ -68,6 +71,54 @@ void VictoryState::LoadResults() { lines.push_back(s.str()); } +void VictoryState::LoadResults( + const char *who, + const vector &upgrade, + vector &lines) { + std::stringstream s; + for (vector::const_iterator + i(upgrade.begin()), end(upgrade.end()); + i != end; ++i) { + s.str(""); + switch (i->type) { + case common::Hero::UPGRADE_LVL: + s << who << " levels up."; + break; + case common::Hero::UPGRADE_MHP: + s << "Max. HP increases by " << i->amount; + break; + case common::Hero::UPGRADE_MMP: + s << "Max. MP increases by " << i->amount; + break; + case common::Hero::UPGRADE_ATK: + s << "ATK increases by " << i->amount; + break; + case common::Hero::UPGRADE_DFP: + s << "DFP increases by " << i->amount; + break; + case common::Hero::UPGRADE_STR: + s << "STR increases by " << i->amount; + break; + case common::Hero::UPGRADE_AGL: + s << "AGL increases by " << i->amount; + break; + case common::Hero::UPGRADE_INT: + s << "INT increases by " << i->amount; + break; + case common::Hero::UPGRADE_GUT: + s << "GUT increases by " << i->amount; + break; + case common::Hero::UPGRADE_MGR: + s << "MGR increases by " << i->amount; + break; + default: + s << "There's an error in common::Hero::" + "AddExperience()"; + } + lines.push_back(s.str()); + } +} + void VictoryState::OnExitState(SDL_Surface *screen) { }