]> git.localhorst.tv Git - l2e.git/blobdiff - src/battle/states/PerformAttacks.cpp
removed redundant BattleState::AttackChoiceAt(int)
[l2e.git] / src / battle / states / PerformAttacks.cpp
index 15c4feba5ab0633cd0acf638ebc1aa0ea2b28d3e..0faecf9b5ead48f334e663c0817cb185abb1311f 100644 (file)
@@ -80,7 +80,7 @@ void PerformAttacks::HandleEvents(const Input &input) {
                AddNumberAnimations(battle->MonsterAttackChoiceAt(battle->CurrentAttack().index).Selection());
        } else {
                Hero &hero(battle->HeroAt(battle->CurrentAttack().index));
-               const AttackChoice &ac(battle->AttackChoiceAt(battle->CurrentAttack().index));
+               const AttackChoice &ac(battle->HeroAt(battle->CurrentAttack().index).GetAttackChoice());
 
                switch (ac.GetType()) {
                        case AttackChoice::SWORD:
@@ -121,11 +121,17 @@ void PerformAttacks::HandleEvents(const Input &input) {
                                moveAnimation.Clear();
                                break;
                }
-               hero.SetAnimation(moveAnimation);
        }
 
        if (titleBarText) titleBarTimer = GraphicsTimers().StartCountdown(850);
-       if (moveAnimation.Valid()) moveAnimation.Start(*this);
+       if (moveAnimation.Valid()) {
+               moveAnimation.Start(*this);
+               if (battle->CurrentAttack().isMonster) {
+                       battle->MonsterAt(battle->CurrentAttack().index).SetAnimation(moveAnimation);
+               } else {
+                       battle->HeroAt(battle->CurrentAttack().index).SetAnimation(moveAnimation);
+               }
+       }
        if (targetAnimation.Valid()) {
                targetAnimationTimer = GraphicsTimers().StartCountdown(150);
        } else {