Skip to content

Commit

Permalink
Merge pull request #1942 from KABoissonneault/fix/dual-non-immunity
Browse files Browse the repository at this point in the history
Added BUGFIX for "dual non-immunity" glitch.
  • Loading branch information
GriffinRichards authored Nov 2, 2023
2 parents 2304283 + 5ddf3e2 commit 959623f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/battle_ai_script_commands.c
Original file line number Diff line number Diff line change
Expand Up @@ -1484,7 +1484,13 @@ static void Cmd_get_highest_type_effectiveness(void)

if (gCurrentMove != MOVE_NONE)
{
// TypeCalc does not assign to gMoveResultFlags, Cmd_typecalc does
// This makes the check for gMoveResultFlags below always fail
#ifdef BUGFIX
gMoveResultFlags = TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget);
#else
TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget);
#endif

if (gBattleMoveDamage == 120) // Super effective STAB.
gBattleMoveDamage = AI_EFFECTIVENESS_x2;
Expand Down Expand Up @@ -1519,7 +1525,16 @@ static void Cmd_if_type_effectiveness(void)
gBattleMoveDamage = AI_EFFECTIVENESS_x1;
gCurrentMove = AI_THINKING_STRUCT->moveConsidered;

// TypeCalc does not assign to gMoveResultFlags, Cmd_typecalc does
// This makes the check for gMoveResultFlags below always fail
// This is how you get the "dual non-immunity" glitch, where AI
// will use ineffective moves on immune pokémon if the second type
// has a non-neutral, non-immune effectiveness
#ifdef BUGFIX
gMoveResultFlags = TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget);
#else
TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget);
#endif

if (gBattleMoveDamage == 120) // Super effective STAB.
gBattleMoveDamage = AI_EFFECTIVENESS_x2;
Expand Down

0 comments on commit 959623f

Please sign in to comment.