mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-28 12:44:18 +01:00
Shed Shell
This commit is contained in:
parent
7b4ccbc6bc
commit
36b52eb063
@ -84,6 +84,7 @@ u32 IsAbilityOnOpposingSide(u32 battlerId, u32 ability);
|
||||
u32 IsAbilityOnField(u32 ability);
|
||||
u32 IsAbilityOnFieldExcept(u32 battlerId, u32 ability);
|
||||
u32 IsAbilityPreventingEscape(u32 battlerId);
|
||||
bool32 CanBattlerEscape(u32 battlerId); // no ability check
|
||||
void BattleScriptExecute(const u8* BS_ptr);
|
||||
void BattleScriptPushCursorAndCallback(const u8* BS_ptr);
|
||||
u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn);
|
||||
|
@ -3690,9 +3690,7 @@ u8 IsRunningFromBattleImpossible(void)
|
||||
return 2;
|
||||
}
|
||||
|
||||
if ((gBattleMons[gActiveBattler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED))
|
||||
|| (gStatuses3[gActiveBattler] & STATUS3_ROOTED)
|
||||
|| gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)
|
||||
if (!CanBattlerEscape(gActiveBattler))
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
return 1;
|
||||
@ -3868,10 +3866,8 @@ static void HandleTurnActionSelectionState(void)
|
||||
break;
|
||||
case B_ACTION_SWITCH:
|
||||
*(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler];
|
||||
if (gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)
|
||||
|| gBattleTypeFlags & BATTLE_TYPE_ARENA
|
||||
|| gFieldStatuses & STATUS_FIELD_FAIRY_LOCK
|
||||
|| gStatuses3[gActiveBattler] & STATUS3_ROOTED)
|
||||
if (gBattleTypeFlags & BATTLE_TYPE_ARENA
|
||||
|| !CanBattlerEscape(gActiveBattler))
|
||||
{
|
||||
BtlController_EmitChoosePokemon(0, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->field_60[gActiveBattler]);
|
||||
}
|
||||
@ -5553,8 +5549,7 @@ static void HandleAction_Run(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gBattleMons[gBattlerAttacker].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)
|
||||
|| gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)
|
||||
if (!CanBattlerEscape(gBattlerAttacker))
|
||||
{
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
||||
gBattlescriptCurrInstr = BattleScript_PrintFailedToRunString;
|
||||
|
@ -5115,9 +5115,7 @@ static void Cmd_jumpifcantswitch(void)
|
||||
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(SWITCH_IGNORE_ESCAPE_PREVENTION));
|
||||
|
||||
if (!(gBattlescriptCurrInstr[1] & SWITCH_IGNORE_ESCAPE_PREVENTION)
|
||||
&& ((gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION))
|
||||
|| (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)
|
||||
|| (gStatuses3[gActiveBattler] & STATUS3_ROOTED)))
|
||||
&& !CanBattlerEscape(gActiveBattler))
|
||||
{
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
|
||||
}
|
||||
|
@ -4077,6 +4077,14 @@ u32 IsAbilityPreventingEscape(u32 battlerId)
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool32 CanBattlerEscape(u32 battlerId) // no ability check
|
||||
{
|
||||
return (GetBattlerHoldEffect(battlerId, TRUE) == HOLD_EFFECT_SHED_SHELL
|
||||
|| !((gBattleMons[battlerId].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED))
|
||||
|| (gStatuses3[battlerId] & STATUS3_ROOTED)
|
||||
|| gFieldStatuses & STATUS_FIELD_FAIRY_LOCK));
|
||||
}
|
||||
|
||||
void BattleScriptExecute(const u8 *BS_ptr)
|
||||
{
|
||||
gBattlescriptCurrInstr = BS_ptr;
|
||||
|
Loading…
Reference in New Issue
Block a user