Fixes berries missing timing (#5300)
* Fixes berries missing timing * salac berry test
This commit is contained in:
parent
dc2bbe0448
commit
389e5c20dd
@ -2321,6 +2321,7 @@ enum
|
||||
ENDTURN_DYNAMAX,
|
||||
ENDTURN_GMAX_MOVE_RESIDUAL_DAMAGE,
|
||||
ENDTURN_SEA_OF_FIRE_DAMAGE,
|
||||
ENDTURN_ITEMS3,
|
||||
ENDTURN_BATTLER_COUNT
|
||||
};
|
||||
|
||||
@ -2453,6 +2454,15 @@ u8 DoBattlerEndTurnEffects(void)
|
||||
effect++;
|
||||
gBattleStruct->turnEffectsTracker++;
|
||||
break;
|
||||
case ENDTURN_ITEMS3: // berry effects
|
||||
if (gItemsInfo[gBattleMons[battler].item].pocket == POCKET_BERRIES
|
||||
|| GetBattlerHoldEffect(battler, TRUE) == HOLD_EFFECT_RESTORE_HP) // Edge case for Berry Juice
|
||||
{
|
||||
if (ItemBattleEffects(ITEMEFFECT_NORMAL, battler, FALSE))
|
||||
effect++;
|
||||
}
|
||||
gBattleStruct->turnEffectsTracker++;
|
||||
break;
|
||||
case ENDTURN_ORBS:
|
||||
if (IsBattlerAlive(battler) && ItemBattleEffects(ITEMEFFECT_ORBS, battler, FALSE))
|
||||
effect++;
|
||||
|
||||
29
test/battle/hold_effect/restore_hp.c
Normal file
29
test/battle/hold_effect/restore_hp.c
Normal file
@ -0,0 +1,29 @@
|
||||
#include "global.h"
|
||||
#include "test/battle.h"
|
||||
|
||||
DOUBLE_BATTLE_TEST("Restore HP Item effects do not miss timing")
|
||||
{
|
||||
u16 item;
|
||||
|
||||
PARAMETRIZE { item = ITEM_BERRY_JUICE; }
|
||||
PARAMETRIZE { item = ITEM_ORAN_BERRY; }
|
||||
PARAMETRIZE { item = ITEM_SITRUS_BERRY; }
|
||||
|
||||
GIVEN {
|
||||
ASSUME(gItemsInfo[ITEM_ORAN_BERRY].holdEffect == HOLD_EFFECT_RESTORE_HP);
|
||||
ASSUME(gItemsInfo[ITEM_BERRY_JUICE].holdEffect == HOLD_EFFECT_RESTORE_HP);
|
||||
ASSUME(gItemsInfo[ITEM_SITRUS_BERRY].holdEffect == HOLD_EFFECT_RESTORE_PCT_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WYNAUT) { MaxHP(100); HP(51); Item(item); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(playerLeft, MOVE_FIRE_PLEDGE, target: opponentRight); MOVE(playerRight, MOVE_GRASS_PLEDGE, target: opponentRight); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, playerRight);
|
||||
MESSAGE("A sea of fire enveloped the opposing team!");
|
||||
MESSAGE("The opposing Foe Wynaut was hurt by the sea of fire!");
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponentLeft);
|
||||
MESSAGE("The opposing Foe Wobbuffet was hurt by the sea of fire!");
|
||||
}
|
||||
}
|
||||
@ -68,3 +68,22 @@ SINGLE_BATTLE_TEST("Salac Berry raises Speed by one stage when HP drops to 1/4 o
|
||||
EXPECT_EQ(player->statStages[STAT_SPEED], DEFAULT_STAT_STAGE + 2);
|
||||
}
|
||||
}
|
||||
|
||||
DOUBLE_BATTLE_TEST("Salac Berry does not miss timing miss timing")
|
||||
{
|
||||
GIVEN {
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
PLAYER(SPECIES_WOBBUFFET);
|
||||
OPPONENT(SPECIES_WYNAUT) { MaxHP(100); HP(26); Item(ITEM_SALAC_BERRY); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { MOVE(playerLeft, MOVE_FIRE_PLEDGE, target: opponentRight); MOVE(playerRight, MOVE_GRASS_PLEDGE, target: opponentRight); }
|
||||
} SCENE {
|
||||
ANIMATION(ANIM_TYPE_MOVE, MOVE_FIRE_PLEDGE, playerRight);
|
||||
MESSAGE("A sea of fire enveloped the opposing team!");
|
||||
MESSAGE("The opposing Foe Wynaut was hurt by the sea of fire!");
|
||||
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponentLeft);
|
||||
MESSAGE("Using Salac Berry, the Speed of Foe Wynaut rose!");
|
||||
MESSAGE("The opposing Foe Wobbuffet was hurt by the sea of fire!");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user