redo prankster checks to handle assist

This commit is contained in:
ghoulslash 2021-09-22 08:06:42 -04:00
parent 80a48de702
commit fc84ebbd3e
3 changed files with 14 additions and 6 deletions

View File

@ -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;

View File

@ -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)

View File

@ -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: