diff --git a/include/battle.h b/include/battle.h index 36646c9fe..103936540 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 74995bbf3..aec69362b 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 a7af8232b..f438df057 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: