Adjust Canceler naming to contain only one l (#8258)

This commit is contained in:
Alex 2025-11-15 18:44:16 +01:00 committed by GitHub
parent e472d277d2
commit e445160c92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 132 additions and 135 deletions

View File

@ -1841,7 +1841,6 @@
.macro setmoveeffect effect:req
sethword sMOVE_EFFECT, \effect
sethword sSAVED_MOVE_EFFECT, \effect
.endm
.macro sethword dst:req, value:req

View File

@ -8,7 +8,7 @@
## 🌋 *REFACTORS* 🌋
📜 = Uses a migration script.
* Pursuit refactor by @PhallenTree in [#5707](https://github.com/rh-hideout/pokeemerald-expansion/pull/5707)
* Atk Canceller refactor / reorder / clean up by @AlexOn1ine in [#5885](https://github.com/rh-hideout/pokeemerald-expansion/pull/5885)
* Atk Canceler refactor / reorder / clean up by @AlexOn1ine in [#5885](https://github.com/rh-hideout/pokeemerald-expansion/pull/5885)
* Battle Weather Refactor by @AlexOn1ine in [#5833](https://github.com/rh-hideout/pokeemerald-expansion/pull/5833)
* Replace WEATHER_HAS_EFFECT with HasWeatherEffect by @AlexOn1ine in [#6069](https://github.com/rh-hideout/pokeemerald-expansion/pull/6069)
* Cleaned up Trainer Slides, added automated Trainer Slide tests, add new Enemy Critical Hit Slide by @pkmnsnfrn and @AlexOn1ine, @hedara90, @AsparagusEduardo, @mrgriffin in [#6018](https://github.com/rh-hideout/pokeemerald-expansion/pull/6018)

View File

@ -212,7 +212,7 @@
* Untangle `InitBtlControllers` functions by @AsparagusEduardo in [#6748](https://github.com/rh-hideout/pokeemerald-expansion/pull/6748)
* Increase party action limit by @cawtds in [#7119](https://github.com/rh-hideout/pokeemerald-expansion/pull/7119)
* Adds Gen5+ Encore config by @AlexOn1ine in [#7051](https://github.com/rh-hideout/pokeemerald-expansion/pull/7051)
* Attackcanceller clean up by @AlexOn1ine in [#7210](https://github.com/rh-hideout/pokeemerald-expansion/pull/7210)
* Attackcanceler clean up by @AlexOn1ine in [#7210](https://github.com/rh-hideout/pokeemerald-expansion/pull/7210)
* Remove redundant move result flag checks by @AlexOn1ine in [#7223](https://github.com/rh-hideout/pokeemerald-expansion/pull/7223)
* Use dedicated functions for Mud/Water Sport by @AlexOn1ine in [#7248](https://github.com/rh-hideout/pokeemerald-expansion/pull/7248)
* Script clean up for Flame Burst and Costar by @AlexOn1ine in [#7264](https://github.com/rh-hideout/pokeemerald-expansion/pull/7264)
@ -400,7 +400,7 @@
* Add assumes for bag tests by @Bassoonian in [#7188](https://github.com/rh-hideout/pokeemerald-expansion/pull/7188)
* Fixes Booster Energy timing activation + Clean up by @AlexOn1ine in [#7175](https://github.com/rh-hideout/pokeemerald-expansion/pull/7175)
* Update .gitignore to add heal locations by @Bassoonian in [#7050](https://github.com/rh-hideout/pokeemerald-expansion/pull/7050)
* Attackcanceller clean up by @AlexOn1ine in [#7210](https://github.com/rh-hideout/pokeemerald-expansion/pull/7210)
* Attackcanceler clean up by @AlexOn1ine in [#7210](https://github.com/rh-hideout/pokeemerald-expansion/pull/7210)
* Remove redundant move result flag checks by @AlexOn1ine in [#7223](https://github.com/rh-hideout/pokeemerald-expansion/pull/7223)
* Add P_ASK_MOVE_CONFIRMATION by @pkmnsnfrn in [#7132](https://github.com/rh-hideout/pokeemerald-expansion/pull/7132)
- This will change the behavior of the game for players, as a new default is being set.

View File

@ -128,7 +128,7 @@
* Unified multi-strike move flags by @AsparagusEduardo in https://github.com/rh-hideout/pokeemerald-expansion/pull/3126
* Some `gActiveBattler` fixes by @ghoulslash in https://github.com/rh-hideout/pokeemerald-expansion/pull/3259
* ***Got rid of the `gActiveBattler` variable by @DizzyEggg*** in https://github.com/rh-hideout/pokeemerald-expansion/pull/3262
* Scale Shot now uses Multi-hit Moves' canceller by @AlexOn1ine in https://github.com/rh-hideout/pokeemerald-expansion/pull/3290
* Scale Shot now uses Multi-hit Moves' canceler by @AlexOn1ine in https://github.com/rh-hideout/pokeemerald-expansion/pull/3290
* Callnative functions now take ScriptContext arguments to allow using macros with .byte fields similar to vanilla battle script functions by @ghoulslash in https://github.com/rh-hideout/pokeemerald-expansion/pull/3294
* Converted some `VARIOUS`s to `callnative`s by @AsparagusEduardo in https://github.com/rh-hideout/pokeemerald-expansion/pull/3269
* Refactored battle terrain text string tables and removed `EFFECT_REMOVE_TERRAIN` by @LOuroboros in https://github.com/rh-hideout/pokeemerald-expansion/pull/3247

View File

@ -693,7 +693,7 @@ struct BattleStruct
u8 fickleBeamBoosted:1;
u8 poisonPuppeteerConfusion:1;
u16 startingStatusTimer;
u8 atkCancellerTracker;
u8 atkCancelerTracker;
struct BattleTvMovePoints tvMovePoints;
struct BattleTv tv;
u8 AI_monToSwitchIntoId[MAX_BATTLERS_COUNT];
@ -904,7 +904,7 @@ struct BattleScripting
u8 specialTrainerBattleType;
bool8 monCaught;
s32 savedDmg;
u16 savedMoveEffect; // For moves hitting multiple targets.
u16 unused_0x2c;
u16 moveEffect;
u16 multihitMoveEffect;
u8 illusionNickHack; // To properly display nick in STRINGID_ENEMYABOUTTOSWITCHPKMN.

View File

@ -106,35 +106,35 @@ struct TypePower
enum MoveSuccessOrder
{
CANCELLER_FLAGS,
CANCELLER_STANCE_CHANGE_1,
CANCELLER_SKY_DROP,
CANCELLER_RECHARGE,
CANCELLER_ASLEEP_OR_FROZEN,
CANCELLER_OBEDIENCE,
CANCELLER_TRUANT,
CANCELLER_FLINCH,
CANCELLER_DISABLED,
CANCELLER_VOLATILE_BLOCKED,
CANCELLER_TAUNTED,
CANCELLER_IMPRISONED,
CANCELLER_CONFUSED,
CANCELLER_PARALYSED,
CANCELLER_INFATUATION,
CANCELLER_BIDE,
CANCELLER_THAW,
CANCELLER_STANCE_CHANGE_2,
CANCELLER_CHOICE_LOCK,
CANCELLER_WEATHER_PRIMAL,
CANCELLER_DYNAMAX_BLOCKED,
CANCELLER_POWDER_STATUS,
CANCELLER_PROTEAN,
CANCELLER_PSYCHIC_TERRAIN,
CANCELLER_EXPLODING_DAMP,
CANCELLER_MULTIHIT_MOVES,
CANCELLER_Z_MOVES,
CANCELLER_MULTI_TARGET_MOVES,
CANCELLER_END,
CANCELER_FLAGS,
CANCELER_STANCE_CHANGE_1,
CANCELER_SKY_DROP,
CANCELER_RECHARGE,
CANCELER_ASLEEP_OR_FROZEN,
CANCELER_OBEDIENCE,
CANCELER_TRUANT,
CANCELER_FLINCH,
CANCELER_DISABLED,
CANCELER_VOLATILE_BLOCKED,
CANCELER_TAUNTED,
CANCELER_IMPRISONED,
CANCELER_CONFUSED,
CANCELER_PARALYSED,
CANCELER_INFATUATION,
CANCELER_BIDE,
CANCELER_THAW,
CANCELER_STANCE_CHANGE_2,
CANCELER_CHOICE_LOCK,
CANCELER_WEATHER_PRIMAL,
CANCELER_DYNAMAX_BLOCKED,
CANCELER_POWDER_STATUS,
CANCELER_PROTEAN,
CANCELER_PSYCHIC_TERRAIN,
CANCELER_EXPLODING_DAMP,
CANCELER_MULTIHIT_MOVES,
CANCELER_Z_MOVES,
CANCELER_MULTI_TARGET_MOVES,
CANCELER_END,
};
enum Obedience
@ -147,7 +147,7 @@ enum Obedience
DISOBEYS_RANDOM_MOVE,
};
enum MoveCanceller
enum MoveCanceler
{
MOVE_STEP_SUCCESS,
MOVE_STEP_BREAK,
@ -186,7 +186,7 @@ enum SleepClauseBlock
enum SkyDropState
{
SKY_DROP_IGNORE,
SKY_DROP_ATTACKCANCELLER_CHECK,
SKY_DROP_ATTACKCANCELER_CHECK,
SKY_DROP_GRAVITY_ON_AIRBORNE,
SKY_DROP_CANCEL_MULTI_TURN_MOVES,
SKY_DROP_STATUS_YAWN,
@ -239,8 +239,8 @@ bool32 IsAbilityAndRecord(u32 battler, u32 battlerAbility, u32 abilityToCheck);
u32 DoEndTurnEffects(void);
bool32 HandleFaintedMonActions(void);
void TryClearRageAndFuryCutter(void);
enum MoveCanceller AtkCanceller_MoveSuccessOrder(void);
void SetAtkCancellerForCalledMove(void);
enum MoveCanceler AtkCanceler_MoveSuccessOrder(void);
void SetAtkCancelerForCalledMove(void);
bool32 HasNoMonsToSwitch(u32 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2);
bool32 TryChangeBattleWeather(u32 battler, u32 battleWeatherId, u32 ability);
bool32 TryChangeBattleTerrain(u32 battler, u32 statusFlag);

View File

@ -31,7 +31,7 @@
#define sSPECIAL_TRAINER_BATTLE_TYPE (gBattleScripting + 0x26) // specialTrainerBattleType
#define sMON_CAUGHT (gBattleScripting + 0x27) // monCaught
#define sSAVED_DMG (gBattleScripting + 0x28) // savedDmg
#define sSAVED_MOVE_EFFECT (gBattleScripting + 0x2C) // savedMoveEffect
#define sUNUSED_0x2C (gBattleScripting + 0x2C) // unused_0x2c
#define sMOVE_EFFECT (gBattleScripting + 0x2E) // moveEffect
#define sMULTIHIT_EFFECT (gBattleScripting + 0x30) // multihitMoveEffect
#define sILLUSION_NICK_HACK (gBattleScripting + 0x32) // illusionNickHack

View File

@ -5152,7 +5152,7 @@ static void TurnValuesCleanUp(bool8 var0)
gSideTimers[B_SIDE_PLAYER].followmeTimer = 0;
gSideTimers[B_SIDE_OPPONENT].followmeTimer = 0;
gBattleStruct->pledgeMove = FALSE; // combined pledge move may not have been used due to a canceller
gBattleStruct->pledgeMove = FALSE; // combined pledge move may not have been used due to a canceler
ClearPursuitValues();
ClearDamageCalcResults();
}

View File

@ -1097,7 +1097,7 @@ static void Cmd_attackcanceler(void)
gBattlescriptCurrInstr = BattleScript_MoveEnd;
return;
}
if (AtkCanceller_MoveSuccessOrder() != MOVE_STEP_SUCCESS)
if (AtkCanceler_MoveSuccessOrder() != MOVE_STEP_SUCCESS)
return;
if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_OFF
@ -1162,7 +1162,7 @@ static void Cmd_attackcanceler(void)
gBattlescriptCurrInstr = BattleScript_FailedFromAtkString;
if (!gBattleMoveEffects[effect].twoTurnEffect || (gBattleMons[gBattlerAttacker].volatiles.multipleTurns))
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
return;
}
@ -1175,7 +1175,7 @@ static void Cmd_attackcanceler(void)
// Edge case for bouncing a powder move against a grass type pokemon.
ClearDamageCalcResults();
SetAtkCancellerForCalledMove();
SetAtkCancelerForCalledMove();
gEffectBattler = gBattlerTarget;
if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker, TRUE))
{
@ -1209,7 +1209,7 @@ static void Cmd_attackcanceler(void)
if (gBattleStruct->bouncedMoveIsUsed)
{
ClearDamageCalcResults();
SetAtkCancellerForCalledMove(); // Edge case for bouncing a powder move against a grass type pokemon.
SetAtkCancelerForCalledMove(); // Edge case for bouncing a powder move against a grass type pokemon.
BattleScriptCall(BattleScript_MagicBounce);
gBattlerAbility = battler;
return;
@ -1262,7 +1262,7 @@ static void Cmd_attackcanceler(void)
{
if (!CanBattlerAvoidContactEffects(gBattlerAttacker, gBattlerTarget, GetBattlerAbility(gBattlerAttacker), GetBattlerHoldEffect(gBattlerAttacker, TRUE), gCurrentMove))
gProtectStructs[gBattlerAttacker].touchedProtectLike = TRUE;
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattleStruct->moveResultFlags[gBattlerTarget] |= MOVE_RESULT_MISSED;
gLastLandedMoves[gBattlerTarget] = 0;
gLastHitByType[gBattlerTarget] = 0;
@ -1824,7 +1824,7 @@ static void Cmd_typecalc(void)
{
CMD_ARGS();
if (!IsSpreadMove(GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove))) // Handled in CANCELLER_MULTI_TARGET_MOVES for Spread Moves
if (!IsSpreadMove(GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove))) // Handled in CANCELER_MULTI_TARGET_MOVES for Spread Moves
{
struct DamageContext ctx = {0};
ctx.battlerAtk = gBattlerAttacker;
@ -6433,7 +6433,6 @@ static void Cmd_moveend(void)
gBattleStruct->moveTarget[gBattlerAttacker] = gBattlerTarget = nextTarget; // Fix for moxie spread moves
gBattleScripting.moveendState = 0;
MoveValuesCleanUp();
gBattleScripting.moveEffect = gBattleScripting.savedMoveEffect;
if (moveEffect == EFFECT_EXPLOSION || moveEffect == EFFECT_MISTY_EXPLOSION // Edge case for Explosion not changing targets
|| moveEffect == EFFECT_SYNCHRONOISE) // So we don't go back to the Synchronoise script
@ -8504,9 +8503,9 @@ static void Cmd_hidepartystatussummary(void)
static void ResetValuesForCalledMove(void)
{
if (gBattlerByTurnOrder[gCurrentTurnActionNumber] != gBattlerAttacker)
gBattleStruct->atkCancellerTracker = 0;
gBattleStruct->atkCancelerTracker = 0;
else
SetAtkCancellerForCalledMove();
SetAtkCancelerForCalledMove();
gBattleScripting.animTurn = 0;
gBattleScripting.animTargetsHit = 0;
SetTypeBeforeUsingMove(gCurrentMove, gBattlerAttacker);
@ -11526,7 +11525,7 @@ static void Cmd_trysetencore(void)
// Redirection such as Follow Me is already covered in HandleAction_UseMove of battle_util.c
if (gDisableStructs[gBattlerTarget].encoredMove != GetChosenMoveFromPosition(gBattlerTarget))
gBattleStruct->moveTarget[gBattlerTarget] = SetRandomTarget(gBattlerTarget);
// Encore always lasts 3 turns, but we need to account for a scenario where Encore changes the move during the same turn.
if (HasBattlerActedThisTurn(gBattlerTarget))
gDisableStructs[gBattlerTarget].encoreTimer = 4;

View File

@ -390,12 +390,11 @@ void HandleAction_UseMove(void)
return;
}
gBattleStruct->atkCancellerTracker = 0;
gBattleStruct->atkCancelerTracker = 0;
ClearDamageCalcResults();
gMultiHitCounter = 0;
gBattleScripting.savedDmg = 0;
gBattleCommunication[MISS_TYPE] = 0;
gBattleScripting.savedMoveEffect = 0;
gCurrMovePos = gChosenMovePos = gBattleStruct->chosenMovePositions[gBattlerAttacker];
// choose move
@ -1077,7 +1076,7 @@ const u8 *CheckSkyDropState(u32 battler, enum SkyDropState skyDropState)
// Set confused status
gBattleMons[otherSkyDropper].volatiles.confusionTurns = ((Random()) % 4) + 2;
if (skyDropState == SKY_DROP_ATTACKCANCELLER_CHECK)
if (skyDropState == SKY_DROP_ATTACKCANCELER_CHECK)
{
gBattleStruct->skyDropTargets[battler] = SKY_DROP_RELEASED_TARGET;
}
@ -1893,13 +1892,13 @@ static inline bool32 TryActivatePowderStatus(u32 move)
return FALSE;
}
void SetAtkCancellerForCalledMove(void)
void SetAtkCancelerForCalledMove(void)
{
gBattleStruct->atkCancellerTracker = CANCELLER_VOLATILE_BLOCKED;
gBattleStruct->atkCancelerTracker = CANCELER_VOLATILE_BLOCKED;
gBattleStruct->isAtkCancelerForCalledMove = TRUE;
}
static enum MoveCanceller CancellerFlags(void)
static enum MoveCanceler CancelerFlags(void)
{
gBattleMons[gBattlerAttacker].volatiles.destinyBond = FALSE;
gBattleMons[gBattlerAttacker].volatiles.grudge = FALSE;
@ -1907,14 +1906,14 @@ static enum MoveCanceller CancellerFlags(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerStanceChangeOne(void)
static enum MoveCanceler CancelerStanceChangeOne(void)
{
if (B_STANCE_CHANGE_FAIL < GEN_7 && TryFormChangeBeforeMove())
return MOVE_STEP_BREAK;
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerSkyDrop(void)
static enum MoveCanceler CancelerSkyDrop(void)
{
// If Pokemon is being held in Sky Drop
if (gBattleMons[gBattlerAttacker].volatiles.semiInvulnerable == STATE_SKY_DROP)
@ -1926,11 +1925,11 @@ static enum MoveCanceller CancellerSkyDrop(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerRecharge(void)
static enum MoveCanceler CancelerRecharge(void)
{
if (gDisableStructs[gBattlerAttacker].rechargeTimer > 0)
{
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattlescriptCurrInstr = BattleScript_MoveUsedMustRecharge;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
return MOVE_STEP_BREAK;
@ -1938,7 +1937,7 @@ static enum MoveCanceller CancellerRecharge(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerAsleepOrFrozen(void)
static enum MoveCanceler CancelerAsleepOrFrozen(void)
{
if (gBattleMons[gBattlerAttacker].status1 & STATUS1_SLEEP)
{
@ -2003,7 +2002,7 @@ static enum MoveCanceller CancellerAsleepOrFrozen(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerObedience(void)
static enum MoveCanceler CancelerObedience(void)
{
enum Obedience obedienceResult = GetAttackerObedienceForAction();
if (!(gHitMarker & HITMARKER_NO_PPDEDUCT) // Don't check obedience after first hit of multi target move or multi hit moves
@ -2048,7 +2047,7 @@ static enum MoveCanceller CancellerObedience(void)
break;
case DISOBEYS_RANDOM_MOVE:
gCalledMove = gBattleMons[gBattlerAttacker].moves[gCurrMovePos];
SetAtkCancellerForCalledMove();
SetAtkCancelerForCalledMove();
gBattlescriptCurrInstr = BattleScript_IgnoresAndUsesRandomMove;
gBattlerTarget = GetBattleMoveTarget(gCalledMove, NO_TARGET_OVERRIDE);
gHitMarker |= HITMARKER_OBEYS;
@ -2060,11 +2059,11 @@ static enum MoveCanceller CancellerObedience(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerTruant(void)
static enum MoveCanceler CancelerTruant(void)
{
if (GetBattlerAbility(gBattlerAttacker) == ABILITY_TRUANT && gDisableStructs[gBattlerAttacker].truantCounter)
{
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
gBattleCommunication[MULTISTRING_CHOOSER] = B_MSG_LOAFING;
gBattlerAbility = gBattlerAttacker;
@ -2075,12 +2074,12 @@ static enum MoveCanceller CancellerTruant(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerFlinch(void)
static enum MoveCanceler CancelerFlinch(void)
{
if (gBattleMons[gBattlerAttacker].volatiles.flinched)
{
gProtectStructs[gBattlerAttacker].unableToUseMove = TRUE;
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattlescriptCurrInstr = BattleScript_MoveUsedFlinched;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
return MOVE_STEP_BREAK;
@ -2088,13 +2087,13 @@ static enum MoveCanceller CancellerFlinch(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerDisabled(void)
static enum MoveCanceler CancelerDisabled(void)
{
if (GetActiveGimmick(gBattlerAttacker) != GIMMICK_Z_MOVE && gDisableStructs[gBattlerAttacker].disabledMove == gCurrentMove && gDisableStructs[gBattlerAttacker].disabledMove != MOVE_NONE)
{
gProtectStructs[gBattlerAttacker].unableToUseMove = TRUE;
gBattleScripting.battler = gBattlerAttacker;
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattlescriptCurrInstr = BattleScript_MoveUsedIsDisabled;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
return MOVE_STEP_BREAK;
@ -2102,13 +2101,13 @@ static enum MoveCanceller CancellerDisabled(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerVolatileBlocked(void)
static enum MoveCanceler CancelerVolatileBlocked(void)
{
if (GetActiveGimmick(gBattlerAttacker) != GIMMICK_Z_MOVE && gBattleMons[gBattlerAttacker].volatiles.healBlock && IsHealBlockPreventingMove(gBattlerAttacker, gCurrentMove))
{
gProtectStructs[gBattlerAttacker].unableToUseMove = TRUE;
gBattleScripting.battler = gBattlerAttacker;
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattlescriptCurrInstr = BattleScript_MoveUsedHealBlockPrevents;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
return MOVE_STEP_BREAK;
@ -2117,7 +2116,7 @@ static enum MoveCanceller CancellerVolatileBlocked(void)
{
gProtectStructs[gBattlerAttacker].unableToUseMove = TRUE;
gBattleScripting.battler = gBattlerAttacker;
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattlescriptCurrInstr = BattleScript_MoveUsedGravityPrevents;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
return MOVE_STEP_BREAK;
@ -2125,7 +2124,7 @@ static enum MoveCanceller CancellerVolatileBlocked(void)
else if (GetActiveGimmick(gBattlerAttacker) != GIMMICK_Z_MOVE && gDisableStructs[gBattlerAttacker].throatChopTimer > gBattleTurnCounter && IsSoundMove(gCurrentMove))
{
gProtectStructs[gBattlerAttacker].unableToUseMove = TRUE;
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattlescriptCurrInstr = BattleScript_MoveUsedIsThroatChopPrevented;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
return MOVE_STEP_BREAK;
@ -2133,12 +2132,12 @@ static enum MoveCanceller CancellerVolatileBlocked(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerTaunted(void)
static enum MoveCanceler CancelerTaunted(void)
{
if (GetActiveGimmick(gBattlerAttacker) != GIMMICK_Z_MOVE && gDisableStructs[gBattlerAttacker].tauntTimer && IsBattleMoveStatus(gCurrentMove))
{
gProtectStructs[gBattlerAttacker].unableToUseMove = TRUE;
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattlescriptCurrInstr = BattleScript_MoveUsedIsTaunted;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
return MOVE_STEP_BREAK;
@ -2146,12 +2145,12 @@ static enum MoveCanceller CancellerTaunted(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerImprisoned(void)
static enum MoveCanceler CancelerImprisoned(void)
{
if (GetActiveGimmick(gBattlerAttacker) != GIMMICK_Z_MOVE && GetImprisonedMovesCount(gBattlerAttacker, gCurrentMove))
{
gProtectStructs[gBattlerAttacker].unableToUseMove = TRUE;
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattlescriptCurrInstr = BattleScript_MoveUsedIsImprisoned;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
return MOVE_STEP_BREAK;
@ -2159,7 +2158,7 @@ static enum MoveCanceller CancellerImprisoned(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerConfused(void)
static enum MoveCanceler CancelerConfused(void)
{
if (gBattleStruct->isAtkCancelerForCalledMove)
return MOVE_STEP_SUCCESS;
@ -2203,7 +2202,7 @@ static enum MoveCanceller CancellerConfused(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerParalysed(void)
static enum MoveCanceler CancelerParalysed(void)
{
if (!gBattleStruct->isAtkCancelerForCalledMove
&& (gBattleMons[gBattlerAttacker].status1 & STATUS1_PARALYSIS)
@ -2212,7 +2211,7 @@ static enum MoveCanceller CancellerParalysed(void)
{
gProtectStructs[gBattlerAttacker].nonVolatileStatusImmobility = TRUE;
// This is removed in FRLG and Emerald for some reason
//CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
//CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattlescriptCurrInstr = BattleScript_MoveUsedIsParalyzed;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
return MOVE_STEP_BREAK;
@ -2220,7 +2219,7 @@ static enum MoveCanceller CancellerParalysed(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerInfatuation(void)
static enum MoveCanceler CancelerInfatuation(void)
{
if (!gBattleStruct->isAtkCancelerForCalledMove && gBattleMons[gBattlerAttacker].volatiles.infatuation)
{
@ -2234,7 +2233,7 @@ static enum MoveCanceller CancellerInfatuation(void)
BattleScriptPush(BattleScript_MoveUsedIsInLoveCantAttack);
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
gProtectStructs[gBattlerAttacker].unableToUseMove = TRUE;
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattlescriptCurrInstr = BattleScript_MoveUsedIsInLove;
}
return MOVE_STEP_BREAK;
@ -2242,7 +2241,7 @@ static enum MoveCanceller CancellerInfatuation(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerBide(void)
static enum MoveCanceler CancelerBide(void)
{
if (gBattleMons[gBattlerAttacker].volatiles.bideTurns)
{
@ -2272,7 +2271,7 @@ static enum MoveCanceller CancellerBide(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerThaw(void)
static enum MoveCanceler CancelerThaw(void)
{
if (gBattleMons[gBattlerAttacker].status1 & STATUS1_FREEZE)
{
@ -2297,14 +2296,14 @@ static enum MoveCanceller CancellerThaw(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerStanceChangeTwo(void)
static enum MoveCanceler CancelerStanceChangeTwo(void)
{
if (B_STANCE_CHANGE_FAIL >= GEN_7 && !gBattleStruct->isAtkCancelerForCalledMove && TryFormChangeBeforeMove())
return MOVE_STEP_BREAK;
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerChoiceLock(void)
static enum MoveCanceler CancelerChoiceLock(void)
{
u16 *choicedMoveAtk = &gBattleStruct->choicedMove[gBattlerAttacker];
enum ItemHoldEffect holdEffect = GetBattlerHoldEffect(gBattlerAttacker, TRUE);
@ -2327,9 +2326,9 @@ static enum MoveCanceller CancellerChoiceLock(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerWeatherPrimal(void)
static enum MoveCanceler CancelerWeatherPrimal(void)
{
enum MoveCanceller effect = MOVE_STEP_SUCCESS;
enum MoveCanceler effect = MOVE_STEP_SUCCESS;
if (HasWeatherEffect() && GetMovePower(gCurrentMove) > 0)
{
u32 moveType = GetBattleMoveType(gCurrentMove);
@ -2347,7 +2346,7 @@ static enum MoveCanceller CancellerWeatherPrimal(void)
{
gBattleScripting.moveEffect = MOVE_EFFECT_NONE;
gProtectStructs[gBattlerAttacker].chargingTurn = FALSE;
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
BattleScriptCall(BattleScript_PrimalWeatherBlocksMove);
}
@ -2355,7 +2354,7 @@ static enum MoveCanceller CancellerWeatherPrimal(void)
return effect;
}
static enum MoveCanceller CancellerDynamaxBlocked(void)
static enum MoveCanceler CancelerDynamaxBlocked(void)
{
if ((GetActiveGimmick(gBattlerTarget) == GIMMICK_DYNAMAX) && IsMoveBlockedByDynamax(gCurrentMove))
{
@ -2366,7 +2365,7 @@ static enum MoveCanceller CancellerDynamaxBlocked(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerPowderStatus(void)
static enum MoveCanceler CancelerPowderStatus(void)
{
if (TryActivatePowderStatus(gCurrentMove))
{
@ -2383,7 +2382,7 @@ static enum MoveCanceller CancellerPowderStatus(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerProtean(void)
static enum MoveCanceler CancelerProtean(void)
{
u32 moveType = GetBattleMoveType(gCurrentMove);
if (ProteanTryChangeType(gBattlerAttacker, GetBattlerAbility(gBattlerAttacker), gCurrentMove, moveType))
@ -2400,7 +2399,7 @@ static enum MoveCanceller CancellerProtean(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerPsychicTerrain(void)
static enum MoveCanceler CancelerPsychicTerrain(void)
{
if (IsBattlerTerrainAffected(gBattlerTarget, STATUS_FIELD_PSYCHIC_TERRAIN)
&& GetChosenMovePriority(gBattlerAttacker, GetBattlerAbility(gBattlerAttacker)) > 0
@ -2408,7 +2407,7 @@ static enum MoveCanceller CancellerPsychicTerrain(void)
&& GetMoveTarget(gCurrentMove) != MOVE_TARGET_OPPONENTS_FIELD
&& !IsBattlerAlly(gBattlerAttacker, gBattlerTarget))
{
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELLER_CHECK);
CancelMultiTurnMoves(gBattlerAttacker, SKY_DROP_ATTACKCANCELER_CHECK);
gBattlescriptCurrInstr = BattleScript_MoveUsedPsychicTerrainPrevents;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
return MOVE_STEP_BREAK;
@ -2416,7 +2415,7 @@ static enum MoveCanceller CancellerPsychicTerrain(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerExplodingDamp(void)
static enum MoveCanceler CancelerExplodingDamp(void)
{
u32 dampBattler = IsAbilityOnField(ABILITY_DAMP);
if (dampBattler && IsMoveDampBanned(gCurrentMove))
@ -2429,7 +2428,7 @@ static enum MoveCanceller CancellerExplodingDamp(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerMultihitMoves(void)
static enum MoveCanceler CancelerMultihitMoves(void)
{
if (GetMoveEffect(gCurrentMove) == EFFECT_MULTI_HIT)
{
@ -2501,7 +2500,7 @@ static enum MoveCanceller CancellerMultihitMoves(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerZMoves(void)
static enum MoveCanceler CancelerZMoves(void)
{
if (GetActiveGimmick(gBattlerAttacker) == GIMMICK_Z_MOVE)
{
@ -2533,7 +2532,7 @@ static enum MoveCanceller CancellerZMoves(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller CancellerMultiTargetMoves(void)
static enum MoveCanceler CancelerMultiTargetMoves(void)
{
u32 moveTarget = GetBattlerMoveTargetType(gBattlerAttacker, gCurrentMove);
u32 abilityAtk = GetBattlerAbility(gBattlerAttacker);
@ -2581,46 +2580,46 @@ static enum MoveCanceller CancellerMultiTargetMoves(void)
return MOVE_STEP_SUCCESS;
}
static enum MoveCanceller (*const sMoveSuccessOrderCancellers[])(void) =
static enum MoveCanceler (*const sMoveSuccessOrderCancelers[])(void) =
{
[CANCELLER_FLAGS] = CancellerFlags,
[CANCELLER_STANCE_CHANGE_1] = CancellerStanceChangeOne,
[CANCELLER_SKY_DROP] = CancellerSkyDrop,
[CANCELLER_RECHARGE] = CancellerRecharge,
[CANCELLER_ASLEEP_OR_FROZEN] = CancellerAsleepOrFrozen,
[CANCELLER_OBEDIENCE] = CancellerObedience,
[CANCELLER_TRUANT] = CancellerTruant,
[CANCELLER_FLINCH] = CancellerFlinch,
[CANCELLER_INFATUATION] = CancellerInfatuation,
[CANCELLER_DISABLED] = CancellerDisabled,
[CANCELLER_VOLATILE_BLOCKED] = CancellerVolatileBlocked,
[CANCELLER_TAUNTED] = CancellerTaunted,
[CANCELLER_IMPRISONED] = CancellerImprisoned,
[CANCELLER_CONFUSED] = CancellerConfused,
[CANCELLER_PARALYSED] = CancellerParalysed,
[CANCELLER_BIDE] = CancellerBide,
[CANCELLER_THAW] = CancellerThaw,
[CANCELLER_STANCE_CHANGE_2] = CancellerStanceChangeTwo,
[CANCELLER_CHOICE_LOCK] = CancellerChoiceLock,
[CANCELLER_WEATHER_PRIMAL] = CancellerWeatherPrimal,
[CANCELLER_DYNAMAX_BLOCKED] = CancellerDynamaxBlocked,
[CANCELLER_POWDER_STATUS] = CancellerPowderStatus,
[CANCELLER_PROTEAN] = CancellerProtean,
[CANCELLER_PSYCHIC_TERRAIN] = CancellerPsychicTerrain,
[CANCELLER_EXPLODING_DAMP] = CancellerExplodingDamp,
[CANCELLER_MULTIHIT_MOVES] = CancellerMultihitMoves,
[CANCELLER_Z_MOVES] = CancellerZMoves,
[CANCELLER_MULTI_TARGET_MOVES] = CancellerMultiTargetMoves,
[CANCELER_FLAGS] = CancelerFlags,
[CANCELER_STANCE_CHANGE_1] = CancelerStanceChangeOne,
[CANCELER_SKY_DROP] = CancelerSkyDrop,
[CANCELER_RECHARGE] = CancelerRecharge,
[CANCELER_ASLEEP_OR_FROZEN] = CancelerAsleepOrFrozen,
[CANCELER_OBEDIENCE] = CancelerObedience,
[CANCELER_TRUANT] = CancelerTruant,
[CANCELER_FLINCH] = CancelerFlinch,
[CANCELER_INFATUATION] = CancelerInfatuation,
[CANCELER_DISABLED] = CancelerDisabled,
[CANCELER_VOLATILE_BLOCKED] = CancelerVolatileBlocked,
[CANCELER_TAUNTED] = CancelerTaunted,
[CANCELER_IMPRISONED] = CancelerImprisoned,
[CANCELER_CONFUSED] = CancelerConfused,
[CANCELER_PARALYSED] = CancelerParalysed,
[CANCELER_BIDE] = CancelerBide,
[CANCELER_THAW] = CancelerThaw,
[CANCELER_STANCE_CHANGE_2] = CancelerStanceChangeTwo,
[CANCELER_CHOICE_LOCK] = CancelerChoiceLock,
[CANCELER_WEATHER_PRIMAL] = CancelerWeatherPrimal,
[CANCELER_DYNAMAX_BLOCKED] = CancelerDynamaxBlocked,
[CANCELER_POWDER_STATUS] = CancelerPowderStatus,
[CANCELER_PROTEAN] = CancelerProtean,
[CANCELER_PSYCHIC_TERRAIN] = CancelerPsychicTerrain,
[CANCELER_EXPLODING_DAMP] = CancelerExplodingDamp,
[CANCELER_MULTIHIT_MOVES] = CancelerMultihitMoves,
[CANCELER_Z_MOVES] = CancelerZMoves,
[CANCELER_MULTI_TARGET_MOVES] = CancelerMultiTargetMoves,
};
enum MoveCanceller AtkCanceller_MoveSuccessOrder(void)
enum MoveCanceler AtkCanceler_MoveSuccessOrder(void)
{
enum MoveCanceller effect = MOVE_STEP_SUCCESS;
enum MoveCanceler effect = MOVE_STEP_SUCCESS;
while (gBattleStruct->atkCancellerTracker < CANCELLER_END && effect == MOVE_STEP_SUCCESS)
while (gBattleStruct->atkCancelerTracker < CANCELER_END && effect == MOVE_STEP_SUCCESS)
{
effect = sMoveSuccessOrderCancellers[gBattleStruct->atkCancellerTracker]();
gBattleStruct->atkCancellerTracker++;
effect = sMoveSuccessOrderCancelers[gBattleStruct->atkCancelerTracker]();
gBattleStruct->atkCancelerTracker++;
}
if (effect == MOVE_STEP_REMOVES_STATUS)
@ -3061,7 +3060,7 @@ bool32 CanAbilityBlockMove(u32 battlerAtk, u32 battlerDef, u32 abilityAtk, u32 a
&& !(IsBattleMoveStatus(move) && (abilityDef == ABILITY_MAGIC_BOUNCE || gProtectStructs[battlerDef].bounceMove)))
{
if (option == RUN_SCRIPT && !IsSpreadMove(GetBattlerMoveTargetType(battlerAtk, move)))
CancelMultiTurnMoves(battlerAtk, SKY_DROP_ATTACKCANCELLER_CHECK); // Don't cancel moves that can hit two targets bc one target might not be protected
CancelMultiTurnMoves(battlerAtk, SKY_DROP_ATTACKCANCELER_CHECK); // Don't cancel moves that can hit two targets bc one target might not be protected
battleScriptBlocksMove = BattleScript_DoesntAffectTargetAtkString;
}