2024-01-17 23:14:18 +00:00
|
|
|
#include "global.h"
|
|
|
|
#include "test/battle.h"
|
|
|
|
|
|
|
|
ASSUMPTIONS
|
|
|
|
{
|
2024-01-29 11:51:32 +00:00
|
|
|
ASSUME(gMovesInfo[MOVE_SUBSTITUTE].effect == EFFECT_SUBSTITUTE);
|
2024-01-17 23:14:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SINGLE_BATTLE_TEST("Substitute creates a Substitute at the cost of 1/4 users maximum HP")
|
|
|
|
{
|
|
|
|
s16 maxHP = 0;
|
|
|
|
s16 costHP = 0;
|
|
|
|
|
|
|
|
GIVEN {
|
|
|
|
PLAYER(SPECIES_WOBBUFFET);
|
|
|
|
PLAYER(SPECIES_WYNAUT);
|
|
|
|
OPPONENT(SPECIES_WOBBUFFET);
|
|
|
|
} WHEN {
|
|
|
|
TURN { MOVE(player, MOVE_SUBSTITUTE); }
|
|
|
|
} SCENE {
|
|
|
|
maxHP = GetMonData(&gPlayerParty[0], MON_DATA_HP);
|
|
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_SUBSTITUTE, player);
|
|
|
|
HP_BAR(player, captureDamage: &costHP);
|
|
|
|
MESSAGE("Wobbuffet made a SUBSTITUTE!");
|
|
|
|
}THEN {
|
|
|
|
EXPECT_EQ(maxHP / 4, costHP);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SINGLE_BATTLE_TEST("Substitute fails if the user doesn't have enough HP")
|
|
|
|
{
|
|
|
|
GIVEN {
|
|
|
|
PLAYER(SPECIES_WOBBUFFET) { HP(1); }
|
|
|
|
PLAYER(SPECIES_WYNAUT);
|
|
|
|
OPPONENT(SPECIES_WOBBUFFET);
|
|
|
|
} WHEN {
|
|
|
|
TURN { MOVE(player, MOVE_SUBSTITUTE); }
|
|
|
|
} SCENE {
|
|
|
|
MESSAGE("It was too weak to make a SUBSTITUTE!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SINGLE_BATTLE_TEST("Substitute's HP cost can trigger a berry")
|
|
|
|
{
|
|
|
|
GIVEN {
|
2024-01-26 18:25:52 +00:00
|
|
|
ASSUME(gItemsInfo[ITEM_SITRUS_BERRY].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
2024-01-17 23:14:18 +00:00
|
|
|
PLAYER(SPECIES_WOBBUFFET) { HP(300); Item(ITEM_SITRUS_BERRY); }
|
|
|
|
PLAYER(SPECIES_WYNAUT);
|
|
|
|
OPPONENT(SPECIES_WOBBUFFET);
|
|
|
|
} WHEN {
|
|
|
|
TURN { MOVE(player, MOVE_SUBSTITUTE); }
|
|
|
|
} SCENE {
|
|
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_SUBSTITUTE, player);
|
|
|
|
MESSAGE("Wobbuffet's Sitrus Berry restored health!");
|
|
|
|
}
|
|
|
|
}
|