mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-18 01:14:19 +01:00
Made a function to lift Mimicry's effect
This commit is contained in:
parent
4f251e6ec2
commit
b64d506809
@ -158,6 +158,7 @@ bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 chec
|
||||
u16 GetUsedHeldItem(u8 battler);
|
||||
bool32 IsBattlerWeatherAffected(u8 battlerId, u32 weatherFlags);
|
||||
void TryToApplyMimicry(u8 battlerId, bool8 various);
|
||||
void TryToRevertMimicry(void);
|
||||
void RestoreBattlerOriginalTypes(u8 battlerId);
|
||||
|
||||
// ability checks
|
||||
|
@ -8865,11 +8865,7 @@ static void Cmd_various(void)
|
||||
break;
|
||||
}
|
||||
gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain
|
||||
for (i = 0; i < gBattlersCount; i++) // restore the types of Pokémon with Mimicry
|
||||
{
|
||||
if (GetBattlerAbility(i) == ABILITY_MIMICRY)
|
||||
RestoreBattlerOriginalTypes(i);
|
||||
}
|
||||
TryToRevertMimicry(); // restore the types of Pokémon with Mimicry
|
||||
break;
|
||||
case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED:
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler, TRUE))
|
||||
|
@ -1934,6 +1934,17 @@ void TryToApplyMimicry(u8 battlerId, bool8 various)
|
||||
}
|
||||
}
|
||||
|
||||
void TryToRevertMimicry(void)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (GetBattlerAbility(i) == ABILITY_MIMICRY)
|
||||
RestoreBattlerOriginalTypes(i);
|
||||
}
|
||||
}
|
||||
|
||||
enum
|
||||
{
|
||||
ENDTURN_ORDER,
|
||||
@ -2318,11 +2329,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.electricTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_TERRAIN_PERMANENT);
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (GetBattlerAbility(i) == ABILITY_MIMICRY)
|
||||
RestoreBattlerOriginalTypes(i);
|
||||
}
|
||||
TryToRevertMimicry();
|
||||
BattleScriptExecute(BattleScript_ElectricTerrainEnds);
|
||||
effect++;
|
||||
}
|
||||
@ -2333,11 +2340,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.mistyTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN);
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (GetBattlerAbility(i) == ABILITY_MIMICRY)
|
||||
RestoreBattlerOriginalTypes(i);
|
||||
}
|
||||
TryToRevertMimicry();
|
||||
BattleScriptExecute(BattleScript_MistyTerrainEnds);
|
||||
effect++;
|
||||
}
|
||||
@ -2350,11 +2353,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
&& (gFieldTimers.grassyTerrainTimer == 0 || --gFieldTimers.grassyTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_GRASSY_TERRAIN);
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (GetBattlerAbility(i) == ABILITY_MIMICRY)
|
||||
RestoreBattlerOriginalTypes(i);
|
||||
}
|
||||
TryToRevertMimicry();
|
||||
}
|
||||
BattleScriptExecute(BattleScript_GrassyTerrainHeals);
|
||||
effect++;
|
||||
@ -2366,11 +2365,7 @@ u8 DoFieldEndTurnEffects(void)
|
||||
&& (!(gFieldStatuses & STATUS_FIELD_TERRAIN_PERMANENT) && --gFieldTimers.psychicTerrainTimer == 0))
|
||||
{
|
||||
gFieldStatuses &= ~(STATUS_FIELD_PSYCHIC_TERRAIN);
|
||||
for (i = 0; i < MAX_BATTLERS_COUNT; i++)
|
||||
{
|
||||
if (GetBattlerAbility(i) == ABILITY_MIMICRY)
|
||||
RestoreBattlerOriginalTypes(i);
|
||||
}
|
||||
TryToRevertMimicry();
|
||||
BattleScriptExecute(BattleScript_PsychicTerrainEnds);
|
||||
effect++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user