Fix stacking effect on HOLD_EFFECT_DOUBLE_PRIZE
moneyMultiplier should only ever be 1, 2 or 4. This adds some flags to moneyMultiplier that prevent HOLD_EFFECT_DOUBLE_PRIZE and Happy Hour from infinitely increasing it.
This commit is contained in:
parent
dd83e37261
commit
13636f8691
3 changed files with 7 additions and 3 deletions
|
@ -485,7 +485,9 @@ struct BattleStruct
|
||||||
u16 assistPossibleMoves[PARTY_SIZE * MAX_MON_MOVES]; // Each of mons can know max 4 moves.
|
u16 assistPossibleMoves[PARTY_SIZE * MAX_MON_MOVES]; // Each of mons can know max 4 moves.
|
||||||
u8 focusPunchBattlerId;
|
u8 focusPunchBattlerId;
|
||||||
u8 battlerPreventingSwitchout;
|
u8 battlerPreventingSwitchout;
|
||||||
u8 moneyMultiplier;
|
u8 moneyMultiplier:6;
|
||||||
|
u8 moneyMultiplierItem:1;
|
||||||
|
u8 moneyMultiplierMove:1;
|
||||||
u8 savedTurnActionNumber;
|
u8 savedTurnActionNumber;
|
||||||
u8 switchInAbilitiesCounter;
|
u8 switchInAbilitiesCounter;
|
||||||
u8 faintedActionsState;
|
u8 faintedActionsState;
|
||||||
|
|
|
@ -2851,9 +2851,10 @@ void SetMoveEffect(bool32 primary, u32 certain)
|
||||||
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
|
gBattlescriptCurrInstr = sMoveEffectBS_Ptrs[gBattleScripting.moveEffect];
|
||||||
break;
|
break;
|
||||||
case MOVE_EFFECT_HAPPY_HOUR:
|
case MOVE_EFFECT_HAPPY_HOUR:
|
||||||
if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER)
|
if (GET_BATTLER_SIDE(gBattlerAttacker) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierMove)
|
||||||
{
|
{
|
||||||
gBattleStruct->moneyMultiplier *= 2;
|
gBattleStruct->moneyMultiplier *= 2;
|
||||||
|
gBattleStruct->moneyMultiplierMove = 1;
|
||||||
}
|
}
|
||||||
gBattlescriptCurrInstr++;
|
gBattlescriptCurrInstr++;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -5626,8 +5626,9 @@ u8 ItemBattleEffects(u8 caseID, u8 battlerId, bool8 moveTurn)
|
||||||
switch (battlerHoldEffect)
|
switch (battlerHoldEffect)
|
||||||
{
|
{
|
||||||
case HOLD_EFFECT_DOUBLE_PRIZE:
|
case HOLD_EFFECT_DOUBLE_PRIZE:
|
||||||
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER)
|
if (GetBattlerSide(battlerId) == B_SIDE_PLAYER && !gBattleStruct->moneyMultiplierItem)
|
||||||
gBattleStruct->moneyMultiplier *= 2;
|
gBattleStruct->moneyMultiplier *= 2;
|
||||||
|
gBattleStruct->moneyMultiplierItem = 1;
|
||||||
break;
|
break;
|
||||||
case HOLD_EFFECT_RESTORE_STATS:
|
case HOLD_EFFECT_RESTORE_STATS:
|
||||||
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
for (i = 0; i < NUM_BATTLE_STATS; i++)
|
||||||
|
|
Loading…
Reference in a new issue