Refactor the function IsAbilityPreventingEscape (#6439)
Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
This commit is contained in:
parent
21f1b3bf9d
commit
4c4d043c13
@ -230,7 +230,7 @@
|
||||
#define B_OVERWORLD_FOG GEN_LATEST // In Gen8+, overworld Fog summons Misty Terrain in battle. In Gen4 only, overworld Fog summons the unique fog weather condition in battle.
|
||||
#define B_OVERWORLD_SNOW GEN_LATEST // In Gen9+, overworld Snow will summon snow instead of hail in battle.
|
||||
#define B_SNOW_WARNING GEN_LATEST // In Gen9+, Snow Warning will summon snow instead of hail.
|
||||
#define B_PREFERRED_ICE_WEATHER B_ICE_WEATHER_BOTH // Toggles Hail move effects to Snow and vis versa.
|
||||
#define B_PREFERRED_ICE_WEATHER B_ICE_WEATHER_BOTH // Toggles Hail move effects to Snow and vice versa.
|
||||
|
||||
// Terrain settings
|
||||
#define B_TERRAIN_BG_CHANGE TRUE // If set to TRUE, terrain moves permanently change the default battle background until the effect fades.
|
||||
|
||||
@ -6755,16 +6755,25 @@ u32 IsAbilityOnFieldExcept(u32 battler, u32 ability)
|
||||
|
||||
u32 IsAbilityPreventingEscape(u32 battler)
|
||||
{
|
||||
u32 id;
|
||||
if (B_GHOSTS_ESCAPE >= GEN_6 && IS_BATTLER_OF_TYPE(battler, TYPE_GHOST))
|
||||
return 0;
|
||||
if ((id = IsAbilityOnOpposingSide(battler, ABILITY_SHADOW_TAG))
|
||||
&& (B_SHADOW_TAG_ESCAPE >= GEN_4 && GetBattlerAbility(battler) != ABILITY_SHADOW_TAG))
|
||||
return id;
|
||||
if ((id = IsAbilityOnOpposingSide(battler, ABILITY_ARENA_TRAP)) && IsBattlerGrounded(battler))
|
||||
return id;
|
||||
if ((id = IsAbilityOnOpposingSide(battler, ABILITY_MAGNET_PULL)) && IS_BATTLER_OF_TYPE(battler, TYPE_STEEL))
|
||||
return id;
|
||||
|
||||
for (u32 battlerDef = 0; battlerDef < gBattlersCount; battlerDef++)
|
||||
{
|
||||
if (battler == battlerDef || IsBattlerAlly(battler, battlerDef))
|
||||
continue;
|
||||
|
||||
u32 ability = GetBattlerAbility(battlerDef);
|
||||
|
||||
if (ability == ABILITY_SHADOW_TAG && (B_SHADOW_TAG_ESCAPE <= GEN_3 || GetBattlerAbility(battler) != ABILITY_SHADOW_TAG))
|
||||
return battlerDef + 1;
|
||||
|
||||
if (ability == ABILITY_ARENA_TRAP && IsBattlerGrounded(battler))
|
||||
return battlerDef + 1;
|
||||
|
||||
if (ability == ABILITY_MAGNET_PULL && IS_BATTLER_OF_TYPE(battler, TYPE_STEEL))
|
||||
return battlerDef + 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user