]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/SelectSpell.cpp
reorganized BattleState's interface
[l2e.git] / src / battle / states / SelectSpell.cpp
index a9c06cceccc912ca59e3530ce361e52b7fbb2880..a13d8fc822e3596fecb99676f9f5b6212fd072e6 100644 (file)
@@ -36,8 +36,8 @@ void SelectSpell::ExitState(Application &c, SDL_Surface *screen) {
 }
 
 void SelectSpell::ResumeState(Application &ctrl, SDL_Surface *screen) {
-       if (battle->ActiveHeroTargets().HasSelected()) {
-               battle->SetAttackType(AttackChoice::MAGIC);
+       if (battle->ActiveHeroAttackChoice().Selection().HasSelected()) {
+               battle->ActiveHeroAttackChoice().SetType(AttackChoice::MAGIC);
                battle->ActiveHeroAttackChoice().SetSpell(battle->GetSpellMenu().Selected());
                ctrl.PopState();
        }
@@ -57,25 +57,25 @@ void SelectSpell::HandleEvents(const Input &input) {
        if (input.JustPressed(Input::ACTION_A)) {
                if (battle->GetSpellMenu().SelectedIsEnabled()) {
                        const Spell *spell(battle->GetSpellMenu().Selected());
-                       battle->ActiveHeroTargets().Reset();
+                       battle->ActiveHeroAttackChoice().Selection().Reset();
                        if (spell->GetTargetingMode().TargetsAlly()) {
-                               battle->ActiveHeroTargets().SelectHeroes();
+                               battle->ActiveHeroAttackChoice().Selection().SelectHeroes();
                        } else {
-                               battle->ActiveHeroTargets().SelectEnemies();
+                               battle->ActiveHeroAttackChoice().Selection().SelectEnemies();
                        }
                        if (spell->GetTargetingMode().TargetsAll()) {
-                               battle->SetAttackType(AttackChoice::MAGIC);
+                               battle->ActiveHeroAttackChoice().SetType(AttackChoice::MAGIC);
                                // TODO: remove item from inventory
                                battle->ActiveHeroAttackChoice().SetSpell(spell);
                                battle->NextHero();
                                ctrl->PopState();
                        } else {
                                if (spell->GetTargetingMode().TargetsSingle()) {
-                                       battle->ActiveHeroTargets().SetSingle();
+                                       battle->ActiveHeroAttackChoice().Selection().SetSingle();
                                } else {
-                                       battle->ActiveHeroTargets().SetMultiple();
+                                       battle->ActiveHeroAttackChoice().Selection().SetMultiple();
                                }
-                               ctrl->PushState(new SelectTarget(battle, parent, &battle->ActiveHeroTargets(), battle->Res().magicTargetCursor));
+                               ctrl->PushState(new SelectTarget(battle, parent, &battle->ActiveHeroAttackChoice().Selection(), battle->Res().magicTargetCursor));
                        }
                }
        }