]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/SelectAttackType.cpp
postponed attack type decision to their respective states
[l2e.git] / src / battle / states / SelectAttackType.cpp
index 7dd06f6217b8e610f49828b891994b020ef20c1d..786277d764900f036dbfffca578d3eacfd0db114 100644 (file)
@@ -7,6 +7,8 @@
 
 #include "SelectAttackType.h"
 
+#include "SelectIkari.h"
+#include "SelectItem.h"
 #include "SelectMoveAction.h"
 #include "SelectSpell.h"
 #include "../AttackChoice.h"
@@ -63,10 +65,10 @@ void SelectAttackType::HandleInput(const Input &input) {
        }
 
        if (input.JustPressed(Input::ACTION_A)) {
-               battle->SetAttackType(battle->GetAttackTypeMenu().Selected());
                switch (battle->GetAttackTypeMenu().Selected()) {
                        case AttackChoice::SWORD:
                                // TODO: switch to target select
+                               battle->SetAttackType(AttackChoice::SWORD);
                                battle->NextHero();
                                break;
                        case AttackChoice::MAGIC:
@@ -75,15 +77,14 @@ void SelectAttackType::HandleInput(const Input &input) {
                                }
                                break;
                        case AttackChoice::DEFEND:
+                               battle->SetAttackType(AttackChoice::DEFEND);
                                battle->NextHero();
                                break;
                        case AttackChoice::IKARI:
-                               // TODO: switch to ikari attack select
-                               battle->NextHero();
+                               ctrl->PushState(new SelectIkari(battle, this));
                                break;
                        case AttackChoice::ITEM:
-                               // TODO: switch to item select
-                               battle->NextHero();
+                               ctrl->PushState(new SelectItem(battle, this));
                                break;
                        default:
                                throw std::logic_error("selected invalid attack type");