| 2157 | |
| 2158 | |
| 2159 | Scene_Battle_Rpg2k3::BattleActionReturn Scene_Battle_Rpg2k3::ProcessBattleActionPreEvents(Game_BattleAlgorithm::AlgorithmBase* action) { |
| 2160 | auto* source = action->GetSource(); |
| 2161 | |
| 2162 | // RPG_RT always runs the interpreter before starting the action. |
| 2163 | if (!CheckBattleEndAndScheduleEvents(EventTriggerType::eBeforeBattleAction, source)) { |
| 2164 | return BattleActionReturn::eContinue; |
| 2165 | } |
| 2166 | |
| 2167 | // If any battle animation is running for any reason, RPG_RT waits until the animation finishes. |
| 2168 | // This also means that the interpreter can run again. |
| 2169 | if (Game_Battle::IsBattleAnimationWaiting()) { |
| 2170 | return BattleActionReturn::eWait; |
| 2171 | } |
| 2172 | |
| 2173 | // If the event made the current action ususable, such as MP loss or silence etc.. |
| 2174 | PrepareBattleAction(source); |
| 2175 | pending_battle_action = source->GetBattleAlgorithm(); |
| 2176 | action = pending_battle_action.get(); |
| 2177 | |
| 2178 | // Now perform filtering. RPG_RT will run events but will early abort the battle algo if any of the following conditions hold. |
| 2179 | // FIXME: RPG_RT doesn't actually check hidden (maybe it's impossible?) But we do it here for extensions. |
| 2180 | // FIXME: RPG_RT doesn't check for dead enemies, only actors. Why? |
| 2181 | if (source->IsHidden() |
| 2182 | || !source->IsInParty() |
| 2183 | || !source->CanActOrRecoverable() |
| 2184 | ) { |
| 2185 | return BattleActionReturn::eFinished; |
| 2186 | } |
| 2187 | |
| 2188 | // RPG_RT cancels all enemy actions when first_strike flag is still active. This is different than |
| 2189 | // initiative / surround, unless the flag is set for those too. |
| 2190 | if (source->GetType() == Game_Battler::Type_Enemy |
| 2191 | && !source->Exists() |
| 2192 | && first_strike) { |
| 2193 | return BattleActionReturn::eFinished; |
| 2194 | } |
| 2195 | |
| 2196 | if (source->GetType() == Game_Battler::Type_Enemy) { |
| 2197 | if (action->GetType() != Game_BattleAlgorithm::Type::None |
| 2198 | && action->GetType() != Game_BattleAlgorithm::Type::DoNothing) { |
| 2199 | if (Player::IsEnglish() || Player::IsPatchDynRpg()) { |
| 2200 | Main_Data::game_system->SePlay(Main_Data::game_system->GetSystemSE(Game_System::SFX_EnemyAttacks)); |
| 2201 | } |
| 2202 | source->Flash(31, 31,31, 32, 48); |
| 2203 | } |
| 2204 | } |
| 2205 | |
| 2206 | SetBattleActionState(BattleActionState_Conditions); |
| 2207 | return BattleActionReturn::eContinue; |
| 2208 | } |
| 2209 | |
| 2210 | Scene_Battle_Rpg2k3::BattleActionReturn Scene_Battle_Rpg2k3::ProcessBattleActionConditions(Game_BattleAlgorithm::AlgorithmBase* action) { |
| 2211 | (void)action; |
nothing calls this directly
no test coverage detected