From a49b5d1ad0aaebeceb5a7411ce725e99153a6054 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 16 Jan 2021 16:14:36 -0700 Subject: [PATCH 01/21] prankster updated to gen 7 --- data/battle_scripts_1.s | 9 +++++++++ include/battle_scripts.h | 1 + include/constants/battle_config.h | 1 + src/battle_script_commands.c | 1 + src/battle_util.c | 18 ++++++++++++++++++ 5 files changed, 30 insertions(+) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index bff609d598..ee5467a365 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7792,3 +7792,12 @@ BattleScript_AnnounceAirLockCloudNine:: waitmessage 0x40 call BattleScript_WeatherFormChanges end3 + +BattleScript_DarkTypePreventsPrankster:: + attackstring + ppreduce + pause 0x20 + printstring STRINGID_ITDOESNTAFFECT + waitmessage 0x40 + orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT + goto BattleScript_MoveEnd diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 009590f3a3..2434671952 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -357,5 +357,6 @@ extern const u8 BattleScript_CottonDownActivates[]; extern const u8 BattleScript_BallFetch[]; extern const u8 BattleScript_SandSpitActivates[]; extern const u8 BattleScript_PerishBodyActivates[]; +extern const u8 BattleScript_DarkTypePreventsPrankster[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index f7b38000c2..f5129a4792 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -122,6 +122,7 @@ #define B_FLASH_FIRE_FROZEN GEN_6 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. #define B_SYNCHRONIZE_NATURE GEN_6 // In Gen8+, if the Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. #define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. +#define B_PRANKSTER GEN_7 // In Gen7, Prankster-elevated status moves do not affect Dark type Pokemon // Item settings #define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn. diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 6c5f37a7d4..b52f65e3e6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -4994,6 +4994,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 gBattlescriptCurrInstr = BattleScript_FlushMessageBox; return; } diff --git a/src/battle_util.c b/src/battle_util.c index 210f00b270..83b53ff8a5 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2849,6 +2849,7 @@ enum CANCELLER_POWDER_MOVE, CANCELLER_POWDER_STATUS, CANCELLER_THROAT_CHOP, + CANCELLER_PRANKSTER, CANCELLER_END, CANCELLER_PSYCHIC_TERRAIN, CANCELLER_END2, @@ -3185,6 +3186,23 @@ u8 AtkCanceller_UnableToUseMove(void) } gBattleStruct->atkCancellerTracker++; break; + case CANCELLER_PRANKSTER: + #if B_PRANKSTER >= GEN_7 + if (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER + && IS_MOVE_STATUS(gCurrentMove) + && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_OPPONENTS_FIELD) + && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) + && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE)) + { + if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) + CancelMultiTurnMoves(gBattlerAttacker); // don't cancel moves that can hit two targets bc one target might not be protected + gBattleScripting.battler = gBattlerAbility = gBattlerTarget; + gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster; + effect = 1; + } + #endif + gBattleStruct->atkCancellerTracker++; + break; case CANCELLER_END: break; } From 60f3ad77fe79e0b2bb62dc6215609b4ae9e91ab8 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 23 Jan 2021 12:40:17 -0700 Subject: [PATCH 02/21] fix prankster blocking self-targeting moves --- src/battle_util.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/battle_util.c b/src/battle_util.c index 83b53ff8a5..18a5c128c3 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3190,6 +3190,7 @@ u8 AtkCanceller_UnableToUseMove(void) #if B_PRANKSTER >= GEN_7 if (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_MOVE_STATUS(gCurrentMove) + && gBattlerAttacker != gBattlerTarget && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_OPPONENTS_FIELD) && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE)) From d5004638a933ed9394be4b2409ef8b7aa8c701e6 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Tue, 9 Mar 2021 16:35:47 -0700 Subject: [PATCH 03/21] Update include/constants/battle_config.h Co-authored-by: Eduardo Quezada D'Ottone --- include/constants/battle_config.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index f5129a4792..125088d78f 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -122,7 +122,7 @@ #define B_FLASH_FIRE_FROZEN GEN_6 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. #define B_SYNCHRONIZE_NATURE GEN_6 // In Gen8+, if the Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. #define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. -#define B_PRANKSTER GEN_7 // In Gen7, Prankster-elevated status moves do not affect Dark type Pokemon +#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7, Prankster-elevated status moves do not affect Dark type Pokémon. // Item settings #define B_HP_BERRIES GEN_6 // In Gen4+, berries which restore hp activate immediately after hp drops to half. In gen3, the effect occurs at the end of the turn. From 208b964a5682789b3bb9df04faf12ba47ebc7319 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Tue, 9 Mar 2021 16:35:56 -0700 Subject: [PATCH 04/21] Update src/battle_util.c Co-authored-by: Eduardo Quezada D'Ottone --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 18a5c128c3..e5d13283b4 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3187,7 +3187,7 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case CANCELLER_PRANKSTER: - #if B_PRANKSTER >= GEN_7 + #if B_PRANKSTER_DARK_TYPES >= GEN_7 if (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_MOVE_STATUS(gCurrentMove) && gBattlerAttacker != gBattlerTarget From aeafd9e2227db86dc5fd63aca0976a5cbf8c4677 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 16 Sep 2021 11:34:01 -0400 Subject: [PATCH 05/21] perish song + prankster interaction --- data/battle_scripts_1.s | 19 ++++++++++++++----- src/battle_script_commands.c | 3 ++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 4c41db86ef..a1076e921c 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3647,19 +3647,28 @@ BattleScript_EffectPerishSong:: waitanimation printstring STRINGID_FAINTINTHREE waitmessage B_WAIT_TIME_LONG - setbyte sBATTLER, 0 + setbyte gBattlerTarget, 0 BattleScript_PerishSongLoop:: - jumpifability BS_SCRIPTING, ABILITY_SOUNDPROOF, BattleScript_PerishSongNotAffected + jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked + jumpifability BS_ATTACKER, ABILITY_PRANKSTER, BattleScript_PerishSongCheckPrankster + goto BattleScript_PerishSongLoopIncrement +BattleScript_PerishSongCheckPrankster: + jumpiftype BS_TARGET, TYPE_DARK, BattleScript_PerishSongNotAffected BattleScript_PerishSongLoopIncrement:: - addbyte sBATTLER, 1 - jumpifbytenotequal sBATTLER, gBattlersCount, BattleScript_PerishSongLoop + addbyte gBattlerTarget, 1 + jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_PerishSongLoop goto BattleScript_MoveEnd -BattleScript_PerishSongNotAffected:: +BattleScript_PerishSongBlocked:: printstring STRINGID_PKMNSXBLOCKSY2 waitmessage B_WAIT_TIME_LONG goto BattleScript_PerishSongLoopIncrement +BattleScript_PerishSongNotAffected: + printstring STRINGID_ITDOESNTAFFECT + waitmessage B_WAIT_TIME_LONG + goto BattleScript_PerishSongLoopIncrement + BattleScript_EffectSandstorm:: attackcanceler attackstring diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 28e000a7bd..c1da44b2e2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10605,7 +10605,8 @@ static void Cmd_trysetperishsong(void) for (i = 0; i < gBattlersCount; i++) { if (gStatuses3[i] & STATUS3_PERISH_SONG - || gBattleMons[i].ability == ABILITY_SOUNDPROOF) + || gBattleMons[i].ability == ABILITY_SOUNDPROOF + || (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(i, TYPE_DARK))) { notAffectedCount++; } From 2067f563cd66de8342c3c71c4bbca86e7b0bae45 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 16 Sep 2021 11:47:05 -0400 Subject: [PATCH 06/21] cannot block your own prankster elevated perish song --- data/battle_scripts_1.s | 1 + src/battle_script_commands.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a1076e921c..cb450c385e 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3650,6 +3650,7 @@ BattleScript_EffectPerishSong:: setbyte gBattlerTarget, 0 BattleScript_PerishSongLoop:: jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked + jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ cannot block your own perish song jumpifability BS_ATTACKER, ABILITY_PRANKSTER, BattleScript_PerishSongCheckPrankster goto BattleScript_PerishSongLoopIncrement BattleScript_PerishSongCheckPrankster: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c1da44b2e2..5abc8a9d59 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10606,7 +10606,7 @@ static void Cmd_trysetperishsong(void) { if (gStatuses3[i] & STATUS3_PERISH_SONG || gBattleMons[i].ability == ABILITY_SOUNDPROOF - || (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(i, TYPE_DARK))) + || (i != gBattlerAttacker && GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(i, TYPE_DARK))) { notAffectedCount++; } From a50f03a06b20cd5858e7729aaccc96e8e6e54a63 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 16 Sep 2021 11:53:24 -0400 Subject: [PATCH 07/21] magic bounce overrides prankster blockage --- src/battle_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 6e15aead1d..9f8521e62c 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3408,7 +3408,8 @@ u8 AtkCanceller_UnableToUseMove(void) && gBattlerAttacker != gBattlerTarget && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_OPPONENTS_FIELD) && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) - && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE)) + && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE) + && GetBattlerAbility(gBattlerTarget) != ABILITY_MAGIC_BOUNCE) // Magic bounce will bounce back prankster'd status move instead of blocking it { if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) CancelMultiTurnMoves(gBattlerAttacker); // don't cancel moves that can hit two targets bc one target might not be protected From ac42b19de7fb4f581c81840ea1fd8937944b9557 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 16 Sep 2021 11:54:27 -0400 Subject: [PATCH 08/21] some formatting fixes --- include/constants/battle_config.h | 2 +- src/battle_util.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/constants/battle_config.h b/include/constants/battle_config.h index 67d3cc5e74..893ed06d1e 100644 --- a/include/constants/battle_config.h +++ b/include/constants/battle_config.h @@ -125,7 +125,7 @@ #define B_FLASH_FIRE_FROZEN GEN_7 // In Gen5+, Flash Fire can trigger even when frozen, when it couldn't before. #define B_SYNCHRONIZE_NATURE GEN_8 // In Gen8, if the Pokémon with Synchronize is leading the party, it's 100% guaranteed that wild Pokémon will have the same ability, as opposed to 50% previously. #define B_UPDATED_INTIMIDATE GEN_8 // In Gen8, Intimidate doesn't work on opponents with the Inner Focus, Scrappy, Own Tempo or Oblivious abilities. -#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7, Prankster-elevated status moves do not affect Dark type Pokémon. +#define B_PRANKSTER_DARK_TYPES GEN_7 // In Gen7+, Prankster-elevated status moves do not affect Dark type Pokémon. // Item settings #define B_HP_BERRIES GEN_7 // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. diff --git a/src/battle_util.c b/src/battle_util.c index 9f8521e62c..edf242619d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3418,8 +3418,8 @@ u8 AtkCanceller_UnableToUseMove(void) effect = 1; } #endif - gBattleStruct->atkCancellerTracker++; - break; + gBattleStruct->atkCancellerTracker++; + break; case CANCELLER_END: break; } From b6862a41532331a12384fbf56de4921a73334f6f Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 16 Sep 2021 14:01:19 -0400 Subject: [PATCH 09/21] fix jumptocalledmove for assist + attackcanceler --- src/battle_script_commands.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5abc8a9d59..18fd4091b2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6505,6 +6505,7 @@ static void Cmd_jumptocalledmove(void) else gChosenMove = gCurrentMove = gCalledMove; + gBattleStruct->atkCancellerTracker = 0; gBattlescriptCurrInstr = gBattleScriptsForMoveEffects[gBattleMoves[gCurrentMove].effect]; } From 32d19a9b19456463fcac5046be0a80ba0dcc35c0 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Mon, 20 Sep 2021 21:36:10 -0400 Subject: [PATCH 10/21] syntax fixes. add B_PRANKSTER_DARK_TYPES check to perish song --- data/battle_scripts_1.s | 4 ++-- src/battle_script_commands.c | 8 ++++++-- src/battle_util.c | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 075e9d45ba..a7a8c1aa23 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8153,8 +8153,8 @@ BattleScript_EjectPackActivates:: BattleScript_DarkTypePreventsPrankster:: attackstring ppreduce - pause 0x20 + pause B_WAIT_TIME_SHORT printstring STRINGID_ITDOESNTAFFECT - waitmessage 0x40 + waitmessage B_WAIT_TIME_LONG orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT goto BattleScript_MoveEnd diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index e63653b453..4413eeec6d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5046,7 +5046,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 = 0; // Run all cancellers on next target gBattlescriptCurrInstr = BattleScript_FlushMessageBox; return; } @@ -10730,7 +10730,11 @@ static void Cmd_trysetperishsong(void) { if (gStatuses3[i] & STATUS3_PERISH_SONG || gBattleMons[i].ability == ABILITY_SOUNDPROOF - || (i != gBattlerAttacker && GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(i, TYPE_DARK))) + || (B_PRANKSTER_DARK_TYPES >= GEN_7 + && i != gBattlerAttacker + && GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER + && IS_BATTLER_OF_TYPE(i, TYPE_DARK)) + ) { notAffectedCount++; } diff --git a/src/battle_util.c b/src/battle_util.c index 21efe63a63..00edf07878 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3424,7 +3424,7 @@ u8 AtkCanceller_UnableToUseMove(void) && GetBattlerAbility(gBattlerTarget) != ABILITY_MAGIC_BOUNCE) // Magic bounce will bounce back prankster'd status move instead of blocking it { if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) - CancelMultiTurnMoves(gBattlerAttacker); // don't cancel moves that can hit two targets bc one target might not be protected + CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected gBattleScripting.battler = gBattlerAbility = gBattlerTarget; gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster; effect = 1; From 9c79ba05fc1d1c5fdc312425ed1bf5acdcbfe7b8 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Tue, 21 Sep 2021 11:38:37 -0400 Subject: [PATCH 11/21] allies do not block prankster --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 00edf07878..a7af8232b0 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3417,7 +3417,7 @@ u8 AtkCanceller_UnableToUseMove(void) #if B_PRANKSTER_DARK_TYPES >= GEN_7 if (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_MOVE_STATUS(gCurrentMove) - && gBattlerAttacker != gBattlerTarget + && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget) && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_OPPONENTS_FIELD) && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE) From 80a48de70256b9639761d5c295d17fc8bc023f9a Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Tue, 21 Sep 2021 11:54:59 -0400 Subject: [PATCH 12/21] ally cannot block prankster + perish song --- data/battle_scripts_1.s | 3 ++- src/battle_script_commands.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index a7a8c1aa23..c843fb96b6 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3700,7 +3700,8 @@ BattleScript_EffectPerishSong:: setbyte gBattlerTarget, 0 BattleScript_PerishSongLoop:: jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked - jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ cannot block your own perish song + jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ Cannot block your own perish song + jumpiftargetally BattleScript_PerishSongLoopIncrement @ Cannot block ally perish song jumpifability BS_ATTACKER, ABILITY_PRANKSTER, BattleScript_PerishSongCheckPrankster goto BattleScript_PerishSongLoopIncrement BattleScript_PerishSongCheckPrankster: diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 4413eeec6d..5dce3cda2d 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10731,7 +10731,7 @@ static void Cmd_trysetperishsong(void) if (gStatuses3[i] & STATUS3_PERISH_SONG || gBattleMons[i].ability == ABILITY_SOUNDPROOF || (B_PRANKSTER_DARK_TYPES >= GEN_7 - && i != gBattlerAttacker + && GetBattlerSide(i) != GetBattlerSide(gBattlerAttacker) && GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER && IS_BATTLER_OF_TYPE(i, TYPE_DARK)) ) From fc84ebbd3eb9333bc4df1b4eb2b98d0d518c6435 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 22 Sep 2021 08:06:42 -0400 Subject: [PATCH 13/21] redo prankster checks to handle assist --- include/battle.h | 1 + src/battle_main.c | 2 ++ src/battle_util.c | 17 +++++++++++------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/include/battle.h b/include/battle.h index 36646c9fef..103936540d 100644 --- a/include/battle.h +++ b/include/battle.h @@ -146,6 +146,7 @@ struct ProtectStruct u32 custap:1; // also quick claw u32 touchedProtectLike:1; u32 disableEjectPack:1; + u32 pranksterElevated:1; u32 physicalDmg; u32 specialDmg; u8 physicalBattlerId; diff --git a/src/battle_main.c b/src/battle_main.c index 74995bbf3a..aec69362bf 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4293,6 +4293,7 @@ s8 GetChosenMovePriority(u32 battlerId) { u16 move; + gProtectStructs[battlerId].pranksterElevated = 0; if (gProtectStructs[battlerId].noValidMoves) move = MOVE_STRUGGLE; else @@ -4314,6 +4315,7 @@ s8 GetMovePriority(u32 battlerId, u16 move) } else if (GetBattlerAbility(battlerId) == ABILITY_PRANKSTER && IS_MOVE_STATUS(move)) { + gProtectStructs[battlerId].pranksterElevated = 1; priority++; } else if (GetBattlerAbility(battlerId) == ABILITY_TRIAGE) diff --git a/src/battle_util.c b/src/battle_util.c index a7af8232b0..f438df057c 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3415,13 +3415,14 @@ u8 AtkCanceller_UnableToUseMove(void) break; case CANCELLER_PRANKSTER: #if B_PRANKSTER_DARK_TYPES >= GEN_7 - if (GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER - && IS_MOVE_STATUS(gCurrentMove) + if (gProtectStructs[gBattlerAttacker].pranksterElevated && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget) - && !(gBattleMoves[gCurrentMove].target & MOVE_TARGET_OPPONENTS_FIELD) - && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) + && !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves + && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) // Only Dark types can block Prankster'e && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE) - && GetBattlerAbility(gBattlerTarget) != ABILITY_MAGIC_BOUNCE) // Magic bounce will bounce back prankster'd status move instead of blocking it + && !(IS_MOVE_STATUS(gCurrentMove) // Magic bounce/coat will bounce back prankster'd status move instead of blocking it + && (GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE || TestMoveFlags(gCurrentMove, FLAG_MAGIC_COAT_AFFECTED))) + ) { if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected @@ -6853,7 +6854,11 @@ u8 GetMoveTarget(u16 move, u8 setTarget) moveTarget = setTarget - 1; else moveTarget = gBattleMoves[move].target; - + + // Special cases + if (move == MOVE_CURSE && !IS_BATTLER_OF_TYPE(gBattlerAttacker, TYPE_GHOST)) + moveTarget = MOVE_TARGET_USER; + switch (moveTarget) { case MOVE_TARGET_SELECTED: From 3559a1b8e6364f638995311451230a0648a85e80 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 22 Sep 2021 16:09:23 -0400 Subject: [PATCH 14/21] fix prankster + magic coat --- data/battle_scripts_1.s | 11 +++++++++++ include/battle_scripts.h | 1 + include/battle_util.h | 1 + src/battle_script_commands.c | 13 +++++++++++-- src/battle_util.c | 22 ++++++++++++++-------- 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index c843fb96b6..f949278fb4 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -6169,6 +6169,17 @@ BattleScript_MagicCoatBounce:: setmagiccoattarget BS_ATTACKER return +BattleScript_MagicCoatBouncePrankster:: + attackstring + ppreduce + pause B_WAIT_TIME_SHORT + printfromtable gMagicCoatBounceStringIds + waitmessage B_WAIT_TIME_LONG + printstring STRINGID_ITDOESNTAFFECT + waitmessage B_WAIT_TIME_LONG + orhalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT + goto BattleScript_MoveEnd + BattleScript_SnatchedMove:: attackstring ppreduce diff --git a/include/battle_scripts.h b/include/battle_scripts.h index c7b8cb0916..e215d984e5 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -97,6 +97,7 @@ extern const u8 BattleScript_SelectingImprisonedMove[]; extern const u8 BattleScript_SelectingImprisonedMoveInPalace[]; extern const u8 BattleScript_GrudgeTakesPp[]; extern const u8 BattleScript_MagicCoatBounce[]; +extern const u8 BattleScript_MagicCoatBouncePrankster[]; extern const u8 BattleScript_SnatchedMove[]; extern const u8 BattleScript_EnduredMsg[]; extern const u8 BattleScript_OneHitKOMsg[]; diff --git a/include/battle_util.h b/include/battle_util.h index 4dac63111a..9186a8b82d 100644 --- a/include/battle_util.h +++ b/include/battle_util.h @@ -151,6 +151,7 @@ void SortBattlersBySpeed(u8 *battlers, bool8 slowToFast); bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind); bool32 TryRoomService(u8 battlerId); void BufferStatChange(u8 battlerId, u8 statId, u8 stringId); +bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef); // ability checks bool32 IsRolePlayBannedAbilityAtk(u16 ability); diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 5dce3cda2d..2df5abcdad 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1405,8 +1405,17 @@ static void Cmd_attackcanceler(void) gProtectStructs[gBattlerTarget].bounceMove = 0; gProtectStructs[gBattlerTarget].usesBouncedMove = 1; gBattleCommunication[MULTISTRING_CHOOSER] = 0; - BattleScriptPushCursor(); - gBattlescriptCurrInstr = BattleScript_MagicCoatBounce; + if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker)) + { + // Opponent used a prankster'ed magic coat -> reflected status move should fail against a dark type attacker + gBattlerTarget = gBattlerAttacker; + gBattlescriptCurrInstr = BattleScript_MagicCoatBouncePrankster; + } + else + { + BattleScriptPushCursor(); + gBattlescriptCurrInstr = BattleScript_MagicCoatBounce; + } return; } else if (GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE diff --git a/src/battle_util.c b/src/battle_util.c index f438df057c..24ae917352 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3415,14 +3415,8 @@ u8 AtkCanceller_UnableToUseMove(void) break; case CANCELLER_PRANKSTER: #if B_PRANKSTER_DARK_TYPES >= GEN_7 - if (gProtectStructs[gBattlerAttacker].pranksterElevated - && GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget) - && !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves - && IS_BATTLER_OF_TYPE(gBattlerTarget, TYPE_DARK) // Only Dark types can block Prankster'e - && !(gStatuses3[gBattlerTarget] & STATUS3_SEMI_INVULNERABLE) - && !(IS_MOVE_STATUS(gCurrentMove) // Magic bounce/coat will bounce back prankster'd status move instead of blocking it - && (GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE || TestMoveFlags(gCurrentMove, FLAG_MAGIC_COAT_AFFECTED))) - ) + if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget) + && !(IS_MOVE_STATUS(gCurrentMove) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE)) { if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected @@ -9195,3 +9189,15 @@ bool32 TryRoomService(u8 battlerId) return FALSE; } } + +bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef) +{ + if (gProtectStructs[battlerPrankster].pranksterElevated + && GetBattlerSide(battlerPrankster) != GetBattlerSide(battlerDef) + && !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves + && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) // Only Dark types can block Prankster'ed + && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) + return TRUE; + else + return FALSE; +} From 936f2c7bcbe0fc67bcac40c0e7e805e1bb784f1d Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Wed, 22 Sep 2021 21:51:37 -0400 Subject: [PATCH 15/21] fix eject pack weak armor special case --- src/battle_main.c | 1 + src/battle_script_commands.c | 5 ++--- src/battle_util.c | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index e7139e0d14..4fa6568562 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -3094,6 +3094,7 @@ void FaintClearSetData(void) gProtectStructs[gActiveBattler].usedGravityPreventedMove = 0; gProtectStructs[gActiveBattler].usedThroatChopPreventedMove = 0; gProtectStructs[gActiveBattler].statRaised = 0; + gProtectStructs[gActiveBattler].statFell = 0; gDisableStructs[gActiveBattler].isFirstTurn = 2; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 42e723ecc3..a1e0d7e5f6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -5165,6 +5165,7 @@ static void Cmd_moveend(void) u8 battler = battlers[i]; if (IsBattlerAlive(battler) && gProtectStructs[battler].statFell + && gProtectStructs[battler].disableEjectPack == 0 && GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_EJECT_PACK && !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker)) // Does not activate if attacker used Parting Shot and can switch out && CountUsablePartyMons(battler) > 0) // Has mon to switch into @@ -9407,9 +9408,7 @@ static u32 ChangeStatBuffs(s8 statValue, u32 statId, u32 flags, const u8 *BS_ptr } else { - // Check eject pack. disableEjectPack set for edge cases (e.g. attacking weak armor'd eject pack holder with u-turn) - if (gProtectStructs[gActiveBattler].disableEjectPack == 0) - gProtectStructs[gActiveBattler].statFell = 1; + gProtectStructs[gActiveBattler].statFell = 1; // Eject pack, lash out gBattleCommunication[MULTISTRING_CHOOSER] = (gBattlerTarget == gActiveBattler); // B_MSG_ATTACKER_STAT_FELL or B_MSG_DEFENDER_STAT_FELL } } diff --git a/src/battle_util.c b/src/battle_util.c index 80b5f824cd..b9f29ae2d6 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -5997,6 +5997,7 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn) break; case HOLD_EFFECT_EJECT_PACK: if (gProtectStructs[battlerId].statFell + && gProtectStructs[battlerId].disableEjectPack == 0 && !(gCurrentMove == MOVE_PARTING_SHOT && CanBattlerSwitch(gBattlerAttacker))) // Does not activate if attacker used Parting Shot and can switch out { gProtectStructs[battlerId].statFell = FALSE; From d4a153bf14f76165dc36646625ccd918ce88d648 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Thu, 23 Sep 2021 12:21:16 -0600 Subject: [PATCH 16/21] Update data/battle_scripts_1.s Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- data/battle_scripts_1.s | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 2b290c673f..ece6e73dc5 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3701,7 +3701,7 @@ BattleScript_EffectPerishSong:: BattleScript_PerishSongLoop:: jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ Cannot block your own perish song - jumpiftargetally BattleScript_PerishSongLoopIncrement @ Cannot block ally perish song + jumpiftargetally BattleScript_PerishSongLoopIncrement @ Cannot block ally perish song jumpifability BS_ATTACKER, ABILITY_PRANKSTER, BattleScript_PerishSongCheckPrankster goto BattleScript_PerishSongLoopIncrement BattleScript_PerishSongCheckPrankster: From 2cea541b2afb47d7cfed84cf3c173fa994ee5670 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Thu, 23 Sep 2021 12:21:26 -0600 Subject: [PATCH 17/21] Update src/battle_script_commands.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- src/battle_script_commands.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index b5c690dc23..cb0dfd23e2 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -1407,7 +1407,7 @@ static void Cmd_attackcanceler(void) gBattleCommunication[MULTISTRING_CHOOSER] = 0; if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker)) { - // Opponent used a prankster'ed magic coat -> reflected status move should fail against a dark type attacker + // Opponent used a prankster'd magic coat -> reflected status move should fail against a dark-type attacker gBattlerTarget = gBattlerAttacker; gBattlescriptCurrInstr = BattleScript_MagicCoatBouncePrankster; } From 8a9d28d97f796498ca2ad49776c3663fa711c860 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Thu, 23 Sep 2021 12:21:36 -0600 Subject: [PATCH 18/21] Update src/battle_util.c Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- src/battle_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/battle_util.c b/src/battle_util.c index 574a11b4c4..0854cb6e03 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -9239,7 +9239,7 @@ bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef) if (gProtectStructs[battlerPrankster].pranksterElevated && GetBattlerSide(battlerPrankster) != GetBattlerSide(battlerDef) && !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves - && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) // Only Dark types can block Prankster'ed + && IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) // Only Dark-types can block Prankster'd && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) return TRUE; else From 94ec25319f2d51c6ab3f1211f9aba51f624c2359 Mon Sep 17 00:00:00 2001 From: ghoulslash Date: Thu, 23 Sep 2021 14:35:37 -0400 Subject: [PATCH 19/21] syntax fixes. Use BlocksPrankster for perish song battle script --- asm/macros/battle_script.inc | 5 +++++ data/battle_scripts_1.s | 7 +------ include/constants/battle_script_commands.h | 1 + src/battle_script_commands.c | 12 +++++++----- src/battle_util.c | 22 +++++++++++----------- 5 files changed, 25 insertions(+), 22 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 7ca6bfa6dc..6189c855d0 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1796,6 +1796,11 @@ .4byte \terrainFlags .4byte \ptr .endm + + .macro jumpifpranksterblocked battler:req, ptr:req + various \battler, VARIOUS_JUMP_IF_PRANKSTER_BLOCKED + .4byte \ptr + .endm @ helpful macros .macro setstatchanger stat:req, stages:req, down:req diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index ece6e73dc5..e5d4466c4d 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -3700,12 +3700,7 @@ BattleScript_EffectPerishSong:: setbyte gBattlerTarget, 0 BattleScript_PerishSongLoop:: jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked - jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ Cannot block your own perish song - jumpiftargetally BattleScript_PerishSongLoopIncrement @ Cannot block ally perish song - jumpifability BS_ATTACKER, ABILITY_PRANKSTER, BattleScript_PerishSongCheckPrankster - goto BattleScript_PerishSongLoopIncrement -BattleScript_PerishSongCheckPrankster: - jumpiftype BS_TARGET, TYPE_DARK, BattleScript_PerishSongNotAffected + jumpifpranksterblocked BS_TARGET, BattleScript_PerishSongNotAffected BattleScript_PerishSongLoopIncrement:: addbyte gBattlerTarget, 1 jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_PerishSongLoop diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 66f5925034..e564f54794 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -179,6 +179,7 @@ #define VARIOUS_MAKE_INVISIBLE 107 #define VARIOUS_ROOM_SERVICE 108 #define VARIOUS_JUMP_IF_TERRAIN_AFFECTED 109 +#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 110 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index cb0dfd23e2..4d12ae8fea 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -8604,6 +8604,12 @@ static void Cmd_various(void) gBattlescriptCurrInstr += 11; } return; + case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED: + if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler)) + gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3); + else + gBattlescriptCurrInstr += 7; + return; } gBattlescriptCurrInstr += 3; @@ -10757,11 +10763,7 @@ static void Cmd_trysetperishsong(void) { if (gStatuses3[i] & STATUS3_PERISH_SONG || gBattleMons[i].ability == ABILITY_SOUNDPROOF - || (B_PRANKSTER_DARK_TYPES >= GEN_7 - && GetBattlerSide(i) != GetBattlerSide(gBattlerAttacker) - && GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER - && IS_BATTLER_OF_TYPE(i, TYPE_DARK)) - ) + || BlocksPrankster(gCurrentMove, gBattlerAttacker, i)) { notAffectedCount++; } diff --git a/src/battle_util.c b/src/battle_util.c index 0854cb6e03..8655d47d87 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -3414,17 +3414,15 @@ u8 AtkCanceller_UnableToUseMove(void) gBattleStruct->atkCancellerTracker++; break; case CANCELLER_PRANKSTER: - #if B_PRANKSTER_DARK_TYPES >= GEN_7 - if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget) - && !(IS_MOVE_STATUS(gCurrentMove) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE)) - { - if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) - CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected - gBattleScripting.battler = gBattlerAbility = gBattlerTarget; - gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster; - effect = 1; - } - #endif + if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget) + && !(IS_MOVE_STATUS(gCurrentMove) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE)) + { + if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) + CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected + gBattleScripting.battler = gBattlerAbility = gBattlerTarget; + gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster; + effect = 1; + } gBattleStruct->atkCancellerTracker++; break; case CANCELLER_END: @@ -9236,6 +9234,7 @@ void DoBurmyFormChange(u32 monId) bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef) { + #if B_PRANKSTER_DARK_TYPES >= GEN_7 if (gProtectStructs[battlerPrankster].pranksterElevated && GetBattlerSide(battlerPrankster) != GetBattlerSide(battlerDef) && !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves @@ -9243,5 +9242,6 @@ bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef) && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)) return TRUE; else + #endif return FALSE; } From 767e25bfed68ff1939c1074d34f5f7d03da2592a Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Thu, 23 Sep 2021 13:19:12 -0600 Subject: [PATCH 20/21] Update asm/macros/battle_script.inc Co-authored-by: ultima-soul <33333039+ultima-soul@users.noreply.github.com> --- asm/macros/battle_script.inc | 1 - 1 file changed, 1 deletion(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index b2e8bf343e..d1a0fb63f1 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1796,7 +1796,6 @@ .4byte \terrainFlags .4byte \ptr .endm - .macro jumpifpranksterblocked battler:req, ptr:req various \battler, VARIOUS_JUMP_IF_PRANKSTER_BLOCKED .4byte \ptr From fe6a11e5ec9210be4a183cb10b7bac8424a3bc32 Mon Sep 17 00:00:00 2001 From: ultima-soul <33333039+ultima-soul@users.noreply.github.com> Date: Thu, 23 Sep 2021 12:26:36 -0700 Subject: [PATCH 21/21] Update asm/macros/battle_script.inc --- asm/macros/battle_script.inc | 1 + 1 file changed, 1 insertion(+) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index d1a0fb63f1..12cf20a9c0 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1796,6 +1796,7 @@ .4byte \terrainFlags .4byte \ptr .endm + .macro jumpifpranksterblocked battler:req, ptr:req various \battler, VARIOUS_JUMP_IF_PRANKSTER_BLOCKED .4byte \ptr