Refactored Secret Power move effect into a function

This commit is contained in:
Eduardo Quezada D'Ottone 2021-10-04 21:28:15 -03:00
parent 142a83ca96
commit 5019615be1
2 changed files with 18 additions and 10 deletions

View File

@ -36,6 +36,7 @@ u32 IsAbilityStatusProtected(u32 battler);
bool32 TryResetBattlerStatChanges(u8 battler);
bool32 CanCamouflage(u8 battlerId);
u16 GetNaturePowerMove(void);
u16 GetSecretPowerMoveEffect(void);
void StealTargetItem(u8 battlerStealer, u8 battlerItem);
extern void (* const gBattleScriptingCommandsTable[])(void);

View File

@ -12068,37 +12068,44 @@ static void Cmd_jumpifhasnohp(void)
static void Cmd_getsecretpowereffect(void)
{
gBattleScripting.moveEffect = GetSecretPowerMoveEffect();
gBattlescriptCurrInstr++;
}
u16 GetSecretPowerMoveEffect(void)
{
u16 moveEffect;
switch (gBattleTerrain)
{
case BATTLE_TERRAIN_GRASS:
gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP;
moveEffect = MOVE_EFFECT_SLEEP;
break;
case BATTLE_TERRAIN_LONG_GRASS:
gBattleScripting.moveEffect = MOVE_EFFECT_SLEEP;
moveEffect = MOVE_EFFECT_SLEEP;
break;
case BATTLE_TERRAIN_SAND:
gBattleScripting.moveEffect = MOVE_EFFECT_ACC_MINUS_1;
moveEffect = MOVE_EFFECT_ACC_MINUS_1;
break;
case BATTLE_TERRAIN_UNDERWATER:
gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1;
moveEffect = MOVE_EFFECT_ATK_MINUS_1;
break;
case BATTLE_TERRAIN_WATER:
gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1;
moveEffect = MOVE_EFFECT_ATK_MINUS_1;
break;
case BATTLE_TERRAIN_POND:
gBattleScripting.moveEffect = MOVE_EFFECT_ATK_MINUS_1;
moveEffect = MOVE_EFFECT_ATK_MINUS_1;
break;
case BATTLE_TERRAIN_MOUNTAIN:
gBattleScripting.moveEffect = MOVE_EFFECT_ACC_MINUS_1;
moveEffect = MOVE_EFFECT_ACC_MINUS_1;
break;
case BATTLE_TERRAIN_CAVE:
gBattleScripting.moveEffect = MOVE_EFFECT_FLINCH;
moveEffect = MOVE_EFFECT_FLINCH;
break;
default:
gBattleScripting.moveEffect = MOVE_EFFECT_PARALYSIS;
moveEffect = MOVE_EFFECT_PARALYSIS;
break;
}
gBattlescriptCurrInstr++;
return moveEffect;
}
static void Cmd_pickup(void)