mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-29 05:40:41 +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 IsAbilityOnField(u32 ability);
|
||||||
u32 IsAbilityOnFieldExcept(u32 battlerId, u32 ability);
|
u32 IsAbilityOnFieldExcept(u32 battlerId, u32 ability);
|
||||||
u32 IsAbilityPreventingEscape(u32 battlerId);
|
u32 IsAbilityPreventingEscape(u32 battlerId);
|
||||||
|
bool32 CanBattlerEscape(u32 battlerId); // no ability check
|
||||||
void BattleScriptExecute(const u8* BS_ptr);
|
void BattleScriptExecute(const u8* BS_ptr);
|
||||||
void BattleScriptPushCursorAndCallback(const u8* BS_ptr);
|
void BattleScriptPushCursorAndCallback(const u8* BS_ptr);
|
||||||
u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn);
|
u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn);
|
||||||
|
@ -3690,9 +3690,7 @@ u8 IsRunningFromBattleImpossible(void)
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((gBattleMons[gActiveBattler].status2 & (STATUS2_ESCAPE_PREVENTION | STATUS2_WRAPPED))
|
if (!CanBattlerEscape(gActiveBattler))
|
||||||
|| (gStatuses3[gActiveBattler] & STATUS3_ROOTED)
|
|
||||||
|| gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)
|
|
||||||
{
|
{
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||||
return 1;
|
return 1;
|
||||||
@ -3868,10 +3866,8 @@ static void HandleTurnActionSelectionState(void)
|
|||||||
break;
|
break;
|
||||||
case B_ACTION_SWITCH:
|
case B_ACTION_SWITCH:
|
||||||
*(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler];
|
*(gBattleStruct->field_58 + gActiveBattler) = gBattlerPartyIndexes[gActiveBattler];
|
||||||
if (gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)
|
if (gBattleTypeFlags & BATTLE_TYPE_ARENA
|
||||||
|| gBattleTypeFlags & BATTLE_TYPE_ARENA
|
|| !CanBattlerEscape(gActiveBattler))
|
||||||
|| gFieldStatuses & STATUS_FIELD_FAIRY_LOCK
|
|
||||||
|| gStatuses3[gActiveBattler] & STATUS3_ROOTED)
|
|
||||||
{
|
{
|
||||||
BtlController_EmitChoosePokemon(0, PARTY_ACTION_CANT_SWITCH, PARTY_SIZE, ABILITY_NONE, gBattleStruct->field_60[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
|
else
|
||||||
{
|
{
|
||||||
if (gBattleMons[gBattlerAttacker].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION)
|
if (!CanBattlerEscape(gBattlerAttacker))
|
||||||
|| gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)
|
|
||||||
{
|
{
|
||||||
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
||||||
gBattlescriptCurrInstr = BattleScript_PrintFailedToRunString;
|
gBattlescriptCurrInstr = BattleScript_PrintFailedToRunString;
|
||||||
|
@ -5115,9 +5115,7 @@ static void Cmd_jumpifcantswitch(void)
|
|||||||
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(SWITCH_IGNORE_ESCAPE_PREVENTION));
|
gActiveBattler = GetBattlerForBattleScript(gBattlescriptCurrInstr[1] & ~(SWITCH_IGNORE_ESCAPE_PREVENTION));
|
||||||
|
|
||||||
if (!(gBattlescriptCurrInstr[1] & SWITCH_IGNORE_ESCAPE_PREVENTION)
|
if (!(gBattlescriptCurrInstr[1] & SWITCH_IGNORE_ESCAPE_PREVENTION)
|
||||||
&& ((gBattleMons[gActiveBattler].status2 & (STATUS2_WRAPPED | STATUS2_ESCAPE_PREVENTION))
|
&& !CanBattlerEscape(gActiveBattler))
|
||||||
|| (gFieldStatuses & STATUS_FIELD_FAIRY_LOCK)
|
|
||||||
|| (gStatuses3[gActiveBattler] & STATUS3_ROOTED)))
|
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
|
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 2);
|
||||||
}
|
}
|
||||||
|
@ -4077,6 +4077,14 @@ u32 IsAbilityPreventingEscape(u32 battlerId)
|
|||||||
return 0;
|
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)
|
void BattleScriptExecute(const u8 *BS_ptr)
|
||||||
{
|
{
|
||||||
gBattlescriptCurrInstr = BS_ptr;
|
gBattlescriptCurrInstr = BS_ptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user