Various tests + Poison Heal fix + Transistor update (#3385)

This commit is contained in:
Eduardo Quezada D'Ottone 2023-10-11 11:34:20 -03:00 committed by GitHub
commit eedc61709d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 421 additions and 1 deletions

View File

@ -7960,9 +7960,10 @@ BattleScript_DoTurnDmgEnd:
end2 end2
BattleScript_PoisonHealActivates:: BattleScript_PoisonHealActivates::
copybyte gBattlerAbility, gBattlerAttacker
call BattleScript_AbilityPopUp
printstring STRINGID_POISONHEALHPUP printstring STRINGID_POISONHEALHPUP
waitmessage B_WAIT_TIME_LONG waitmessage B_WAIT_TIME_LONG
recordability BS_ATTACKER
statusanimation BS_ATTACKER statusanimation BS_ATTACKER
orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE | HITMARKER_PASSIVE_DAMAGE
healthbarupdate BS_ATTACKER healthbarupdate BS_ATTACKER

View File

@ -126,6 +126,7 @@
#define B_ABSORBING_ABILITY_STRING GEN_LATEST // In Gen5+, the abilities that absorb moves of a certain type use a generic string for stat increases and decreases. #define B_ABSORBING_ABILITY_STRING GEN_LATEST // In Gen5+, the abilities that absorb moves of a certain type use a generic string for stat increases and decreases.
#define B_LEAF_GUARD_PREVENTS_REST GEN_LATEST // In Gen5+, Leaf Guard prevents the use of Rest in harsh sunlight. #define B_LEAF_GUARD_PREVENTS_REST GEN_LATEST // In Gen5+, Leaf Guard prevents the use of Rest in harsh sunlight.
#define B_SNOW_WARNING GEN_LATEST // In Gen9+, Snow Warning will summon snow instead of hail. #define B_SNOW_WARNING GEN_LATEST // In Gen9+, Snow Warning will summon snow instead of hail.
#define B_TRANSISTOR GEN_LATEST // In Gen9+, Transistor will only boost Electric-type moves by 1.3x as opposed to 1.5x.
// Item settings // Item settings
#define B_HP_BERRIES GEN_LATEST // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn. #define B_HP_BERRIES GEN_LATEST // In Gen4+, berries which restore hp activate immediately after HP drops to half. In Gen3, the effect occurs at the end of the turn.

View File

@ -8964,7 +8964,11 @@ static inline u32 CalcMoveBasePowerAfterModifiers(u32 move, u32 battlerAtk, u32
break; break;
case ABILITY_TRANSISTOR: case ABILITY_TRANSISTOR:
if (moveType == TYPE_ELECTRIC) if (moveType == TYPE_ELECTRIC)
#if B_TRANSISTOR >= GEN_9
modifier = uq4_12_multiply(modifier, UQ_4_12(5325 / 4096));
#else
modifier = uq4_12_multiply(modifier, UQ_4_12(1.5)); modifier = uq4_12_multiply(modifier, UQ_4_12(1.5));
#endif
break; break;
case ABILITY_DRAGONS_MAW: case ABILITY_DRAGONS_MAW:
if (moveType == TYPE_DRAGON) if (moveType == TYPE_DRAGON)

View File

@ -0,0 +1,46 @@
#include "global.h"
#include "test/battle.h"
ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_TACKLE].split == SPLIT_PHYSICAL);
ASSUME(gBattleMoves[MOVE_ECHOED_VOICE].split == SPLIT_SPECIAL);
}
SINGLE_BATTLE_TEST("Defeatist halves Attack when HP <= 50%", s16 damage)
{
u32 hp;
PARAMETRIZE { hp = 400; }
PARAMETRIZE { hp = 200; }
GIVEN {
PLAYER(SPECIES_ARCHEN) { Ability(ABILITY_DEFEATIST); HP(hp), MaxHP(400);}
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_CELEBRATE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, player);
HP_BAR(opponent, captureDamage: &results[i].damage);
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage);
}
}
SINGLE_BATTLE_TEST("Defeatist halves Special Attack when HP <= 50%", s16 damage)
{
u32 hp;
PARAMETRIZE { hp = 400; }
PARAMETRIZE { hp = 200; }
GIVEN {
PLAYER(SPECIES_ARCHEN) { Ability(ABILITY_DEFEATIST); HP(hp), MaxHP(400);}
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_ECHOED_VOICE); MOVE(opponent, MOVE_CELEBRATE); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_ECHOED_VOICE, player);
HP_BAR(opponent, captureDamage: &results[i].damage);
ANIMATION(ANIM_TYPE_MOVE, MOVE_CELEBRATE, opponent);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage);
}
}

