X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fbattle%2Fstates%2FPerformAttacks.cpp;h=6aae5d7401395ed3997b4c0b889440d6f280e2e6;hb=fde7b27297882a7f033641df92e732abd137b532;hp=78e197077724629db3b4bca5c5f64d09a39ff9c4;hpb=cd302c7f04e5d0cdfd8e15322a02e84577ad2672;p=l2e.git diff --git a/src/battle/states/PerformAttacks.cpp b/src/battle/states/PerformAttacks.cpp index 78e1970..6aae5d7 100644 --- a/src/battle/states/PerformAttacks.cpp +++ b/src/battle/states/PerformAttacks.cpp @@ -140,16 +140,16 @@ void PerformAttacks::HandleEvents(const Input &input) { } void PerformAttacks::AddNumberAnimations(const TargetSelection &ts) { - if (ts.TargetsEnemies()) { + if (ts.TargetsMonsters()) { for (int i(0); i < battle->MaxMonsters(); ++i) { if (ts.IsBad(i)) { numberAnimation.push_back(NumberAnimation(ts.GetAmount(i), battle->Res().numberAnimationPrototype, battle->Res().bigNumberSprite)); numberPosition.push_back( - battle->MonsterPositions()[i]); + battle->MonsterAt(i).Position()); } else if (ts.IsGood(i)) { numberAnimation.push_back(NumberAnimation(ts.GetAmount(i), battle->Res().numberAnimationPrototype, battle->Res().greenNumberSprite)); numberPosition.push_back( - battle->MonsterPositions()[i]); + battle->MonsterAt(i).Position()); } } } else { @@ -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,17 @@ 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) { - if (ts.IsSelected(i)) { - targetAnimation.DrawCenter(screen, positions[i] + offset); + if (ts.TargetsHeroes()) { + for (vector >::size_type i(0), end(battle->NumHeroes()); i < end; ++i) { + if (ts.IsSelected(i)) { + targetAnimation.DrawCenter(screen, battle->HeroAt(i).Position() + offset); + } + } + } else { + for (vector >::size_type i(0), end(battle->MaxMonsters()); i < end; ++i) { + if (ts.IsSelected(i)) { + targetAnimation.DrawCenter(screen, battle->MonsterAt(i).Position() + offset); + } } } }