Removed GET_MOVE_EFFECT

This commit is contained in:
Nephrite 2024-02-25 18:22:21 +09:00
parent b55b1eaa5d
commit 9db03fb263
2 changed files with 11 additions and 9 deletions

View file

@ -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
{

View file

@ -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];
}