View File

@ -0,0 +1,33 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Dragon's Maw increases Dragon-type move damage", s16 damage)
{
u32 move;
u16 ability;
PARAMETRIZE { move = MOVE_TACKLE; ability = ABILITY_KLUTZ; }
PARAMETRIZE { move = MOVE_TACKLE; ability = ABILITY_DRAGONS_MAW; }
PARAMETRIZE { move = MOVE_DRAGON_CLAW; ability = ABILITY_KLUTZ; }
PARAMETRIZE { move = MOVE_DRAGON_CLAW; ability = ABILITY_DRAGONS_MAW; }
PARAMETRIZE { move = MOVE_DRAGON_BREATH; ability = ABILITY_KLUTZ; }
PARAMETRIZE { move = MOVE_DRAGON_BREATH; ability = ABILITY_DRAGONS_MAW; }
GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].type != TYPE_DRAGON);
ASSUME(gBattleMoves[MOVE_DRAGON_CLAW].type == TYPE_DRAGON);
ASSUME(gBattleMoves[MOVE_DRAGON_BREATH].type == TYPE_DRAGON);
ASSUME(gBattleMoves[MOVE_DRAGON_CLAW].split == SPLIT_PHYSICAL);
ASSUME(gBattleMoves[MOVE_DRAGON_BREATH].split == SPLIT_SPECIAL);
PLAYER(SPECIES_REGIDRAGO) { Ability(ability); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, move); }
} SCENE {
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_EQ(results[0].damage, results[1].damage); // Tackle should be unaffected
EXPECT_MUL_EQ(results[2].damage, Q_4_12(1.5), results[3].damage); // Dragon Claw should be affected
EXPECT_MUL_EQ(results[4].damage, Q_4_12(1.5), results[5].damage); // Dragon Breath should be affected
}
}

View File

@ -0,0 +1,46 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Earth Eater heals 25% when hit by ground type moves")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_MUD_SLAP].type == TYPE_GROUND);
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_EARTH_EATER); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_MUD_SLAP); }
} SCENE {
ABILITY_POPUP(player, ABILITY_EARTH_EATER);
HP_BAR(player, damage: -25);
MESSAGE("Wobbuffet restored HP using its Earth Eater!");
}
}
SINGLE_BATTLE_TEST("Earth Eater does not activate if protected")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_MUD_SLAP].type == TYPE_GROUND);
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_EARTH_EATER); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_PROTECT); MOVE(opponent, MOVE_MUD_SLAP); }
} SCENE {
NONE_OF { ABILITY_POPUP(player, ABILITY_EARTH_EATER); HP_BAR(player); MESSAGE("Wobbuffet restored HP using its Earth Eater!"); }
}
}
SINGLE_BATTLE_TEST("Earth Eater activates on status moves")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_SAND_ATTACK].type == TYPE_GROUND);
ASSUME(gBattleMoves[MOVE_SAND_ATTACK].split == SPLIT_STATUS);
PLAYER(SPECIES_WOBBUFFET) { Ability(ABILITY_EARTH_EATER); HP(1); MaxHP(100); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SAND_ATTACK); }
} SCENE {
ABILITY_POPUP(player, ABILITY_EARTH_EATER);
HP_BAR(player, damage: -25);
MESSAGE("Wobbuffet restored HP using its Earth Eater!");
}
}

View File

