From 3a3c24650939a40b568a01376723bf170e559617 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Fri, 16 May 2025 06:09:39 -0400 Subject: [PATCH] Consolidated stat-priority ability tests (#6863) --- test/battle/ability/beast_boost.c | 37 ++++++++++++++-- test/battle/ability/protosynthesis.c | 65 +++++++++------------------- test/battle/ability/quark_drive.c | 65 +++++++++------------------- 3 files changed, 75 insertions(+), 92 deletions(-) diff --git a/test/battle/ability/beast_boost.c b/test/battle/ability/beast_boost.c index 8f823ab3f6..3adb4eb9cd 100644 --- a/test/battle/ability/beast_boost.c +++ b/test/battle/ability/beast_boost.c @@ -57,10 +57,39 @@ SINGLE_BATTLE_TEST("Beast Boost doesn't trigger if user is fainted") } } -TO_DO_BATTLE_TEST("Beast Boost boosts Attack 1st in case of a stat tie"); -TO_DO_BATTLE_TEST("Beast Boost boosts Defense 2nd in case of a stat tie"); -TO_DO_BATTLE_TEST("Beast Boost boosts Special Attack 3rd in case of a stat tie"); -TO_DO_BATTLE_TEST("Beast Boost boosts Special Defense 4th in case of a stat tie"); +SINGLE_BATTLE_TEST("Beast Boost prioritizes stats in the case of a tie in the following order: Atk, Def, Sp.Atk, Sp.Def, Speed") +{ + u8 stats[] = {1, 1, 1, 1, 1}; + + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; stats[0] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; } + GIVEN { + PLAYER(SPECIES_NIHILEGO) { Ability(ABILITY_BEAST_BOOST); Attack(stats[0]); Defense(stats[1]); SpAttack(stats[2]); SpDefense(stats[3]); Speed(stats[4]); } + OPPONENT(SPECIES_WOBBUFFET) { HP(1); Speed(1); } + OPPONENT(SPECIES_WOBBUFFET) { Speed(1); } + } WHEN { + TURN { MOVE(player, MOVE_SCRATCH); SEND_OUT(opponent, 1); } + } SCENE { + ABILITY_POPUP(player, ABILITY_BEAST_BOOST); + switch(i) { + case 0: + MESSAGE("Nihilego's Beast Boost raised its Attack!"); + break; + case 1: + MESSAGE("Nihilego's Beast Boost raised its Defense!"); + break; + case 2: + MESSAGE("Nihilego's Beast Boost raised its Sp. Atk!"); + break; + case 3: + MESSAGE("Nihilego's Beast Boost raised its Sp. Def!"); + break; + } + } +} + TO_DO_BATTLE_TEST("Beast Boost considers Power Split"); TO_DO_BATTLE_TEST("Beast Boost considers Guard Split"); TO_DO_BATTLE_TEST("Beast Boost considers Power Trick"); diff --git a/test/battle/ability/protosynthesis.c b/test/battle/ability/protosynthesis.c index d895879c60..6fd271acb2 100644 --- a/test/battle/ability/protosynthesis.c +++ b/test/battle/ability/protosynthesis.c @@ -100,59 +100,36 @@ SINGLE_BATTLE_TEST("Protosynthesis activates on switch-in") } } -SINGLE_BATTLE_TEST("Protosynthesis boosts Attack 1st in case of a stat tie") +SINGLE_BATTLE_TEST("Protosynthesis prioritizes stats in the case of a tie in the following order: Atk, Def, Sp.Atk, Sp.Def, Speed") { - GIVEN { - PLAYER(SPECIES_GREAT_TUSK) { Ability(ABILITY_PROTOSYNTHESIS); Attack(5); Defense(5); SpAttack(5); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_GROUDON) { Ability(ABILITY_DROUGHT); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_DROUGHT); - ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("Great Tusk's Attack was heightened!"); - } -} + u8 stats[] = {1, 1, 1, 1, 1}; -SINGLE_BATTLE_TEST("Protosynthesis boosts Defense 2nd in case of a stat tie") -{ + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; stats[0] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; } GIVEN { - PLAYER(SPECIES_GREAT_TUSK) { Ability(ABILITY_PROTOSYNTHESIS); Attack(4); Defense(5); SpAttack(5); SpDefense(5); Speed(5); } + PLAYER(SPECIES_GREAT_TUSK) { Ability(ABILITY_PROTOSYNTHESIS); Attack(stats[0]); Defense(stats[1]); SpAttack(stats[2]); SpDefense(stats[3]); Speed(stats[4]); } OPPONENT(SPECIES_GROUDON) { Ability(ABILITY_DROUGHT); Speed(5); } } WHEN { TURN { } } SCENE { ABILITY_POPUP(opponent, ABILITY_DROUGHT); ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("Great Tusk's Defense was heightened!"); - } -} - -SINGLE_BATTLE_TEST("Protosynthesis boosts Special Attack 3rd in case of a stat tie") -{ - GIVEN { - PLAYER(SPECIES_GREAT_TUSK) { Ability(ABILITY_PROTOSYNTHESIS); Attack(4); Defense(4); SpAttack(5); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_GROUDON) { Ability(ABILITY_DROUGHT); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_DROUGHT); - ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("Great Tusk's Sp. Atk was heightened!"); - } -} - -SINGLE_BATTLE_TEST("Protosynthesis boosts Special Defense 4th in case of a stat tie") -{ - GIVEN { - PLAYER(SPECIES_GREAT_TUSK) { Ability(ABILITY_PROTOSYNTHESIS); Attack(4); Defense(4); SpAttack(4); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_GROUDON) { Ability(ABILITY_DROUGHT); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_DROUGHT); - ABILITY_POPUP(player, ABILITY_PROTOSYNTHESIS); - MESSAGE("Great Tusk's Sp. Def was heightened!"); + switch(i) { + case 0: + MESSAGE("Great Tusk's Attack was heightened!"); + break; + case 1: + MESSAGE("Great Tusk's Defense was heightened!"); + break; + case 2: + MESSAGE("Great Tusk's Sp. Atk was heightened!"); + break; + case 3: + MESSAGE("Great Tusk's Sp. Def was heightened!"); + break; + } } } diff --git a/test/battle/ability/quark_drive.c b/test/battle/ability/quark_drive.c index e4850e7001..61a51d3d35 100644 --- a/test/battle/ability/quark_drive.c +++ b/test/battle/ability/quark_drive.c @@ -115,59 +115,36 @@ SINGLE_BATTLE_TEST("Quark Drive activates on Electric Terrain even if not ground } } -SINGLE_BATTLE_TEST("Quark Drive boosts Attack 1st in case of a stat tie") +SINGLE_BATTLE_TEST("Quark Drive prioritizes stats in the case of a tie in the following order: Atk, Def, Sp.Atk, Sp.Def, Speed") { - GIVEN { - PLAYER(SPECIES_IRON_TREADS) { Ability(ABILITY_QUARK_DRIVE); Attack(5); Defense(5); SpAttack(5); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_TAPU_KOKO) { Ability(ABILITY_ELECTRIC_SURGE); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_ELECTRIC_SURGE); - ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); - MESSAGE("Iron Treads's Attack was heightened!"); - } -} + u8 stats[] = {1, 1, 1, 1, 1}; -SINGLE_BATTLE_TEST("Quark Drive boosts Defense 2nd in case of a stat tie") -{ + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; stats[0] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; stats[1] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; stats[2] = 255; } + PARAMETRIZE { stats[4] = 255; stats[3] = 255; } GIVEN { - PLAYER(SPECIES_IRON_TREADS) { Ability(ABILITY_QUARK_DRIVE); Attack(4); Defense(5); SpAttack(5); SpDefense(5); Speed(5); } + PLAYER(SPECIES_IRON_TREADS) { Ability(ABILITY_QUARK_DRIVE); Attack(stats[0]); Defense(stats[1]); SpAttack(stats[2]); SpDefense(stats[3]); Speed(stats[4]); } OPPONENT(SPECIES_TAPU_KOKO) { Ability(ABILITY_ELECTRIC_SURGE); Speed(5); } } WHEN { TURN { } } SCENE { ABILITY_POPUP(opponent, ABILITY_ELECTRIC_SURGE); ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); - MESSAGE("Iron Treads's Defense was heightened!"); - } -} - -SINGLE_BATTLE_TEST("Quark Drive boosts Special Attack 3rd in case of a stat tie") -{ - GIVEN { - PLAYER(SPECIES_IRON_TREADS) { Ability(ABILITY_QUARK_DRIVE); Attack(4); Defense(4); SpAttack(5); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_TAPU_KOKO) { Ability(ABILITY_ELECTRIC_SURGE); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_ELECTRIC_SURGE); - ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); - MESSAGE("Iron Treads's Sp. Atk was heightened!"); - } -} - -SINGLE_BATTLE_TEST("Quark Drive boosts Special Defense 4th in case of a stat tie") -{ - GIVEN { - PLAYER(SPECIES_IRON_TREADS) { Ability(ABILITY_QUARK_DRIVE); Attack(4); Defense(4); SpAttack(4); SpDefense(5); Speed(5); } - OPPONENT(SPECIES_TAPU_KOKO) { Ability(ABILITY_ELECTRIC_SURGE); Speed(5); } - } WHEN { - TURN { } - } SCENE { - ABILITY_POPUP(opponent, ABILITY_ELECTRIC_SURGE); - ABILITY_POPUP(player, ABILITY_QUARK_DRIVE); - MESSAGE("Iron Treads's Sp. Def was heightened!"); + switch(i) { + case 0: + MESSAGE("Iron Treads's Attack was heightened!"); + break; + case 1: + MESSAGE("Iron Treads's Defense was heightened!"); + break; + case 2: + MESSAGE("Iron Treads's Sp. Atk was heightened!"); + break; + case 3: + MESSAGE("Iron Treads's Sp. Def was heightened!"); + break; + } } }