mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 04:04:17 +01:00
update semi invulnerable state check
This commit is contained in:
parent
1405f04e1e
commit
4782f713f2
@ -115,6 +115,7 @@ bool32 IsStatLoweringEffect(u16 effect);
|
||||
bool32 IsStatRaisingEffect(u16 effect);
|
||||
bool32 IsAttackBoostMoveEffect(u16 effect);
|
||||
bool32 IsUngroundingEffect(u16 effect);
|
||||
bool32 IsSemiInvulnerable(u8 battlerDef, u16 move);
|
||||
|
||||
// status checks
|
||||
bool32 CanBeBurned(u8 battler, u16 ability);
|
||||
|
@ -547,7 +547,7 @@ static s16 AI_CheckBadMove(u8 battlerAtk, u8 battlerDef, u16 move, s16 score)
|
||||
}
|
||||
|
||||
// check off screen
|
||||
if (gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE && GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) != 1)
|
||||
if (IsSemiInvulnerable(battlerDef, move) && effect != EFFECT_SEMI_INVULNERABLE && GetWhoStrikesFirst(battlerAtk, battlerDef, TRUE) != 1)
|
||||
RETURN_SCORE_MINUS(20); // if target off screen and we go first, don't use move
|
||||
|
||||
// check if negates type
|
||||
|
@ -1339,16 +1339,23 @@ u32 AI_GetMoveAccuracy(u8 battlerAtk, u8 battlerDef, u16 atkAbility, u16 defAbil
|
||||
return calc;
|
||||
}
|
||||
|
||||
bool32 IsSemiInvulnerable(u8 battlerDef, u16 move)
|
||||
{
|
||||
if (gStatuses3[battlerDef] & STATUS3_PHANTOM_FORCE)
|
||||
return TRUE;
|
||||
else if (!TestMoveFlags(move, FLAG_HIT_IN_AIR) && gStatuses3[battlerDef] & STATUS3_ON_AIR)
|
||||
return TRUE;
|
||||
else if (!TestMoveFlags(move, FLAG_DMG_UNDERWATER) && gStatuses3[battlerDef] & STATUS3_UNDERWATER)
|
||||
return TRUE;
|
||||
else if (!TestMoveFlags(move, FLAG_DMG_UNDERGROUND) && gStatuses3[battlerDef] & STATUS3_UNDERGROUND)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool32 IsMoveEncouragedToHit(u8 battlerAtk, u8 battlerDef, u16 move)
|
||||
{
|
||||
// never hits
|
||||
if (gStatuses3[battlerDef] & (STATUS3_SEMI_INVULNERABLE))
|
||||
return FALSE;
|
||||
|
||||
if ((gStatuses3[battlerDef] & STATUS3_PHANTOM_FORCE)
|
||||
|| (!TestMoveFlags(move, FLAG_HIT_IN_AIR) && gStatuses3[battlerDef] & STATUS3_ON_AIR)
|
||||
|| (!TestMoveFlags(move, FLAG_DMG_UNDERGROUND) && gStatuses3[battlerDef] & STATUS3_UNDERGROUND)
|
||||
|| (!TestMoveFlags(move, FLAG_DMG_UNDERWATER) && gStatuses3[battlerDef] & STATUS3_UNDERWATER))
|
||||
if (IsSemiInvulnerable(battlerDef, move))
|
||||
return FALSE;
|
||||
|
||||
//TODO - anticipate protect move?
|
||||
|
Loading…
Reference in New Issue
Block a user