@ -0,0 +1,53 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Gale Wings only grants priority at full HP")
{
u16 hp;
PARAMETRIZE { hp = 100; }
PARAMETRIZE { hp = 99; }
GIVEN {
ASSUME(B_GALE_WINGS >= GEN_7);
ASSUME(gBattleMoves[MOVE_AERIAL_ACE].type == TYPE_FLYING);
PLAYER(SPECIES_TALONFLAME) { Ability(ABILITY_GALE_WINGS); HP(hp); MaxHP(100); Speed(1);}
OPPONENT(SPECIES_WOBBUFFET) { Speed(100);};
} WHEN {
TURN { MOVE(player, MOVE_AERIAL_ACE); }
} SCENE {
if (hp == 100) {
MESSAGE("Talonflame used Aerial Ace!");
MESSAGE("Foe Wobbuffet used Celebrate!");
}
else {
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("Talonflame used Aerial Ace!");
}
}
}
SINGLE_BATTLE_TEST("Gale Wings only grants priority to Flying-type moves")
{
u32 move;
PARAMETRIZE { move = MOVE_AERIAL_ACE; }
PARAMETRIZE { move = MOVE_FLARE_BLITZ; }
GIVEN {
ASSUME(B_GALE_WINGS >= GEN_7);
ASSUME(gBattleMoves[MOVE_AERIAL_ACE].type == TYPE_FLYING);
ASSUME(gBattleMoves[MOVE_FLARE_BLITZ].type == TYPE_FIRE);
PLAYER(SPECIES_TALONFLAME) { Ability(ABILITY_GALE_WINGS); HP(100); MaxHP(100); Speed(1);}
OPPONENT(SPECIES_WOBBUFFET) { Speed(100);};
} WHEN {
TURN { MOVE(player, move); }
} SCENE {
if (move == MOVE_AERIAL_ACE) {
MESSAGE("Talonflame used Aerial Ace!");
MESSAGE("Foe Wobbuffet used Celebrate!");
}
else {
MESSAGE("Foe Wobbuffet used Celebrate!");
MESSAGE("Talonflame used Flare Blitz!");
}
}
}
TO_DO_BATTLE_TEST("Gale Wings doesn't increase priority of Flying-type Hidden Power, Natural Gift, Judgment or Tera Blast");

View File

@ -0,0 +1,77 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Poison Heal heals from (Toxic) Poison damage")
{
u8 status;
PARAMETRIZE { status = STATUS1_POISON; }
PARAMETRIZE { status = STATUS1_TOXIC_POISON; }
GIVEN {
PLAYER(SPECIES_SHROOMISH) { Ability(ABILITY_POISON_HEAL); Status1(status); HP(1), MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
} SCENE {
ABILITY_POPUP(player, ABILITY_POISON_HEAL);
MESSAGE("The poisoning healed Shroomish a little bit!");
HP_BAR(player, damage: -50);
}
}
SINGLE_BATTLE_TEST("Poison Heal heals from Toxic Poison damage are constant")
{
s16 turnOneHit;
s16 turnTwoHit;
GIVEN {
PLAYER(SPECIES_SHROOMISH) { Ability(ABILITY_POISON_HEAL); Status1(STATUS1_TOXIC_POISON); HP(1), MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { }
TURN { }
} SCENE {
ABILITY_POPUP(player, ABILITY_POISON_HEAL);
MESSAGE("The poisoning healed Shroomish a little bit!");
HP_BAR(player, captureDamage: &turnOneHit);
ABILITY_POPUP(player, ABILITY_POISON_HEAL);
MESSAGE("The poisoning healed Shroomish a little bit!");
HP_BAR(player, captureDamage: &turnTwoHit);
} THEN {
EXPECT_EQ(turnOneHit, turnTwoHit);
}
}
SINGLE_BATTLE_TEST("Poison Heal does not heal or cause damage when under Heal Block")
{
GIVEN {
PLAYER(SPECIES_SHROOMISH) { Ability(ABILITY_POISON_HEAL); Status1(STATUS1_POISON); HP(1), MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_HEAL_BLOCK); }
} SCENE {
NONE_OF {
ABILITY_POPUP(player, ABILITY_POISON_HEAL);
MESSAGE("The poisoning healed Shroomish a little bit!");
HP_BAR(player, damage: -50);
}
}
}
SINGLE_BATTLE_TEST("Poison Heal activates before Toxic Orb")
{
GIVEN {
PLAYER(SPECIES_SHROOMISH) { Ability(ABILITY_POISON_HEAL); Item(ITEM_TOXIC_ORB); HP(1), MaxHP(400); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, MOVE_CELEBRATE); }
} SCENE {
NONE_OF {
ABILITY_POPUP(player, ABILITY_POISON_HEAL);
MESSAGE("The poisoning healed Shroomish a little bit!");
HP_BAR(player, damage: -50);
HP_BAR(player, damage: 50);
}
}
}

