diff --git a/test/item_effect_restore_hp.c b/test/item_effect_restore_hp.c index af3042b3b..ed1a35a1d 100644 --- a/test/item_effect_restore_hp.c +++ b/test/item_effect_restore_hp.c @@ -1,180 +1,48 @@ #include "global.h" #include "test_battle.h" -SINGLE_BATTLE_TEST("Potion restores a battler's HP by 20") +SINGLE_BATTLE_TEST("Items can restore a battler's HP by a fixed amount") { + u32 item, hp; + PARAMETRIZE { item = ITEM_POTION; hp = 20; } + PARAMETRIZE { item = ITEM_SUPER_POTION; hp = 60; } + PARAMETRIZE { item = ITEM_HYPER_POTION; hp = 120; } + PARAMETRIZE { item = ITEM_FRESH_WATER; hp = 30; } + PARAMETRIZE { item = ITEM_SODA_POP; hp = 50; } + PARAMETRIZE { item = ITEM_LEMONADE; hp = 70; } + PARAMETRIZE { item = ITEM_MOOMOO_MILK; hp = 100; } + PARAMETRIZE { item = ITEM_ENERGY_POWDER; hp = I_HEALTH_RECOVERY >= GEN_7 ? 60 : 50; } + PARAMETRIZE { item = ITEM_ENERGY_ROOT; hp = I_HEALTH_RECOVERY >= GEN_7 ? 120 : 200; } + PARAMETRIZE { item = ITEM_SWEET_HEART; hp = 20; } + PARAMETRIZE { item = ITEM_ORAN_BERRY; hp = 10; } +#if I_SITRUS_BERRY_HEAL < GEN_4 + PARAMETRIZE { item = ITEM_SITRUS_BERRY; hp = 30; } +#endif GIVEN { - ASSUME(gItems[ITEM_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP); + ASSUME(gItems[item].battleUsage == EFFECT_ITEM_RESTORE_HP); PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } OPPONENT(SPECIES_WOBBUFFET); } WHEN { - TURN { USE_ITEM(player, ITEM_POTION, partyIndex: 0); } + TURN { USE_ITEM(player, item, partyIndex: 0); } } SCENE { - HP_BAR(player, damage: -20); + HP_BAR(player, damage: -hp); } } -SINGLE_BATTLE_TEST("Super Potion restores a battler's HP by 60") +SINGLE_BATTLE_TEST("Items can restore a battler's HP by a percentage") { + u32 item, percentage; + PARAMETRIZE { item = ITEM_MAX_POTION; percentage = 100; } +#if I_SITRUS_BERRY_HEAL >= GEN_4 + PARAMETRIZE { item = ITEM_SITRUS_BERRY; percentage = 25; } +#endif GIVEN { - ASSUME(gItems[ITEM_SUPER_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP); + ASSUME(gItems[item].battleUsage == EFFECT_ITEM_RESTORE_HP); PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } OPPONENT(SPECIES_WOBBUFFET); } WHEN { - TURN { USE_ITEM(player, ITEM_SUPER_POTION, partyIndex: 0); } + TURN { USE_ITEM(player, item, partyIndex: 0); } } SCENE { - HP_BAR(player, damage: -60); - } -} - -SINGLE_BATTLE_TEST("Hyper Potion restores a battler's HP by 120") -{ - GIVEN { - ASSUME(gItems[ITEM_HYPER_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { USE_ITEM(player, ITEM_HYPER_POTION, partyIndex: 0); } - } SCENE { - HP_BAR(player, damage: -120); - } -} - -SINGLE_BATTLE_TEST("Max Potion restores a battler's HP fully") -{ - GIVEN { - ASSUME(gItems[ITEM_MAX_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { USE_ITEM(player, ITEM_MAX_POTION, partyIndex: 0); } - } SCENE { - HP_BAR(player, hp: 400); - } -} - -SINGLE_BATTLE_TEST("Fresh Water restores a battler's HP by 30") -{ - GIVEN { - ASSUME(gItems[ITEM_FRESH_WATER].battleUsage == EFFECT_ITEM_RESTORE_HP); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { USE_ITEM(player, ITEM_FRESH_WATER, partyIndex: 0); } - } SCENE { - HP_BAR(player, damage: -30); - } -} - -SINGLE_BATTLE_TEST("Soda Pop restores a battler's HP by 50") -{ - GIVEN { - ASSUME(gItems[ITEM_SODA_POP].battleUsage == EFFECT_ITEM_RESTORE_HP); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { USE_ITEM(player, ITEM_SODA_POP, partyIndex: 0); } - } SCENE { - HP_BAR(player, damage: -50); - } -} - -SINGLE_BATTLE_TEST("Lemonade restores a battler's HP by 70") -{ - GIVEN { - ASSUME(gItems[ITEM_LEMONADE].battleUsage == EFFECT_ITEM_RESTORE_HP); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { USE_ITEM(player, ITEM_LEMONADE, partyIndex: 0); } - } SCENE { - HP_BAR(player, damage: -70); - } -} - -SINGLE_BATTLE_TEST("Moomoo Milk restores a battler's HP by 100") -{ - GIVEN { - ASSUME(gItems[ITEM_MOOMOO_MILK].battleUsage == EFFECT_ITEM_RESTORE_HP); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { USE_ITEM(player, ITEM_MOOMOO_MILK, partyIndex: 0); } - } SCENE { - HP_BAR(player, damage: -100); - } -} - -SINGLE_BATTLE_TEST("Energy Powder restores a battler's HP by 60 (/50)") -{ - GIVEN { - ASSUME(gItems[ITEM_ENERGY_POWDER].battleUsage == EFFECT_ITEM_RESTORE_HP); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { USE_ITEM(player, ITEM_ENERGY_POWDER, partyIndex: 0); } - } SCENE { - if (I_HEALTH_RECOVERY >= GEN_7) - HP_BAR(player, damage: -60); - else - HP_BAR(player, damage: -50); - } -} - -SINGLE_BATTLE_TEST("Energy Root restores a battler's HP by 120 (/200)") -{ - GIVEN { - ASSUME(gItems[ITEM_ENERGY_ROOT].battleUsage == EFFECT_ITEM_RESTORE_HP); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { USE_ITEM(player, ITEM_ENERGY_ROOT, partyIndex: 0); } - } SCENE { - if (I_HEALTH_RECOVERY >= GEN_7) - HP_BAR(player, damage: -120); - else - HP_BAR(player, damage: -200); - } -} - -SINGLE_BATTLE_TEST("Sweet Heart restores a battler's HP by 20") -{ - GIVEN { - ASSUME(gItems[ITEM_SWEET_HEART].battleUsage == EFFECT_ITEM_RESTORE_HP); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { USE_ITEM(player, ITEM_SWEET_HEART, partyIndex: 0); } - } SCENE { - HP_BAR(player, damage: -20); - } -} - -SINGLE_BATTLE_TEST("Oran Berry restores a battler's HP by 10") -{ - GIVEN { - ASSUME(gItems[ITEM_ORAN_BERRY].battleUsage == EFFECT_ITEM_RESTORE_HP); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { USE_ITEM(player, ITEM_ORAN_BERRY, partyIndex: 0); } - } SCENE { - HP_BAR(player, damage: -10); - } -} - -SINGLE_BATTLE_TEST("Sitrus Berry restores a battler's HP by 25% of its max HP (/30HP flat)") -{ - GIVEN { - ASSUME(gItems[ITEM_SITRUS_BERRY].battleUsage == EFFECT_ITEM_RESTORE_HP); - PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); } - OPPONENT(SPECIES_WOBBUFFET); - } WHEN { - TURN { USE_ITEM(player, ITEM_SITRUS_BERRY, partyIndex: 0); } - } SCENE { - if (I_SITRUS_BERRY_HEAL >= GEN_4) - HP_BAR(player, damage: -100); // 25%. - else - HP_BAR(player, damage: -30); // 30. + HP_BAR(player, damage: -min(399, 400 * percentage / 100)); } }