X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2Fstates%2FPerformAttacks.cpp;h=acb8194746ee46a7bb675882f603a8038e054411;hb=cded7d136b41e22f363ec702f2288491c0006e3a;hp=0faecf9b5ead48f334e663c0817cb185abb1311f;hpb=c68b073db752dcdcf8c900efba7d8a5da091751c;p=l2e.git diff --git a/src/battle/states/PerformAttacks.cpp b/src/battle/states/PerformAttacks.cpp index 0faecf9..acb8194 100644 --- a/src/battle/states/PerformAttacks.cpp +++ b/src/battle/states/PerformAttacks.cpp @@ -77,7 +77,7 @@ void PerformAttacks::HandleEvents(const Input &input) { targetAnimation = AnimationRunner(monster.MeleeAnimation()); moveAnimation = AnimationRunner(monster.AttackAnimation()); monster.SetAnimation(moveAnimation); - AddNumberAnimations(battle->MonsterAttackChoiceAt(battle->CurrentAttack().index).Selection()); + AddNumberAnimations(battle->MonsterAt(battle->CurrentAttack().index).GetAttackChoice().Selection()); } else { Hero &hero(battle->HeroAt(battle->CurrentAttack().index)); const AttackChoice &ac(battle->HeroAt(battle->CurrentAttack().index).GetAttackChoice()); @@ -157,11 +157,11 @@ void PerformAttacks::AddNumberAnimations(const TargetSelection &ts) { if (ts.IsBad(i)) { numberAnimation.push_back(NumberAnimation(ts.GetAmount(i), battle->Res().numberAnimationPrototype, battle->Res().bigNumberSprite)); numberPosition.push_back( - battle->HeroesPositions()[i]); + battle->HeroAt(i).Position()); } else if (ts.IsGood(i)) { numberAnimation.push_back(NumberAnimation(ts.GetAmount(i), battle->Res().numberAnimationPrototype, battle->Res().greenNumberSprite)); numberPosition.push_back( - battle->HeroesPositions()[i]); + battle->HeroAt(i).Position()); } } } @@ -251,10 +251,9 @@ void PerformAttacks::RenderNumbers(SDL_Surface *screen, const Vector &offse void PerformAttacks::RenderTargetAnimation(SDL_Surface *screen, const geometry::Vector &offset) const { if (!targetAnimation.Valid() || !targetAnimation.Running()) return; const TargetSelection &ts(battle->CurrentAttackAttackChoice().Selection()); - const vector > &positions(ts.TargetsHeroes() ? battle->HeroesPositions() : battle->MonsterPositions()); - for (vector >::size_type i(0), end(positions.size()); i < end; ++i) { + for (vector >::size_type i(0), end(ts.TargetsHeroes() ? battle->NumHeroes() : battle->MaxMonsters()); i < end; ++i) { if (ts.IsSelected(i)) { - targetAnimation.DrawCenter(screen, positions[i] + offset); + targetAnimation.DrawCenter(screen, (ts.TargetsHeroes() ? battle->HeroAt(i).Position() : battle->MonsterPositions()[i]) + offset); } } }