View File

@ -0,0 +1,33 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Rocky Payload increases Rock-type move damage", s16 damage)
{
u32 move;
u16 ability;
PARAMETRIZE { move = MOVE_TACKLE; ability = ABILITY_BIG_PECKS; }
PARAMETRIZE { move = MOVE_TACKLE; ability = ABILITY_ROCKY_PAYLOAD; }
PARAMETRIZE { move = MOVE_ROCK_THROW; ability = ABILITY_BIG_PECKS; }
PARAMETRIZE { move = MOVE_ROCK_THROW; ability = ABILITY_ROCKY_PAYLOAD; }
PARAMETRIZE { move = MOVE_POWER_GEM; ability = ABILITY_BIG_PECKS; }
PARAMETRIZE { move = MOVE_POWER_GEM; ability = ABILITY_ROCKY_PAYLOAD; }
GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].type != TYPE_ROCK);
ASSUME(gBattleMoves[MOVE_ROCK_THROW].type == TYPE_ROCK);
ASSUME(gBattleMoves[MOVE_POWER_GEM].type == TYPE_ROCK);
ASSUME(gBattleMoves[MOVE_ROCK_THROW].split == SPLIT_PHYSICAL);
ASSUME(gBattleMoves[MOVE_POWER_GEM].split == SPLIT_SPECIAL);
PLAYER(SPECIES_WOBBUFFET) { Ability(ability); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, move); }
} SCENE {
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_EQ(results[0].damage, results[1].damage); // Tackle should be unaffected
EXPECT_MUL_EQ(results[2].damage, Q_4_12(1.5), results[3].damage); // Rock Throw should be affected
EXPECT_MUL_EQ(results[4].damage, Q_4_12(1.5), results[5].damage); // Power Gem should be affected
}
}

View File

@ -0,0 +1,55 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Sap Sipper negates damage from Grass-type moves")
{
GIVEN {
PLAYER(SPECIES_MARILL) { Ability(ABILITY_SAP_SIPPER); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_VINE_WHIP); }
} SCENE {
NONE_OF { HP_BAR(player); }
}
}
SINGLE_BATTLE_TEST("Sap Sipper negates effects from Grass-type moves")
{
GIVEN {
PLAYER(SPECIES_MARILL) { Ability(ABILITY_SAP_SIPPER); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_SPORE); }
} SCENE {
NONE_OF { ANIMATION(ANIM_TYPE_STATUS, B_ANIM_STATUS_SLP, player); }
NONE_OF { STATUS_ICON(player, sleep: TRUE); }
}
}
SINGLE_BATTLE_TEST("Sap Sipper increases Attack by one stage when hit by a Grass-type move")
{
GIVEN {
PLAYER(SPECIES_MARILL) { Ability(ABILITY_SAP_SIPPER); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_VINE_WHIP); }
} SCENE {
ABILITY_POPUP(player, ABILITY_SAP_SIPPER);
ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player);
MESSAGE("Marill's Attack rose!");
}
}
SINGLE_BATTLE_TEST("Sap Sipper does not increase Attack if already maxed")
{
GIVEN {
PLAYER(SPECIES_MARILL) { Ability(ABILITY_SAP_SIPPER); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(1); }
} WHEN {
TURN { MOVE(player, MOVE_BELLY_DRUM); MOVE(opponent, MOVE_VINE_WHIP); }
} SCENE {
ABILITY_POPUP(player, ABILITY_SAP_SIPPER);
NONE_OF { ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); }
NONE_OF { MESSAGE("Marill's Attack rose!"); }
}
}

