mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 19:47:35 +01:00
Cleanup HandleTerrainMove
This commit is contained in:
parent
23acbb370d
commit
682c59869b
@ -7921,35 +7921,34 @@ static bool32 HasAttackerFaintedTarget(void)
|
||||
static void HandleTerrainMove(u16 move)
|
||||
{
|
||||
u32 statusFlag = 0;
|
||||
u8 *timer = NULL;
|
||||
|
||||
switch (gBattleMoves[move].effect)
|
||||
{
|
||||
case EFFECT_MISTY_TERRAIN:
|
||||
statusFlag = STATUS_FIELD_MISTY_TERRAIN, timer = &gFieldTimers.terrainTimer;
|
||||
statusFlag = STATUS_FIELD_MISTY_TERRAIN;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
break;
|
||||
case EFFECT_GRASSY_TERRAIN:
|
||||
statusFlag = STATUS_FIELD_GRASSY_TERRAIN, timer = &gFieldTimers.terrainTimer;
|
||||
statusFlag = STATUS_FIELD_GRASSY_TERRAIN;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 1;
|
||||
break;
|
||||
case EFFECT_ELECTRIC_TERRAIN:
|
||||
statusFlag = STATUS_FIELD_ELECTRIC_TERRAIN, timer = &gFieldTimers.terrainTimer;
|
||||
statusFlag = STATUS_FIELD_ELECTRIC_TERRAIN;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 2;
|
||||
break;
|
||||
case EFFECT_PSYCHIC_TERRAIN:
|
||||
statusFlag = STATUS_FIELD_PSYCHIC_TERRAIN, timer = &gFieldTimers.terrainTimer;
|
||||
statusFlag = STATUS_FIELD_PSYCHIC_TERRAIN;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 3;
|
||||
break;
|
||||
case EFFECT_DAMAGE_SET_TERRAIN:
|
||||
switch (gBattleMoves[move].argument)
|
||||
{
|
||||
case 0: //genesis supernova
|
||||
statusFlag = STATUS_FIELD_PSYCHIC_TERRAIN, timer = &gFieldTimers.terrainTimer;
|
||||
statusFlag = STATUS_FIELD_PSYCHIC_TERRAIN;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 3;
|
||||
break;
|
||||
case 1: //splintered stormshards
|
||||
if (!(gFieldStatuses & (STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_GRASSY_TERRAIN | STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_PSYCHIC_TERRAIN)))
|
||||
if (!(gFieldStatuses & STATUS_FIELD_TERRAIN_ANY))
|
||||
{
|
||||
//no terrain to remove -> jump to battle script pointer
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
@ -7957,7 +7956,7 @@ static void HandleTerrainMove(u16 move)
|
||||
else
|
||||
{
|
||||
// remove all terrain
|
||||
gFieldStatuses &= ~(STATUS_FIELD_MISTY_TERRAIN | STATUS_FIELD_GRASSY_TERRAIN | STATUS_FIELD_ELECTRIC_TERRAIN | STATUS_FIELD_PSYCHIC_TERRAIN);
|
||||
gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 4;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
@ -7977,9 +7976,9 @@ static void HandleTerrainMove(u16 move)
|
||||
gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY;
|
||||
gFieldStatuses |= statusFlag;
|
||||
if (GetBattlerHoldEffect(gBattlerAttacker, TRUE) == HOLD_EFFECT_TERRAIN_EXTENDER)
|
||||
*timer = 8;
|
||||
gFieldTimers.terrainTimer = 8;
|
||||
else
|
||||
*timer = 5;
|
||||
gFieldTimers.terrainTimer = 5;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user