Skip to content

Commit

Permalink
add emitResult argument to ShouldSwitch AI functions (#3784)
Browse files Browse the repository at this point in the history
  • Loading branch information
DizzyEggg authored Dec 21, 2023
1 parent 5cdee87 commit 698e69f
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 113 deletions.
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

0 comments on commit 698e69f

Please sign in to comment.