View File

@ -0,0 +1,33 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Steelworker increases Steel-type move damage", s16 damage)
{
u32 move;
u16 ability;
PARAMETRIZE { move = MOVE_TACKLE; ability = ABILITY_KLUTZ; }
PARAMETRIZE { move = MOVE_TACKLE; ability = ABILITY_STEELWORKER; }
PARAMETRIZE { move = MOVE_ANCHOR_SHOT; ability = ABILITY_KLUTZ; }
PARAMETRIZE { move = MOVE_ANCHOR_SHOT; ability = ABILITY_STEELWORKER; }
PARAMETRIZE { move = MOVE_FLASH_CANNON; ability = ABILITY_KLUTZ; }
PARAMETRIZE { move = MOVE_FLASH_CANNON; ability = ABILITY_STEELWORKER; }
GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].type != TYPE_STEEL);
ASSUME(gBattleMoves[MOVE_ANCHOR_SHOT].type == TYPE_STEEL);
ASSUME(gBattleMoves[MOVE_FLASH_CANNON].type == TYPE_STEEL);
ASSUME(gBattleMoves[MOVE_ANCHOR_SHOT].split == SPLIT_PHYSICAL);
ASSUME(gBattleMoves[MOVE_FLASH_CANNON].split == SPLIT_SPECIAL);
PLAYER(SPECIES_DHELMISE) { Ability(ability); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, move); }
} SCENE {
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_EQ(results[0].damage, results[1].damage); // Tackle should be unaffected
EXPECT_MUL_EQ(results[2].damage, Q_4_12(1.5), results[3].damage); // Anchor Shot should be affected
EXPECT_MUL_EQ(results[4].damage, Q_4_12(1.5), results[5].damage); // Flash Cannon should be affected
}
}

View File

@ -0,0 +1,38 @@
#include "global.h"
#include "test/battle.h"
SINGLE_BATTLE_TEST("Transistor increases Electric-type move damage", s16 damage)
{
u32 move;
u16 ability;
PARAMETRIZE { move = MOVE_TACKLE; ability = ABILITY_KLUTZ; }
PARAMETRIZE { move = MOVE_TACKLE; ability = ABILITY_TRANSISTOR; }
PARAMETRIZE { move = MOVE_WILD_CHARGE; ability = ABILITY_KLUTZ; }
PARAMETRIZE { move = MOVE_WILD_CHARGE; ability = ABILITY_TRANSISTOR; }
PARAMETRIZE { move = MOVE_THUNDER_SHOCK; ability = ABILITY_KLUTZ; }
PARAMETRIZE { move = MOVE_THUNDER_SHOCK; ability = ABILITY_TRANSISTOR; }
GIVEN {
ASSUME(gBattleMoves[MOVE_TACKLE].type != TYPE_ELECTRIC);
ASSUME(gBattleMoves[MOVE_WILD_CHARGE].type == TYPE_ELECTRIC);
ASSUME(gBattleMoves[MOVE_THUNDER_SHOCK].type == TYPE_ELECTRIC);
ASSUME(gBattleMoves[MOVE_WILD_CHARGE].split == SPLIT_PHYSICAL);
ASSUME(gBattleMoves[MOVE_THUNDER_SHOCK].split == SPLIT_SPECIAL);
PLAYER(SPECIES_REGIELEKI) { Ability(ability); }
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(player, move); }
} SCENE {
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_EQ(results[0].damage, results[1].damage); // Tackle should be unaffected
#if B_TRANSISTOR >= GEN_9
EXPECT_MUL_EQ(results[2].damage, Q_4_12(5325 / 4096), results[3].damage); // Wild Charge should be affected
EXPECT_MUL_EQ(results[4].damage, Q_4_12(5325 / 4096), results[5].damage); // Thunder Shock should be affected
#else
EXPECT_MUL_EQ(results[2].damage, Q_4_12(1.5), results[3].damage); // Wild Charge should be affected
EXPECT_MUL_EQ(results[4].damage, Q_4_12(1.5), results[5].damage); // Thunder Shock should be affected
#endif
}
}