Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Cmd_if_type_effectiveness(void)
- {
- u8 damageVar;
- gDynamicBasePower = 0;
- gBattleStruct->dynamicMoveType = 0;
- gBattleScripting.dmgMultiplier = 1;
- gMoveResultFlags = 0;
- gCritMultiplier = 1;
- 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
- // This bug is fixed in this mod
- gMoveResultFlags = TypeCalc(gCurrentMove, sBattler_AI, gBattlerTarget);
- if (gBattleMoveDamage >= 180)
- gBattleMoveDamage = AI_EFFECTIVENESS_x4;
- if (gBattleMoveDamage <= 15)
- gBattleMoveDamage = AI_EFFECTIVENESS_x0_25;
- if (gBattleMoveDamage >= 90)
- gBattleMoveDamage = AI_EFFECTIVENESS_x2;
- if (gBattleMoveDamage <= 30)
- gBattleMoveDamage = AI_EFFECTIVENESS_x0_5;
- if (gMoveResultFlags & MOVE_RESULT_DOESNT_AFFECT_FOE)
- gBattleMoveDamage = AI_EFFECTIVENESS_x0;
- // Store gBattleMoveDamage in a u8 variable because gAIScriptPtr[1] is a u8.
- damageVar = gBattleMoveDamage;
- if (damageVar == gAIScriptPtr[1])
- gAIScriptPtr = T1_READ_PTR(gAIScriptPtr + 2);
- else
- gAIScriptPtr += 6;
- }
Advertisement
Add Comment
Please, Sign In to add comment