From a49b5d1ad0aaebeceb5a7411ce725e99153a6054 Mon Sep 17 00:00:00 2001 From: Evan Date: Sat, 16 Jan 2021 16:14:36 -0700 Subject: [PATCH] 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; }