dd0c3a9ee5
Co-authored-by: Hedara <hedara90@gmail.com>
70 lines
2 KiB
C
70 lines
2 KiB
C
#include "global.h"
|
|
#include "test/battle.h"
|
|
|
|
ASSUMPTIONS
|
|
{
|
|
ASSUME(gMovesInfo[MOVE_SUBSTITUTE].effect == EFFECT_SUBSTITUTE);
|
|
}
|
|
|
|
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 {
|
|
ASSUME(gItemsInfo[ITEM_SITRUS_BERRY].battleUsage == EFFECT_ITEM_RESTORE_HP);
|
|
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!");
|
|
}
|
|
}
|
|
|
|
SINGLE_BATTLE_TEST("Substitute's HP cost doesn't trigger effects that trigger on damage taken")
|
|
{
|
|
GIVEN {
|
|
PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_AIR_BALLOON); }
|
|
OPPONENT(SPECIES_WOBBUFFET);
|
|
} WHEN {
|
|
TURN { MOVE(player, MOVE_SUBSTITUTE); }
|
|
} SCENE {
|
|
ANIMATION(ANIM_TYPE_MOVE, MOVE_SUBSTITUTE, player);
|
|
MESSAGE("Wobbuffet made a SUBSTITUTE!");
|
|
NOT MESSAGE("Wobbuffet's Air Balloon popped!");
|
|
}
|
|
}
|