From b5293cc3e2b7c38364b9bc7b39ed7e4bc6cb2bec Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Sat, 16 Oct 2021 17:04:36 +1300 Subject: [PATCH 1/3] Fix multi target moves Only run CANCELLER_PRANKSTER when moving to the next target of a multi target move. If more cancellers are needed they can be added/moved after CANCELLER_PRANKSTER. --- include/battle_util.h | 27 +++++++++++++++++++++++++++ src/battle_script_commands.c | 2 +- src/battle_util.c | 27 --------------------------- 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/battle_util.h b/include/battle_util.h index 7d1b99f34..3f4f4bbc7 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -34,6 +34,33 @@ #define ITEMEFFECT_LIFEORB_SHELLBELL 0x7 #define ITEMEFFECT_BATTLER_MOVE_END 0x8 // move end effects for just the battler, not whole field +// Move cancellers. Note that anything from CANCELLER_PRANKSTER onwards is +// called on each target of a multi target move, so any new cancellers should +// probably be added before CANCELLER_PRANKSTER. +#define CANCELLER_FLAGS 0 +#define CANCELLER_ASLEEP 1 +#define CANCELLER_FROZEN 2 +#define CANCELLER_TRUANT 3 +#define CANCELLER_RECHARGE 4 +#define CANCELLER_FLINCH 5 +#define CANCELLER_DISABLED 6 +#define CANCELLER_GRAVITY 7 +#define CANCELLER_HEAL_BLOCKED 8 +#define CANCELLER_TAUNTED 9 +#define CANCELLER_IMPRISONED 10 +#define CANCELLER_CONFUSED 11 +#define CANCELLER_PARALYSED 12 +#define CANCELLER_IN_LOVE 13 +#define CANCELLER_BIDE 14 +#define CANCELLER_THAW 15 +#define CANCELLER_POWDER_MOVE 16 +#define CANCELLER_POWDER_STATUS 17 +#define CANCELLER_THROAT_CHOP 18 +#define CANCELLER_PRANKSTER 19 +#define CANCELLER_END 20 +#define CANCELLER_PSYCHIC_TERRAIN 21 +#define CANCELLER_END2 22 + #define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK))) #define IS_WHOLE_SIDE_ALIVE(battler)((IsBattlerAlive(battler) && IsBattlerAlive(BATTLE_PARTNER(battler)))) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 29614e09b..ea169f52d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5157,7 +5157,7 @@ static void Cmd_moveend(void) MoveValuesCleanUp(); gBattleScripting.moveEffect = gBattleScripting.savedMoveEffect; BattleScriptPush(gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]); - gBattleStruct->atkCancellerTracker = 0; // Run all cancellers on next target + gBattleStruct->atkCancellerTracker = CANCELLER_PRANKSTER; // Run Prankster canceller on next target, skip the earlier ones gBattlescriptCurrInstr = BattleScript_FlushMessageBox; return; } diff --git a/src/battle_util.c b/src/battle_util.c index 18a1bfb47..1177c316e 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3102,33 +3102,6 @@ void TryClearRageAndFuryCutter(void) } } -enum -{ - CANCELLER_FLAGS, - CANCELLER_ASLEEP, - CANCELLER_FROZEN, - CANCELLER_TRUANT, - CANCELLER_RECHARGE, - CANCELLER_FLINCH, - CANCELLER_DISABLED, - CANCELLER_GRAVITY, - CANCELLER_HEAL_BLOCKED, - CANCELLER_TAUNTED, - CANCELLER_IMPRISONED, - CANCELLER_CONFUSED, - CANCELLER_PARALYSED, - CANCELLER_IN_LOVE, - CANCELLER_BIDE, - CANCELLER_THAW, - CANCELLER_POWDER_MOVE, - CANCELLER_POWDER_STATUS, - CANCELLER_THROAT_CHOP, - CANCELLER_PRANKSTER, - CANCELLER_END, - CANCELLER_PSYCHIC_TERRAIN, - CANCELLER_END2, -}; - u8 AtkCanceller_UnableToUseMove(void) { u8 effect = 0; From 791f4164a22f24d4fffa04e59424c0a6714ef0bf Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Sat, 16 Oct 2021 17:31:27 +1300 Subject: [PATCH 2/3] Fix PP being checked when HITMARKER_NO_PPDEDUCT is set This fixes multi target moves and seems like it should be done anyway, --- src/battle_script_commands.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ea169f52d..8bd082529 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1392,7 +1392,8 @@ static void Cmd_attackcanceler(void) return; if (AbilityBattleEffects(ABILITYEFFECT_MOVES_BLOCK, gBattlerTarget, 0, 0, 0)) return; - if (!gBattleMons[gBattlerAttacker].pp[gCurrMovePos] && gCurrentMove != MOVE_STRUGGLE && !(gHitMarker & (HITMARKER_x800000 | HITMARKER_NO_ATTACKSTRING)) + if (!gBattleMons[gBattlerAttacker].pp[gCurrMovePos] && gCurrentMove != MOVE_STRUGGLE + && !(gHitMarker & (HITMARKER_x800000 | HITMARKER_NO_ATTACKSTRING | HITMARKER_NO_PPDEDUCT)) && !(gBattleMons[gBattlerAttacker].status2 & STATUS2_MULTIPLETURNS)) { gBattlescriptCurrInstr = BattleScript_NoPPForMove; From 910fdfa94a97eefb49fd2aefa2a39dcf553e7e00 Mon Sep 17 00:00:00 2001 From: BuffelSaft Date: Tue, 19 Oct 2021 16:25:01 +1300 Subject: [PATCH 3/3] Revert "Fix multi target moves" This reverts commit b5293cc3e2b7c38364b9bc7b39ed7e4bc6cb2bec. --- include/battle_util.h | 27 --------------------------- src/battle_script_commands.c | 2 +- src/battle_util.c | 27 +++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 28 deletions(-) diff --git a/include/battle_util.h b/include/battle_util.h index 3f4f4bbc7..7d1b99f34 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -34,33 +34,6 @@ #define ITEMEFFECT_LIFEORB_SHELLBELL 0x7 #define ITEMEFFECT_BATTLER_MOVE_END 0x8 // move end effects for just the battler, not whole field -// Move cancellers. Note that anything from CANCELLER_PRANKSTER onwards is -// called on each target of a multi target move, so any new cancellers should -// probably be added before CANCELLER_PRANKSTER. -#define CANCELLER_FLAGS 0 -#define CANCELLER_ASLEEP 1 -#define CANCELLER_FROZEN 2 -#define CANCELLER_TRUANT 3 -#define CANCELLER_RECHARGE 4 -#define CANCELLER_FLINCH 5 -#define CANCELLER_DISABLED 6 -#define CANCELLER_GRAVITY 7 -#define CANCELLER_HEAL_BLOCKED 8 -#define CANCELLER_TAUNTED 9 -#define CANCELLER_IMPRISONED 10 -#define CANCELLER_CONFUSED 11 -#define CANCELLER_PARALYSED 12 -#define CANCELLER_IN_LOVE 13 -#define CANCELLER_BIDE 14 -#define CANCELLER_THAW 15 -#define CANCELLER_POWDER_MOVE 16 -#define CANCELLER_POWDER_STATUS 17 -#define CANCELLER_THROAT_CHOP 18 -#define CANCELLER_PRANKSTER 19 -#define CANCELLER_END 20 -#define CANCELLER_PSYCHIC_TERRAIN 21 -#define CANCELLER_END2 22 - #define WEATHER_HAS_EFFECT ((!IsAbilityOnField(ABILITY_CLOUD_NINE) && !IsAbilityOnField(ABILITY_AIR_LOCK))) #define IS_WHOLE_SIDE_ALIVE(battler)((IsBattlerAlive(battler) && IsBattlerAlive(BATTLE_PARTNER(battler)))) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 8bd082529..32a87b53e 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5158,7 +5158,7 @@ static void Cmd_moveend(void) MoveValuesCleanUp(); gBattleScripting.moveEffect = gBattleScripting.savedMoveEffect; BattleScriptPush(gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]); - gBattleStruct->atkCancellerTracker = CANCELLER_PRANKSTER; // Run Prankster canceller on next target, skip the earlier ones + gBattleStruct->atkCancellerTracker = 0; // Run all cancellers on next target gBattlescriptCurrInstr = BattleScript_FlushMessageBox; return; } diff --git a/src/battle_util.c b/src/battle_util.c index 1177c316e..18a1bfb47 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3102,6 +3102,33 @@ void TryClearRageAndFuryCutter(void) } } +enum +{ + CANCELLER_FLAGS, + CANCELLER_ASLEEP, + CANCELLER_FROZEN, + CANCELLER_TRUANT, + CANCELLER_RECHARGE, + CANCELLER_FLINCH, + CANCELLER_DISABLED, + CANCELLER_GRAVITY, + CANCELLER_HEAL_BLOCKED, + CANCELLER_TAUNTED, + CANCELLER_IMPRISONED, + CANCELLER_CONFUSED, + CANCELLER_PARALYSED, + CANCELLER_IN_LOVE, + CANCELLER_BIDE, + CANCELLER_THAW, + CANCELLER_POWDER_MOVE, + CANCELLER_POWDER_STATUS, + CANCELLER_THROAT_CHOP, + CANCELLER_PRANKSTER, + CANCELLER_END, + CANCELLER_PSYCHIC_TERRAIN, + CANCELLER_END2, +}; + u8 AtkCanceller_UnableToUseMove(void) { u8 effect = 0;