Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an emit argument to the ShouldSwitch AI functions #3784

Merged
merged 7 commits into from
Dec 21, 2023
2 changes: 1 addition & 1 deletion include/battle_ai_switch_items.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
void GetAIPartyIndexes(u32 battlerId, s32 *firstId, s32 *lastId);
void AI_TrySwitchOrUseItem(u32 battler);
u8 GetMostSuitableMonToSwitchInto(u32 battler, bool32 switchAfterMonKOd);
bool32 ShouldSwitch(u32 battler);
bool32 ShouldSwitch(u32 battler, bool32 emitResult);

#endif // GUARD_BATTLE_AI_SWITCH_ITEMS_H
2 changes: 1 addition & 1 deletion src/battle_ai_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -3705,7 +3705,7 @@ static s32 AI_CheckViability(u32 battlerAtk, u32 battlerDef, u32 move, s32 score
}
break;
case EFFECT_BATON_PASS:
if (ShouldSwitch(battlerAtk) && (gBattleMons[battlerAtk].status2 & STATUS2_SUBSTITUTE
if (ShouldSwitch(battlerAtk, FALSE) && (gBattleMons[battlerAtk].status2 & STATUS2_SUBSTITUTE
|| (gStatuses3[battlerAtk] & (STATUS3_ROOTED | STATUS3_AQUA_RING | STATUS3_MAGNET_RISE | STATUS3_POWER_TRICK))
|| AnyStatIsRaised(battlerAtk)))
ADJUST_SCORE(5);
Expand Down
Loading
Loading