diff --git a/test/status_frostbite.c b/test/status_frostbite.c new file mode 100644 index 0000000000..f034478217 --- /dev/null +++ b/test/status_frostbite.c @@ -0,0 +1,96 @@ +#include "global.h" +#include "test_battle.h" + +SINGLE_BATTLE_TEST("Frostbite reduces the special attack by 50 percent") +{ + s16 reducedDamage; + s16 normaleDamage; + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_FROSTBITE); } + } WHEN { + TURN { MOVE(opponent, MOVE_SWIFT); MOVE(player, MOVE_FLAME_WHEEL); } + TURN { MOVE(opponent, MOVE_SWIFT); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_SWIFT, opponent); + HP_BAR(player, captureDamage: &reducedDamage); + ANIMATION(ANIM_TYPE_MOVE, MOVE_FLAME_WHEEL, player); + HP_BAR(opponent); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SWIFT, opponent); + HP_BAR(player, captureDamage: &normaleDamage); + } THEN { EXPECT_EQ(reducedDamage * 2, normaleDamage); } +} + +SINGLE_BATTLE_TEST("Frostbite deals 1/16 damage to effected pokemon") +{ + s16 frostbiteDamage; + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_FROSTBITE); } + } WHEN { + TURN { } + } SCENE { + MESSAGE("Foe Wobbuffet is hurt by its frostbite!"); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_FRZ, opponent); + HP_BAR(opponent, captureDamage: &frostbiteDamage); + } THEN { EXPECT_EQ(frostbiteDamage, opponent->maxHP / 16); } +} + +SINGLE_BATTLE_TEST("Frostbite is healed if hit with a thawing move") +{ + u32 move; + + PARAMETRIZE { move = MOVE_FLAME_WHEEL; } + PARAMETRIZE { move = MOVE_SACRED_FIRE; } + PARAMETRIZE { move = MOVE_FLARE_BLITZ; } + PARAMETRIZE { move = MOVE_FUSION_FLARE; } + PARAMETRIZE { move = MOVE_EMBER; } + + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET) { Status1(STATUS1_FROSTBITE); } + } WHEN { + TURN { MOVE(player, move); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, move, player); + if (move == MOVE_EMBER) { + NONE_OF { + MESSAGE("Foe Wobbuffet's frostbite was healed!"); + } + } else { + MESSAGE("Foe Wobbuffet's frostbite was healed!"); + } + } +} + +SINGLE_BATTLE_TEST("Frostbite is healed when the user uses a thawing move") +{ + u32 move; + + PARAMETRIZE { move = MOVE_FLAME_WHEEL; } + PARAMETRIZE { move = MOVE_SACRED_FIRE; } + PARAMETRIZE { move = MOVE_FLARE_BLITZ; } + PARAMETRIZE { move = MOVE_FUSION_FLARE; } + PARAMETRIZE { move = MOVE_EMBER; } + + GIVEN { + PLAYER(SPECIES_WOBBUFFET) { Status1(STATUS1_FROSTBITE); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, move); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, move, player); + HP_BAR(opponent); + if (move == MOVE_EMBER) { + MESSAGE("Wobbuffet is hurt by its frostbite!"); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_FRZ, player); + } else { + NONE_OF { + MESSAGE("Wobbuffet is hurt by its frostbite!"); + ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_FRZ, player); + } + } + } +} diff --git a/test/test_battle.h b/test/test_battle.h index 967bb661dd..432e33fa80 100644 --- a/test/test_battle.h +++ b/test/test_battle.h @@ -333,7 +333,7 @@ * Used when the battler chooses to switch to another Pokémon but not * via Switch, e.g. after fainting or due to a U-turn. * SEND_OUT(player, 1); - * + * * USE_ITEM(battler, itemId, [partyIndex:], [move:]) * Used when the battler chooses to use an item from the Bag. The item * ID must be specified, and party index and move slot if applicable, e.g: @@ -526,8 +526,7 @@ struct QueuedMessageEvent struct QueuedStatusEvent { u32 battlerId:3; - u32 mask:8; - u32 unused_01:21; + u32 mask:29; }; struct QueuedEvent @@ -872,6 +871,7 @@ struct StatusEventContext bool8 freeze:1; bool8 paralysis:1; bool8 badPoison:1; + bool8 frostbite:1; }; void OpenQueueGroup(u32 sourceLine, enum QueueGroupType); diff --git a/test/test_runner_battle.c b/test/test_runner_battle.c index 365120f137..a6fc00c276 100644 --- a/test/test_runner_battle.c +++ b/test/test_runner_battle.c @@ -1717,6 +1717,8 @@ void QueueStatus(u32 sourceLine, struct BattlePokemon *battler, struct StatusEve mask = STATUS1_PARALYSIS; else if (ctx.badPoison) mask = STATUS1_TOXIC_POISON; + else if (ctx.frostbite) + mask = STATUS1_FROSTBITE; else mask = ctx.status1;