diff --git a/include/battle.h b/include/battle.h index b1e3811929..a90a4d848a 100644 --- a/include/battle.h +++ b/include/battle.h @@ -60,8 +60,7 @@ struct __attribute__((packed, aligned(2))) BattleMoveEffect u16 padding:9; }; -#define GET_MOVE_EFFECT(move) gBattleMoveEffects[gMovesInfo[move].effect] -#define GET_MOVE_BATTLESCRIPT(move) GET_MOVE_EFFECT(move).battleScript +#define GET_MOVE_BATTLESCRIPT(move) gBattleMoveEffects[gMovesInfo[move].effect].battleScript struct ResourceFlags { diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index f4060fc83b..9d796c4e9f 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1370,7 +1370,7 @@ static void Cmd_attackcanceler(void) gHitMarker |= HITMARKER_OBEYS; // Check if no available target present on the field or if Sky Battles ban the move if ((NoTargetPresent(gBattlerAttacker, gCurrentMove) - && (!GET_MOVE_EFFECT(gCurrentMove).twoTurnEffect || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS))) + && (!gBattleMoveEffects[gMovesInfo[gCurrentMove].effect].twoTurnEffect || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS))) || (IsMoveNotAllowedInSkyBattles(gCurrentMove))) { if (gMovesInfo[gCurrentMove].effect == EFFECT_FLING) // Edge case for removing a mon's item when there is no target available after using Fling. @@ -1378,7 +1378,7 @@ static void Cmd_attackcanceler(void) else gBattlescriptCurrInstr = BattleScript_FailedFromAtkString; - if (!GET_MOVE_EFFECT(gCurrentMove).twoTurnEffect || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)) + if (!gBattleMoveEffects[gMovesInfo[gCurrentMove].effect].twoTurnEffect || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)) CancelMultiTurnMoves(gBattlerAttacker); return; } @@ -1457,7 +1457,7 @@ static void Cmd_attackcanceler(void) } else if (IsBattlerProtected(gBattlerTarget, gCurrentMove) && (gCurrentMove != MOVE_CURSE || IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GHOST)) - && (!GET_MOVE_EFFECT(gCurrentMove).twoTurnEffect || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)) + && (!gBattleMoveEffects[gMovesInfo[gCurrentMove].effect].twoTurnEffect || (gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)) && gMovesInfo[gCurrentMove].effect != EFFECT_SUCKER_PUNCH && gMovesInfo[gCurrentMove].effect != EFFECT_UPPER_HAND) { @@ -9656,7 +9656,9 @@ static void Cmd_various(void) VARIOUS_ARGS(const u8 *failInstr); u16 move = gLastPrintedMoves[gBattlerTarget]; if (move == MOVE_NONE || move == MOVE_UNAVAILABLE || MoveHasMoveEffectSelf(move, MOVE_EFFECT_RECHARGE) - || gMovesInfo[move].instructBanned || GET_MOVE_EFFECT(move).twoTurnEffect || IsDynamaxed(gBattlerTarget)) + || gMovesInfo[move].instructBanned + || gBattleMoveEffects[gMovesInfo[move].effect].twoTurnEffect + || IsDynamaxed(gBattlerTarget)) { gBattlescriptCurrInstr = cmd->failInstr; } @@ -10737,7 +10739,8 @@ static void TryResetProtectUseCounter(u32 battler) { u32 lastMove = gLastResultingMoves[battler]; if (lastMove == MOVE_UNAVAILABLE - || (!GET_MOVE_EFFECT(lastMove).usesProtectCounter && (B_ALLY_SWITCH_FAIL_CHANCE >= GEN_9 && gMovesInfo[lastMove].effect != EFFECT_ALLY_SWITCH))) + || (!gBattleMoveEffects[gMovesInfo[lastMove].effect].usesProtectCounter + && (B_ALLY_SWITCH_FAIL_CHANCE >= GEN_9 && gMovesInfo[lastMove].effect != EFFECT_ALLY_SWITCH))) gDisableStructs[battler].protectUses = 0; } @@ -12718,7 +12721,7 @@ static void Cmd_settypetorandomresistance(void) { gBattlescriptCurrInstr = cmd->failInstr; } - else if (GET_MOVE_EFFECT(gLastLandedMoves[gBattlerAttacker]).twoTurnEffect + else if (gBattleMoveEffects[gMovesInfo[gLastLandedMoves[gBattlerAttacker]].effect].twoTurnEffect && gBattleMons[gLastHitBy[gBattlerAttacker]].status2 & STATUS2_MULTIPLETURNS) { gBattlescriptCurrInstr = cmd->failInstr; @@ -12834,7 +12837,7 @@ static void Cmd_trychoosesleeptalkmove(void) for (i = 0; i < MAX_MON_MOVES; i++) { if (gMovesInfo[gBattleMons[gBattlerAttacker].moves[i]].sleepTalkBanned - || GET_MOVE_EFFECT(gBattleMons[gBattlerAttacker].moves[i]).twoTurnEffect) + || gBattleMoveEffects[gMovesInfo[gBattleMons[gBattlerAttacker].moves[i]].effect].twoTurnEffect) { unusableMovesBits |= gBitTable[i]; }