| 111 | } |
| 112 | |
| 113 | int Game_BattleAlgorithm::AlgorithmBase::PlayAnimation(int anim_id, bool only_sound, int cutoff, bool invert) { |
| 114 | if (anim_id == 0) { |
| 115 | return 0; |
| 116 | } |
| 117 | |
| 118 | auto anim_iter = targets.begin(); |
| 119 | auto anim_end = targets.end(); |
| 120 | // If targets were added, skip the originals and use the added one |
| 121 | // Cases: reflect, retargeting, etc.. |
| 122 | if (num_original_targets < static_cast<int>(targets.size())) { |
| 123 | anim_iter += num_original_targets; |
| 124 | } |
| 125 | |
| 126 | std::vector<Game_Battler*> anim_targets; |
| 127 | for (; anim_iter != anim_end; ++anim_iter) { |
| 128 | auto* target = *anim_iter; |
| 129 | if (!target->IsHidden() && (IsTargetValid(*target) || (target->GetType() == Game_Battler::Type_Ally && target->IsDead()))) { |
| 130 | anim_targets.push_back(target); |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | return Game_Battle::ShowBattleAnimation(anim_id, anim_targets, only_sound, cutoff, invert); |
| 135 | } |
| 136 | |
| 137 | std::string Game_BattleAlgorithm::AlgorithmBase::GetFailureMessage() const { |
| 138 | return BattleMessage::GetPhysicalFailureMessage(*GetSource(), *GetTarget()); |
no test coverage detected