Skip to content

Commit ed6e15b

Browse files
committed
Battle: Support certain Maniac Battle Hooks in 2k battle
ATB is e.g. not supported as 2k does not use a ATB system.
1 parent 17044b2 commit ed6e15b

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

src/scene_battle.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,21 @@ void Scene_Battle::RemoveCurrentAction() {
570570
void Scene_Battle::ActionSelectedCallback(Game_Battler* for_battler) {
571571
assert(for_battler->GetBattleAlgorithm() != nullptr);
572572

573+
auto single_target = for_battler->GetBattleAlgorithm()->GetOriginalSingleTarget();
574+
auto group_targets = for_battler->GetBattleAlgorithm()->GetOriginalPartyTarget();
575+
// Target: 0 None, 1 Single Enemy, 2 All Enemies, 3 Single Ally, 4 All Allies
576+
Game_Battle::ManiacBattleHook(
577+
Game_Interpreter_Battle::ManiacBattleHookType::Targetting,
578+
for_battler->GetType() == Game_Battler::Type_Enemy,
579+
for_battler->GetPartyIndex(),
580+
for_battler->GetBattleAlgorithm()->GetActionType(),
581+
for_battler->GetBattleAlgorithm()->GetActionId(),
582+
single_target
583+
? (single_target->GetType() != Game_Battler::Type_Enemy ? 1 : 3)
584+
: (group_targets->GetRandomActiveBattler()->GetType() != Game_Battler::Type_Enemy ? 2 : 4),
585+
single_target ? single_target->GetPartyIndex() : 0
586+
);
587+
573588
if (for_battler->GetBattleAlgorithm() == nullptr) {
574589
Output::Warning("ActionSelectedCallback: Invalid action for battler {} ({})",
575590
for_battler->GetId(), for_battler->GetName());

src/scene_battle_rpg2k.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,12 @@ void Scene_Battle_Rpg2k::vUpdate() {
205205
break;
206206
}
207207

208+
// this is checked separately because we want normal events to be processed
209+
// just not sub-events called by maniacs battle hooks.
210+
if (state != State_Victory && state != State_Defeat && Game_Battle::ManiacProcessSubEvents()) {
211+
break;
212+
}
213+
208214
if (!CheckWait()) {
209215
break;
210216
}

src/scene_battle_rpg2k3.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2853,21 +2853,6 @@ void Scene_Battle_Rpg2k3::RowSelected() {
28532853
}
28542854

28552855
void Scene_Battle_Rpg2k3::ActionSelectedCallback(Game_Battler* for_battler) {
2856-
auto single_target = for_battler->GetBattleAlgorithm()->GetOriginalSingleTarget();
2857-
auto group_targets = for_battler->GetBattleAlgorithm()->GetOriginalPartyTarget();
2858-
// Target: 0 None, 1 Single Enemy, 2 All Enemies, 3 Single Ally, 4 All Allies
2859-
Game_Battle::ManiacBattleHook(
2860-
Game_Interpreter_Battle::ManiacBattleHookType::Targetting,
2861-
for_battler->GetType() == Game_Battler::Type_Enemy,
2862-
for_battler->GetPartyIndex(),
2863-
for_battler->GetBattleAlgorithm()->GetActionType(),
2864-
for_battler->GetBattleAlgorithm()->GetActionId(),
2865-
single_target
2866-
? (single_target->GetType() != Game_Battler::Type_Enemy ? 1 : 3)
2867-
: (group_targets->GetRandomActiveBattler()->GetType() != Game_Battler::Type_Enemy ? 2 : 4),
2868-
single_target ? single_target->GetPartyIndex() : 0
2869-
);
2870-
28712856
for_battler->SetAtbGauge(0);
28722857

28732858
if (for_battler == active_actor) {

0 commit comments

Comments
 (0)