mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 11:44:17 +01:00
actually working restore hp tests
This commit is contained in:
parent
929e4749da
commit
42215c94e7
@ -1,51 +1,48 @@
|
||||
#include "global.h"
|
||||
#include "test_battle.h"
|
||||
|
||||
#define TEST_HP 1
|
||||
#define MAX_HP 400
|
||||
|
||||
SINGLE_BATTLE_TEST("Restore HP: Potion restores a battler's HP by 20")
|
||||
{
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(50); MaxHP(100); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_POTION, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
EXPECT_EQ(damage, -20);
|
||||
HP_BAR(player, hp: TEST_HP + 20);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Restore HP: Super Potion restores a battler's HP by 50")
|
||||
SINGLE_BATTLE_TEST("Restore HP: Super Potion restores a battler's HP by 60")
|
||||
{
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_SUPER_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(50); MaxHP(100); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_SUPER_POTION, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
EXPECT_EQ(damage, -50);
|
||||
HP_BAR(player, hp: TEST_HP + 60);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Restore HP: Hyper Potion restores a battler's HP by 200")
|
||||
SINGLE_BATTLE_TEST("Restore HP: Hyper Potion restores a battler's HP by 120")
|
||||
{
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_HYPER_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(100); MaxHP(400); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_HYPER_POTION, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
EXPECT_EQ(damage, -200);
|
||||
HP_BAR(player, hp: TEST_HP + 120);
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,12 +51,12 @@ SINGLE_BATTLE_TEST("Restore HP: Max Potion restores a battler's HP fully")
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_MAX_POTION].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(1); MaxHP(400); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_MAX_POTION, partyIndex: 0); }
|
||||
} FINALLY {
|
||||
EXPECT_EQ(player->hp, player->maxHP);
|
||||
} SCENE {
|
||||
HP_BAR(player, hp: MAX_HP);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,14 +65,12 @@ SINGLE_BATTLE_TEST("Restore HP: Fresh Water restores a battler's HP by 30")
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_FRESH_WATER].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(50); MaxHP(100); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_FRESH_WATER, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
EXPECT_EQ(damage, -30);
|
||||
HP_BAR(player, hp: TEST_HP + 30);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,14 +79,12 @@ SINGLE_BATTLE_TEST("Restore HP: Soda Pop restores a battler's HP by 50")
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_SODA_POP].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(50); MaxHP(100); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_SODA_POP, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
EXPECT_EQ(damage, -50);
|
||||
HP_BAR(player, hp: TEST_HP + 50);
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,14 +93,12 @@ SINGLE_BATTLE_TEST("Restore HP: Lemonade restores a battler's HP by 70")
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_LEMONADE].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(50); MaxHP(200); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_LEMONADE, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
EXPECT_EQ(damage, -70);
|
||||
HP_BAR(player, hp: TEST_HP + 70);
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,14 +107,12 @@ SINGLE_BATTLE_TEST("Restore HP: Moomoo Milk restores a battler's HP by 100")
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_MOOMOO_MILK].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(50); MaxHP(200); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_MOOMOO_MILK, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
EXPECT_EQ(damage, -100);
|
||||
HP_BAR(player, hp: TEST_HP + 100);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,18 +121,15 @@ SINGLE_BATTLE_TEST("Restore HP: Energy Powder restores a battler's HP by 60(50)"
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_ENERGY_POWDER].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(50); MaxHP(200); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_ENERGY_POWDER, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
#if I_HEALTH_RECOVERY >= GEN_7
|
||||
EXPECT_EQ(damage, -60);
|
||||
#else
|
||||
EXPECT_EQ(damage, -50);
|
||||
#endif
|
||||
if (I_HEALTH_RECOVERY >= GEN_7)
|
||||
HP_BAR(player, hp: TEST_HP + 60);
|
||||
else
|
||||
HP_BAR(player, hp: TEST_HP + 50);
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,18 +138,15 @@ SINGLE_BATTLE_TEST("Restore HP: Energy Root restores a battler's HP by 120(200)"
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_ENERGY_ROOT].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(50); MaxHP(300); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_ENERGY_ROOT, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
#if I_HEALTH_RECOVERY >= GEN_7
|
||||
EXPECT_EQ(damage, -120);
|
||||
#else
|
||||
EXPECT_EQ(damage, -200);
|
||||
#endif
|
||||
if (I_HEALTH_RECOVERY >= GEN_7)
|
||||
HP_BAR(player, hp: TEST_HP + 120);
|
||||
else
|
||||
HP_BAR(player, hp: TEST_HP + 200);
|
||||
}
|
||||
}
|
||||
|
||||
@ -172,14 +155,12 @@ SINGLE_BATTLE_TEST("Restore HP: Sweet Heart restores a battler's HP by 20")
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_SWEET_HEART].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(50); MaxHP(100); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_SWEET_HEART, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
EXPECT_EQ(damage, -20);
|
||||
HP_BAR(player, hp: TEST_HP + 20);
|
||||
}
|
||||
}
|
||||
|
||||
@ -188,32 +169,31 @@ SINGLE_BATTLE_TEST("Restore HP: Oran Berry restores a battler's HP by 10")
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_ORAN_BERRY].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(50); MaxHP(100); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_ORAN_BERRY, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
EXPECT_EQ(damage, -10);
|
||||
HP_BAR(player, hp: TEST_HP + 10);
|
||||
}
|
||||
}
|
||||
|
||||
SINGLE_BATTLE_TEST("Restore HP: Sitrus Berry restores a battler's HP")
|
||||
SINGLE_BATTLE_TEST("Restore HP: Sitrus Berry restores a battler's HP by 25% of its max HP(30HP flat)")
|
||||
{
|
||||
s16 damage;
|
||||
GIVEN {
|
||||
ASSUME(gItems[ITEM_SITRUS_BERRY].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(50); MaxHP(100); }
|
||||
PLAYER(SPECIES_WOBBUFFET) { HP(TEST_HP); MaxHP(MAX_HP); }
|
||||
OPPONENT(SPECIES_WOBBUFFET);
|
||||
} WHEN {
|
||||
TURN { USE_ITEM(player, ITEM_SITRUS_BERRY, partyIndex: 0); }
|
||||
} SCENE {
|
||||
HP_BAR(player, captureDamage: &damage);
|
||||
} FINALLY {
|
||||
if (I_SITRUS_BERRY_HEAL >= GEN_4)
|
||||
EXPECT_EQ(damage, -25);
|
||||
HP_BAR(player, hp: TEST_HP + MAX_HP * 0.25);
|
||||
else
|
||||
EXPECT_EQ(damage, -30);
|
||||
HP_BAR(player, hp: TEST_HP + 30);
|
||||
}
|
||||
}
|
||||
|
||||
#undef TEST_HP
|
||||
#undef MAX_HP
|
Loading…
Reference in New Issue
Block a user