sovereignx/test/battle/move_effect/tera_blast.c
AgustinGDLV 9797640dff
Gimmick Refactor (#4449)
* consolidated gimmick checks, triggers, communication, and activation; updated test runner

* fixed improper use of .usableGimmick

* cleaning up battle_dynamax.c, changing function args to u32s

* fixed '#ifdef TESTING' causing errors

* updated z-moves to use gimmick interface, pared down redundancies; no AI/tests

* added support for z-moves in tests, consolidated gimmick fields

* removed ShouldUseMaxMove and .usingMaxMove

* renamed TryChangeZIndicator, updated z move display

* added several z-move tests and fixed various z-move interactions; fixed z-move category calc

* fixed useless battler arg in GetTypeBasedZMove

* added basic test check for bad Z-Move or Mega usage

* reworked test runner gimmick functionality; added support for Ultra Burst + Z-Move to test Light That Burns the Sky

* fixed gimmick test logic; fixed damage category override

* fixed mega rayquaza test fail

* consolidated gimmick indicator logic; added graphics to gGimmicksInfo

* removed TeraData struct

* reimplemented AI logic for Z-Moves; no changes

* updated Z-Move and Ultra Burst trigger gfx

* added testrunner check for multiple gimmick use

* fixed duplicate z-move call in test

* reorganized data/graphics/gimmicks.h

* added signature Z-Move ability tests; implemented Guardian of Alola

* fixed bad test update

* fixed Thousand Arrows not affecting Tera Flying; clean-up

* fixed -ate tests

* fixed tera tests

* fixed tera tests really

* fixed last batch of tests

* fixed -ate mega test again

* code review

* code review pt.2

* tweaked CanTera again

* dynamax flag only required for player
2024-06-22 22:25:40 +02:00

188 lines
7.8 KiB
C

#include "global.h"
#include "test/battle.h"
ASSUMPTIONS
{
ASSUME(gMovesInfo[MOVE_TERA_BLAST].effect == EFFECT_TERA_BLAST);
}
SINGLE_BATTLE_TEST("Tera Blast changes from Normal-type to the user's Tera Type")
{
GIVEN {
ASSUME(gMovesInfo[MOVE_TERA_BLAST].type == TYPE_NORMAL);
PLAYER(SPECIES_WOBBUFFET) { TeraType(TYPE_DARK); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TERA_BLAST, gimmick: GIMMICK_TERA); }
} SCENE {
MESSAGE("Wobbuffet used Tera Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TERA_BLAST, player);
MESSAGE("It's super effective!");
}
}
SINGLE_BATTLE_TEST("Tera Blast has correct effectiveness for every Tera Type")
{
u32 species;
u32 type;
PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_FLYING; }
PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_POISON; }
PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_FIRE; }
PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_BUG; }
PARAMETRIZE { species = SPECIES_CHIKORITA; type = TYPE_ICE; }
PARAMETRIZE { species = SPECIES_CYNDAQUIL; type = TYPE_GROUND; }
PARAMETRIZE { species = SPECIES_CYNDAQUIL; type = TYPE_ROCK; }
PARAMETRIZE { species = SPECIES_CYNDAQUIL; type = TYPE_WATER; }
PARAMETRIZE { species = SPECIES_GASTLY; type = TYPE_NORMAL; }
PARAMETRIZE { species = SPECIES_GASTLY; type = TYPE_GHOST; }
PARAMETRIZE { species = SPECIES_GASTLY; type = TYPE_PSYCHIC; }
PARAMETRIZE { species = SPECIES_TOTODILE; type = TYPE_GRASS; }
PARAMETRIZE { species = SPECIES_TOTODILE; type = TYPE_ELECTRIC; }
PARAMETRIZE { species = SPECIES_DRATINI; type = TYPE_DRAGON; }
PARAMETRIZE { species = SPECIES_DRATINI; type = TYPE_FAIRY; }
PARAMETRIZE { species = SPECIES_SNEASEL; type = TYPE_FIGHTING; }
PARAMETRIZE { species = SPECIES_SNEASEL; type = TYPE_STEEL; }
PARAMETRIZE { species = SPECIES_ABRA; type = TYPE_DARK; }
GIVEN {
ASSUME(gSpeciesInfo[SPECIES_CHIKORITA].types[0] == TYPE_GRASS);
ASSUME(gSpeciesInfo[SPECIES_CHIKORITA].types[1] == TYPE_GRASS);
ASSUME(gSpeciesInfo[SPECIES_CYNDAQUIL].types[0] == TYPE_FIRE);
ASSUME(gSpeciesInfo[SPECIES_CYNDAQUIL].types[1] == TYPE_FIRE);
ASSUME(gSpeciesInfo[SPECIES_GASTLY].types[0] == TYPE_GHOST);
ASSUME(gSpeciesInfo[SPECIES_GASTLY].types[1] == TYPE_POISON);
ASSUME(gSpeciesInfo[SPECIES_TOTODILE].types[0] == TYPE_WATER);
ASSUME(gSpeciesInfo[SPECIES_TOTODILE].types[1] == TYPE_WATER);
ASSUME(gSpeciesInfo[SPECIES_DRATINI].types[0] == TYPE_DRAGON);
ASSUME(gSpeciesInfo[SPECIES_DRATINI].types[1] == TYPE_DRAGON);
ASSUME(gSpeciesInfo[SPECIES_SNEASEL].types[0] == TYPE_DARK);
ASSUME(gSpeciesInfo[SPECIES_SNEASEL].types[1] == TYPE_ICE);
ASSUME(gSpeciesInfo[SPECIES_ABRA].types[0] == TYPE_PSYCHIC);
ASSUME(gSpeciesInfo[SPECIES_ABRA].types[1] == TYPE_PSYCHIC);
PLAYER(SPECIES_WOBBUFFET) { TeraType(type); }
OPPONENT(species);
} WHEN {
TURN { MOVE(player, MOVE_TERA_BLAST, gimmick: GIMMICK_TERA); }
} SCENE {
if (species == SPECIES_GASTLY && type == TYPE_NORMAL)
MESSAGE("It doesn't affect Foe Gastly…");
else
MESSAGE("It's super effective!");
}
}
SINGLE_BATTLE_TEST("Tera Blast becomes a physical move if the user is Terastallized and has a higher Attack stat", s16 damage)
{
bool32 tera;
PARAMETRIZE { tera = GIMMICK_NONE; }
PARAMETRIZE { tera = GIMMICK_TERA; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { TeraType(TYPE_NORMAL); Attack(100); SpAttack(50); }
OPPONENT(SPECIES_WOBBUFFET) { Defense(200); SpDefense(200); }
} WHEN {
TURN { MOVE(player, MOVE_TERA_BLAST, gimmick: tera); }
} SCENE {
MESSAGE("Wobbuffet used Tera Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TERA_BLAST, player);
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
// Since Wobbuffett has equal defenses, Tera Blast should do 1.5x more damage
// from gaining STAB and an additional 2.0x damage from using its highest
// attacking stat.
EXPECT_MUL_EQ(results[0].damage, UQ_4_12(3.0), results[1].damage);
}
}
SINGLE_BATTLE_TEST("Stellar-type Tera Blast lowers both offensive stats")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { TeraType(TYPE_STELLAR); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TERA_BLAST, gimmick: GIMMICK_TERA); }
} SCENE {
MESSAGE("Wobbuffet used Tera Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TERA_BLAST, player);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Wobbuffet's Attack fell!");
MESSAGE("Wobbuffet's Sp. Atk fell!");
}
}
SINGLE_BATTLE_TEST("Stellar-type Tera Blast has 100 BP and a one-time 1.2x boost")
{
s16 damage[3];
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { TeraType(TYPE_STELLAR); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TERA_BLAST); MOVE(opponent, MOVE_RECOVER); }
TURN { MOVE(player, MOVE_TERA_BLAST, gimmick: GIMMICK_TERA); }
TURN { MOVE(player, MOVE_WORK_UP); }
TURN { MOVE(player, MOVE_TERA_BLAST); }
} SCENE {
// turn 1
MESSAGE("Wobbuffet used Tera Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TERA_BLAST, player);
HP_BAR(opponent, captureDamage: &damage[0]);
// turn 2
MESSAGE("Wobbuffet used Tera Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TERA_BLAST, player);
HP_BAR(opponent, captureDamage: &damage[1]);
// turn 4
MESSAGE("Wobbuffet used Tera Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TERA_BLAST, player);
HP_BAR(opponent, captureDamage: &damage[2]);
} THEN {
// 80 BP to 120 BP (100 * 1.2) boost upon Terastallizing
EXPECT_MUL_EQ(damage[0], UQ_4_12(1.50), damage[1]);
// 120 BP to 100 BP after Stellar boost expended
EXPECT_MUL_EQ(damage[2], UQ_4_12(1.20), damage[1]);
}
}
SINGLE_BATTLE_TEST("Stellar-type Tera Blast is super-effective on Stellar-type Pokemon")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { TeraType(TYPE_STELLAR); }
OPPONENT(SPECIES_WOBBUFFET) { TeraType(TYPE_STELLAR); }
} WHEN {
TURN { MOVE(player, MOVE_TERA_BLAST, gimmick: GIMMICK_TERA); MOVE(opponent, MOVE_CELEBRATE, gimmick: GIMMICK_TERA); }
} SCENE {
MESSAGE("Wobbuffet used Tera Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TERA_BLAST, player);
MESSAGE("It's super effective!");
}
}
SINGLE_BATTLE_TEST("Stellar-type Tera Blast activates a Stellar-type Pokemon's Weakness Policy")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { TeraType(TYPE_STELLAR); }
OPPONENT(SPECIES_WOBBUFFET) { Item(ITEM_WEAKNESS_POLICY); TeraType(TYPE_NORMAL); }
} WHEN {
TURN { MOVE(player, MOVE_TERA_BLAST, gimmick: GIMMICK_TERA); MOVE(opponent, MOVE_CELEBRATE, gimmick: GIMMICK_TERA); }
} SCENE {
MESSAGE("Wobbuffet used Tera Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TERA_BLAST, player);
MESSAGE("It's super effective!");
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, opponent);
}
}
SINGLE_BATTLE_TEST("Flying-type Tera Blast does not have its priority boosted by Gale Wings")
{
GIVEN {
PLAYER(SPECIES_TALONFLAME) { Ability(ABILITY_GALE_WINGS); TeraType(TYPE_FLYING); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TERA_BLAST, gimmick: GIMMICK_TERA); MOVE(opponent, MOVE_QUICK_ATTACK); }
} SCENE {
MESSAGE("Foe Wobbuffet used Quick Attack!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_QUICK_ATTACK, opponent);
MESSAGE("Talonflame used Tera Blast!");
ANIMATION(ANIM_TYPE_MOVE, MOVE_TERA_BLAST, player);
}
}