Removes duplicate Booster Energy code (#5656)
This commit is contained in:
parent
f770cb1ea3
commit
afc7795afc
1 changed files with 20 additions and 22 deletions
|
@ -7069,6 +7069,24 @@ static u8 TryConsumeMirrorHerb(u32 battler, bool32 execute)
|
|||
return effect;
|
||||
}
|
||||
|
||||
static inline u32 TryBoosterEnergy(u32 battler)
|
||||
{
|
||||
if (gBattleStruct->boosterEnergyActivates & gBitTable[battler] || gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
|
||||
return ITEM_NO_EFFECT;
|
||||
|
||||
if (((GetBattlerAbility(battler) == ABILITY_PROTOSYNTHESIS) && !((gBattleWeather & B_WEATHER_SUN) && WEATHER_HAS_EFFECT))
|
||||
|| ((GetBattlerAbility(battler) == ABILITY_QUARK_DRIVE) && !(gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN)))
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler));
|
||||
gBattlerAbility = gBattleScripting.battler = battler;
|
||||
gBattleStruct->boosterEnergyActivates |= gBitTable[battler];
|
||||
BattleScriptExecute(BattleScript_BoosterEnergyEnd2);
|
||||
return ITEM_EFFECT_OTHER;
|
||||
}
|
||||
|
||||
return ITEM_NO_EFFECT;
|
||||
}
|
||||
|
||||
static u32 RestoreWhiteHerbStats(u32 battler)
|
||||
{
|
||||
u32 i, effect = 0;
|
||||
|
@ -7585,17 +7603,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn)
|
|||
effect = TryConsumeMirrorHerb(battler, TRUE);
|
||||
break;
|
||||
case HOLD_EFFECT_BOOSTER_ENERGY:
|
||||
if (!(gBattleStruct->boosterEnergyActivates & gBitTable[battler])
|
||||
&& !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
|
||||
&& (((GetBattlerAbility(battler) == ABILITY_PROTOSYNTHESIS) && !((gBattleWeather & B_WEATHER_SUN) && WEATHER_HAS_EFFECT))
|
||||
|| ((GetBattlerAbility(battler) == ABILITY_QUARK_DRIVE) && !(gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN))))
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler));
|
||||
gBattleScripting.battler = battler;
|
||||
gBattleStruct->boosterEnergyActivates |= gBitTable[battler];
|
||||
BattleScriptExecute(BattleScript_BoosterEnergyEnd2);
|
||||
effect = ITEM_EFFECT_OTHER;
|
||||
}
|
||||
effect = TryBoosterEnergy(battler);
|
||||
break;
|
||||
}
|
||||
if (effect != 0)
|
||||
|
@ -7853,17 +7861,7 @@ u8 ItemBattleEffects(u8 caseID, u32 battler, bool32 moveTurn)
|
|||
effect = TryConsumeMirrorHerb(battler, TRUE);
|
||||
break;
|
||||
case HOLD_EFFECT_BOOSTER_ENERGY:
|
||||
if (!(gBattleStruct->boosterEnergyActivates & gBitTable[battler])
|
||||
&& !(gBattleMons[battler].status2 & STATUS2_TRANSFORMED)
|
||||
&& (((GetBattlerAbility(battler) == ABILITY_PROTOSYNTHESIS) && !((gBattleWeather & B_WEATHER_SUN) && WEATHER_HAS_EFFECT))
|
||||
|| ((GetBattlerAbility(battler) == ABILITY_QUARK_DRIVE) && !(gFieldStatuses & STATUS_FIELD_ELECTRIC_TERRAIN))))
|
||||
{
|
||||
PREPARE_STAT_BUFFER(gBattleTextBuff1, GetHighestStatId(battler));
|
||||
gBattlerAbility = gBattleScripting.battler = battler;
|
||||
gBattleStruct->boosterEnergyActivates |= gBitTable[battler];
|
||||
BattleScriptExecute(BattleScript_BoosterEnergyEnd2);
|
||||
effect = ITEM_EFFECT_OTHER;
|
||||
}
|
||||
effect = TryBoosterEnergy(battler);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue