mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-02-22 04:04:15 +01:00
IsBattlerProtected
This commit is contained in:
parent
89e9b989c9
commit
b3b3cd2c67
@ -7450,6 +7450,48 @@ bool32 IsMoveMakingContact(u16 move, u8 battlerAtk)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool32 IsBattlerProtected(u8 battlerId, u16 move)
|
||||||
|
{
|
||||||
|
// Decorate bypasses protect and detect, but not crafty shield
|
||||||
|
if (move == MOVE_DECORATE)
|
||||||
|
{
|
||||||
|
if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_CRAFTY_SHIELD)
|
||||||
|
return TRUE;
|
||||||
|
else if (gProtectStructs[battlerId].protected)
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(gBattleMoves[move].flags & FLAG_PROTECT_AFFECTED))
|
||||||
|
return FALSE;
|
||||||
|
else if (gBattleMoves[move].effect == MOVE_EFFECT_FEINT)
|
||||||
|
return FALSE;
|
||||||
|
else if (gProtectStructs[battlerId].protected)
|
||||||
|
return TRUE;
|
||||||
|
else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_WIDE_GUARD
|
||||||
|
&& gBattleMoves[move].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))
|
||||||
|
return TRUE;
|
||||||
|
else if (gProtectStructs[battlerId].banefulBunkered)
|
||||||
|
return TRUE;
|
||||||
|
else if (gProtectStructs[battlerId].obstructed && !IS_MOVE_STATUS(move))
|
||||||
|
return TRUE;
|
||||||
|
else if (gProtectStructs[battlerId].spikyShielded)
|
||||||
|
return TRUE;
|
||||||
|
else if (gProtectStructs[battlerId].kingsShielded && gBattleMoves[move].power != 0)
|
||||||
|
return TRUE;
|
||||||
|
else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_QUICK_GUARD
|
||||||
|
&& GetChosenMovePriority(gBattlerAttacker) > 0)
|
||||||
|
return TRUE;
|
||||||
|
else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_CRAFTY_SHIELD
|
||||||
|
&& IS_MOVE_STATUS(move))
|
||||||
|
return TRUE;
|
||||||
|
else if (gSideStatuses[GetBattlerSide(battlerId)] & SIDE_STATUS_MAT_BLOCK
|
||||||
|
&& !IS_MOVE_STATUS(move))
|
||||||
|
return TRUE;
|
||||||
|
else
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool32 IsBattlerGrounded(u8 battlerId)
|
bool32 IsBattlerGrounded(u8 battlerId)
|
||||||
{
|
{
|
||||||
if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_IRON_BALL)
|
if (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_IRON_BALL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user