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

Method ProcessBattleActionBegin

src/scene_battle_rpg2k.cpp:1045–1126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1043}
1044
1045Scene_Battle_Rpg2k::BattleActionReturn Scene_Battle_Rpg2k::ProcessBattleActionBegin(Game_BattleAlgorithm::AlgorithmBase* action) {
1046 enum SubState {
1047 eBegin = 0,
1048 eShowMessage,
1049 ePost,
1050 };
1051
1052 auto* src = action->GetSource();
1053
1054 if (battle_action_substate == eBegin) {
1055 assert(src->Exists());
1056 battle_message_window->Clear();
1057
1058 bool show_message = false;
1059 src->NextBattleTurn();
1060
1061 std::vector<int16_t> states_to_heal = src->BattleStateHeal();
1062 src->ApplyConditions();
1063
1064 const lcf::rpg::State* pri_state = nullptr;
1065 bool pri_was_healed = false;
1066 for (size_t id = 1; id <= lcf::Data::states.size(); ++id) {
1067 auto was_healed = std::find(states_to_heal.begin(), states_to_heal.end(), id) != states_to_heal.end();
1068 if (!was_healed && !src->HasState(id)) {
1069 continue;
1070 }
1071
1072 auto* state = lcf::ReaderUtil::GetElement(lcf::Data::states, id);
1073 if (!pri_state || state->priority >= pri_state->priority) {
1074 pri_state = state;
1075 pri_was_healed = was_healed;
1076 }
1077 }
1078
1079 if (pri_state != nullptr) {
1080 std::string_view msg = pri_was_healed
1081 ? pri_state->message_recovery
1082 : pri_state->message_affected;
1083
1084 // RPG_RT behavior:
1085 // If state was healed, always prints.
1086 // If state is inflicted, only prints if msg not empty.
1087 if (pri_was_healed || !msg.empty()) {
1088 show_message = true;
1089 pending_message = ToString(msg);
1090 }
1091 }
1092
1093 if (action->GetType() != Game_BattleAlgorithm::Type::None || show_message) {
1094 action->GetSource()->Flash(31, 31, 31, 10, 10);
1095 }
1096
1097 if (show_message) {
1098 SetWait(4,4);
1099 SetBattleActionSubState(eShowMessage);
1100 return BattleActionReturn::eContinue;
1101 }
1102 battle_action_substate = ePost;

Callers

nothing calls this directly

Calls 15

GetSourceMethod · 0.80
NextBattleTurnMethod · 0.80
BattleStateHealMethod · 0.80
ApplyConditionsMethod · 0.80
HasStateMethod · 0.80
PushWithSubjectMethod · 0.80
ExistsMethod · 0.45
ClearMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected