MCPcopy Create free account
hub / github.com/EasyRPG/Player / PlayAnimation

Method PlayAnimation

src/game_battlealgorithm.cpp:113–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113int 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
137std::string Game_BattleAlgorithm::AlgorithmBase::GetFailureMessage() const {
138 return BattleMessage::GetPhysicalFailureMessage(*GetSource(), *GetTarget());

Calls 6

IsHiddenMethod · 0.80
IsDeadMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45
GetTypeMethod · 0.45

Tested by

no test coverage detected