Skip to content

Commit

Permalink
Added missing Move Effect TODO tests - Volume B (#4682)
Browse files Browse the repository at this point in the history
* Added missing Move Effect TODO tests - Volume B

* Apply suggestions from code review

Co-authored-by: Alex <[email protected]>

* Removed unused bulldoze effect file

* Removed individual tests for Baton Pass + Status1 in favor of the existing single test

---------

Co-authored-by: Alex <[email protected]>
  • Loading branch information
AsparagusEduardo and AlexOn1ine authored Jun 1, 2024
1 parent 0ed8d09 commit 0a8284c
Show file tree
Hide file tree
Showing 27 changed files with 357 additions and 51 deletions.
1 change: 1 addition & 0 deletions src/battle_ai_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4042,6 +4042,7 @@ static u32 AI_CalcMoveEffectScore(u32 battlerAtk, u32 battlerDef, u32 move)
ADJUST_SCORE(WEAK_EFFECT); // Recycle healing berry if we can't otherwise faint the target and the target wont kill us after we activate the berry
}
break;
case EFFECT_RAGING_BULL:
case EFFECT_BRICK_BREAK:
if (gSideStatuses[GetBattlerSide(battlerDef)] & SIDE_STATUS_REFLECT)
ADJUST_SCORE(DECENT_EFFECT);
Expand Down
4 changes: 3 additions & 1 deletion src/battle_ai_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -2976,7 +2976,9 @@ bool32 ShouldSetScreen(u32 battlerAtk, u32 battlerDef, u32 moveEffect)
{
u32 atkSide = GetBattlerSide(battlerAtk);

if (HasMoveEffect(battlerDef, EFFECT_BRICK_BREAK)) // Don't waste a turn if screens will be broken
// Don't waste a turn if screens will be broken
if (HasMoveEffect(battlerDef, EFFECT_BRICK_BREAK)
|| HasMoveEffect(battlerDef, EFFECT_RAGING_BULL))
return FALSE;

switch (moveEffect)
Expand Down
2 changes: 1 addition & 1 deletion test/battle/move_effect/aqua_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

TO_DO_BATTLE_TEST("Aqua Ring recovers 1/16th HP at end of turn");
TO_DO_BATTLE_TEST("Aqua Ring can be used under Heal Block but will not heal the user");
TO_DO_BATTLE_TEST("Aqua Ring can be Baton Passed");
TO_DO_BATTLE_TEST("Baton Pass passes Aqua Ring's effect");
6 changes: 6 additions & 0 deletions test/battle/move_effect/baddy_bad.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "global.h"
#include "test/battle.h"

TO_DO_BATTLE_TEST("Baddy Bad sets up Reflect, reducing physical damage");
TO_DO_BATTLE_TEST("Baddy Bad's Reflect lasts for 5 turns");
TO_DO_BATTLE_TEST("Baddy Bad can still damage the target when Reflect is already set up");
54 changes: 54 additions & 0 deletions test/battle/move_effect/baton_pass.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "global.h"
#include "test/battle.h"

TO_DO_BATTLE_TEST("Baton Pass switches out the user");
TO_DO_BATTLE_TEST("Baton Pass fails if there's no valid party Pokémon left");
TO_DO_BATTLE_TEST("Baton Pass passes both positive and negative stat changes");
TO_DO_BATTLE_TEST("AI doesn't choose Baton Pass if the Ace Pokémon is the last one available to switch in");
TO_DO_BATTLE_TEST("Baton Pass doesn't pass non-volatile status conditions"); // Status1
TO_DO_BATTLE_TEST("Baton Pass doesn't pass infatuation");
TO_DO_BATTLE_TEST("Baton Pass doesn't pass type changes");
TO_DO_BATTLE_TEST("Baton Pass doesn't pass ability changes");

//
// Move these to the corresponding effect files.
//
TO_DO_BATTLE_TEST("Baton Pass passes confusion status"); // test/battle/status2/confusion.c

TO_DO_BATTLE_TEST("Baton Pass passes Cursed status"); // test/battle/move_effect/curse.c
TO_DO_BATTLE_TEST("Baton Pass doesn't pass Disable's effect"); // test/battle/move_effect/disable.c
TO_DO_BATTLE_TEST("Baton Pass passes Dragon Cheer's effect"); // test/battle/move_effect/dragon_cheer.c
TO_DO_BATTLE_TEST("Baton Pass passes Fairy lock's escape prevention effect"); // test/battle/move_effect/fairy_lock.c
TO_DO_BATTLE_TEST("Baton Pass passes Focus Energy's effect"); // test/battle/move_effect/focus_energy.c
TO_DO_BATTLE_TEST("Baton Pass passes Heal Block's effect"); // test/battle/move_effect/heal_block.c
TO_DO_BATTLE_TEST("Baton Pass doesn't pass Imprison's effect"); // test/battle/move_effect/imprison.c
TO_DO_BATTLE_TEST("Baton Pass passes Ingrain's effect"); // test/battle/move_effect/ingrain.c
TO_DO_BATTLE_TEST("Baton Pass passes Magnet Rise's effect"); // test/battle/move_effect/magnet_rise.c
TO_DO_BATTLE_TEST("Baton Pass passes escape prevention primary effect if it's used by the target"); // test/battle/move_effect/mean_look.c (Spider Web, Mean Look, Block)
TO_DO_BATTLE_TEST("Baton Pass doesn't pass escape prevention primary effects if it's used by the user"); // test/battle/move_effect/mean_look.c (Spider Web, Mean Look, Block)
TO_DO_BATTLE_TEST("Baton Pass doesn't pass Mimic's learnt move"); // test/battle/move_effect/mimic.c
TO_DO_BATTLE_TEST("Baton Pass passes Minimize's evasion but not the weakness to stomping moves"); // test/battle/move_effect/minimize.c
TO_DO_BATTLE_TEST("Baton Pass passes No Retreat's escape prevention effect"); // test/battle/move_effect/no_retreat.c
TO_DO_BATTLE_TEST("Baton Pass passes Octolock's escape prevention effect"); // test/battle/move_effect/octolock.c
TO_DO_BATTLE_TEST("Baton Pass passes Perish Song's effect"); // test/battle/move_effect/perish_song.c
TO_DO_BATTLE_TEST("Baton Pass passes Power Trick's effect"); // test/battle/move_effect/power_trick.c
TO_DO_BATTLE_TEST("Baton Pass doesn't pass Rollout's multiplier"); // test/battle/move_effect/rollout.c
TO_DO_BATTLE_TEST("Baton Pass passes Sappy Seed's effect"); // test/battle/move_effect/sappy_seed.c
TO_DO_BATTLE_TEST("Baton Pass doesn't pass Transformations"); // test/battle/move_effect/transform.c
TO_DO_BATTLE_TEST("Baton Pass doesn't pass Yawn's effect"); // test/battle/move_effect/yawn.c

TO_DO_BATTLE_TEST("Baton Pass passes Core Enforcer's effect"); // test/battle/move_effect_secondary/core_enforcer.c
TO_DO_BATTLE_TEST("Baton Pass passes escape prevention secondary effect"); // test/battle/move_effect_secondary/prevent_escape.c (Thousand Waves, Spirit Shackle, Anchor Shot)
TO_DO_BATTLE_TEST("Baton Pass doesn't pass escape prevention secondary effect if it's used by the user"); // test/battle/move_effect_secondary/prevent_escape.c (Thousand Waves, Spirit Shackle, Anchor Shot)

// Unconfirmed by Bulbapedia, should be tested in-game:
// - Nightmare
// - Encore
// - Spotlight
// - Taunt
// - Throat Chop
// - Torment
// - Splinters
// - Power Boost
// - Power Drop
// - Guard Boost
3 changes: 3 additions & 0 deletions test/battle/move_effect/beak_blast.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,6 @@ SINGLE_BATTLE_TEST("Beak Blast burns only when contact moves are used")
HP_BAR(opponent);
}
}

TO_DO_BATTLE_TEST("Beak Blast's charging message is shown regardless if it would've missed");
TO_DO_BATTLE_TEST("Bulletproof is immune to Beak Blast but not to the burn it causes");
31 changes: 31 additions & 0 deletions test/battle/move_effect/beat_up.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "global.h"
#include "test/battle.h"

// General
TO_DO_BATTLE_TEST("Beat Up hits the target for each non-fainted, non-statused member in the party");
TO_DO_BATTLE_TEST("Beat Up's strikes have each an independent chance of a critical hit");

// B_BEAT_UP Gen2-4
TO_DO_BATTLE_TEST("Beat Up lists each party member's name");
TO_DO_BATTLE_TEST("Beat Up's damage is typeless");
TO_DO_BATTLE_TEST("Beat Up's damage doesn't consider STAB");
TO_DO_BATTLE_TEST("Beat Up's last strike-only can trigger King's Rock");
TO_DO_BATTLE_TEST("Beat Up's base power is the same for each strike");
TO_DO_BATTLE_TEST("Beat Up's damage is determined by each striking Pokémon's base attack and level and the target's defense");
TO_DO_BATTLE_TEST("Beat Up ignores stat stage changes"); //eg. Swords Dance
TO_DO_BATTLE_TEST("Beat Up ignores Huge Power");
TO_DO_BATTLE_TEST("Beat Up ignores Choice Band");

// B_BEAT_UP Gen5+
TO_DO_BATTLE_TEST("Beat Up doesn't list party member's name");
TO_DO_BATTLE_TEST("Beat Up's damage is Dark-typed");
TO_DO_BATTLE_TEST("Beat Up's damage receives STAB");
TO_DO_BATTLE_TEST("Beat Up's can trigger King's Rock on all strikes");
TO_DO_BATTLE_TEST("Beat Up's base power is determined by each striking Pokémon");
TO_DO_BATTLE_TEST("Beat Up's damage is determined by the user's attack and the target's defense");
TO_DO_BATTLE_TEST("Beat Up's damage considers stat stage changes"); //eg. Swords Dance
TO_DO_BATTLE_TEST("Beat Up's damage considers Huge Power");
TO_DO_BATTLE_TEST("Beat Up's damage considers Choice Band");

// Unconfirmed by Bulbapedia
// - Technician interacion
6 changes: 6 additions & 0 deletions test/battle/move_effect/belch.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ SINGLE_BATTLE_TEST("Belch cannot be used if the user has not eaten a berry")
else {
TURN { MOVE(player, MOVE_STUFF_CHEEKS); }
TURN { MOVE(player, MOVE_BELCH); }
TURN { MOVE(player, MOVE_BELCH); }
}
} SCENE {
if (item == ITEM_NONE) {
Expand All @@ -47,6 +48,11 @@ SINGLE_BATTLE_TEST("Belch cannot be used if the user has not eaten a berry")
else {
ANIMATION(ANIM_TYPE_MOVE, MOVE_STUFF_CHEEKS, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_BELCH, player);
ANIMATION(ANIM_TYPE_MOVE, MOVE_BELCH, player);
}
}
}

TO_DO_BATTLE_TEST("Belch can still be used after switching out");
TO_DO_BATTLE_TEST("Belch can still be used after fainting");
TO_DO_BATTLE_TEST("Belch can still be used after restoring the consumed berry");
5 changes: 5 additions & 0 deletions test/battle/move_effect/belly_drum.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,8 @@ SINGLE_BATTLE_TEST("Belly Drum's HP cost doesn't trigger effects that trigger on
NOT MESSAGE("Wobbuffet's Air Balloon popped!");
}
}

TO_DO_BATTLE_TEST("Belly Drum maximizes the user's Attack stat, even when below 0");
TO_DO_BATTLE_TEST("Belly Drum minimizes the user's Attack stat if it has Contrary"); // Should still say "maximized attack"
TO_DO_BATTLE_TEST("Belly Drum fails if the user's Attack is already at +6, even with Contrary");
TO_DO_BATTLE_TEST("Belly Drum deducts HP if the user has contrary and is at -6");
10 changes: 10 additions & 0 deletions test/battle/move_effect/bestow.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "global.h"
#include "test/battle.h"

TO_DO_BATTLE_TEST("Bestow transfers its held item to the target");
TO_DO_BATTLE_TEST("Bestow fails if the user has no held item");
TO_DO_BATTLE_TEST("Bestow fails if the target already has a held item");
TO_DO_BATTLE_TEST("Bestow fails if the target is behind a Substitute");
TO_DO_BATTLE_TEST("Bestow fails if the user is holding Mail");
TO_DO_BATTLE_TEST("Bestow fails if the user's held item changes its form");
TO_DO_BATTLE_TEST("Bestow fails if the user's held item is a Z-Crystal");
3 changes: 3 additions & 0 deletions test/battle/move_effect/bide.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ SINGLE_BATTLE_TEST("Bide deals twice the taken damage over two turns")
EXPECT_EQ(bideDamage, 2 * (damage1 + damage2));
}
}

TO_DO_BATTLE_TEST("Bide hits the last Pokémon that attacked the user, even allies");
TO_DO_BATTLE_TEST("Bide has +1 priority if called via a different move"); // Gen 5 onwards
4 changes: 4 additions & 0 deletions test/battle/move_effect/blizzard.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "global.h"
#include "test/battle.h"

TO_DO_BATTLE_TEST("Blizzard ignores accuracy check durin Hail and Snow");
12 changes: 12 additions & 0 deletions test/battle/move_effect/body_press.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "global.h"
#include "test/battle.h"

TO_DO_BATTLE_TEST("Body Press's damage depends on the user's base Defense instead of its base Attack");
TO_DO_BATTLE_TEST("Body Press's damage depends on the user's Defense stat stages");

// Could be split into multiple tests or maybe to separate files based on the modifier?
TO_DO_BATTLE_TEST("Body Press's damage is influenced by all other Attack modifiers that are not stat stages");
TO_DO_BATTLE_TEST("Body Press's damage is NOT influenced by any other Defense besides stat stages");

// Unconfirmed by Bulbapedia:
// - Defeatist interaction
5 changes: 5 additions & 0 deletions test/battle/move_effect/bolt_beak.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "global.h"
#include "test/battle.h"

TO_DO_BATTLE_TEST("Bolt Beak's base power is doubled if it attacks before the target");
TO_DO_BATTLE_TEST("Bolt Beak's base power is doubled the target switches out");
21 changes: 0 additions & 21 deletions test/battle/move_effect/brick_break.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,24 +137,3 @@ DOUBLE_BATTLE_TEST("Brick Break can remove Light Screen, Reflect and Aurora Veil
HP_BAR(playerLeft);
}
}

SINGLE_BATTLE_TEST("Move Raging Bull changes it's type depending on the Tauros Form")
{
u16 speciesPlayer;
u16 speciesOpponent;

PARAMETRIZE { speciesPlayer = SPECIES_TAUROS_PALDEAN_COMBAT_BREED; speciesOpponent = SPECIES_CHARIZARD; }
PARAMETRIZE { speciesPlayer = SPECIES_TAUROS_PALDEAN_BLAZE_BREED; speciesOpponent = SPECIES_BLASTOISE; }
PARAMETRIZE { speciesPlayer = SPECIES_TAUROS_PALDEAN_AQUA_BREED; speciesOpponent = SPECIES_VENUSAUR; }

GIVEN {
PLAYER(speciesPlayer);
OPPONENT(speciesOpponent);
} WHEN {
TURN { MOVE(player, MOVE_RAGING_BULL); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, MOVE_RAGING_BULL, player);
HP_BAR(opponent);
MESSAGE("It's not very effective…");
}
}
4 changes: 4 additions & 0 deletions test/battle/move_effect/brine.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "global.h"
#include "test/battle.h"

TO_DO_BATTLE_TEST("Brine's power doubles if the target is at 50% or below max HP");
4 changes: 4 additions & 0 deletions test/battle/move_effect/bulk_up.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#include "global.h"
#include "test/battle.h"

TO_DO_BATTLE_TEST("Bulk Up increases the user's Attack and Defense");
28 changes: 28 additions & 0 deletions test/battle/move_effect/earthquake.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "global.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Earthquake's and Bulldoze's damage is halved when Grassy Terrain is in effect", s16 damage)
{
bool32 terrain;
u16 move;
PARAMETRIZE { terrain = FALSE; move = MOVE_EARTHQUAKE; } // 0
PARAMETRIZE { terrain = TRUE; move = MOVE_EARTHQUAKE; } // 1
PARAMETRIZE { terrain = FALSE; move = MOVE_BULLDOZE; } // 2
PARAMETRIZE { terrain = TRUE; move = MOVE_BULLDOZE; } // 3
GIVEN {
ASSUME(gMovesInfo[MOVE_EARTHQUAKE].effect == EFFECT_EARTHQUAKE);
ASSUME(gMovesInfo[MOVE_BULLDOZE].effect == EFFECT_EARTHQUAKE);
PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
if (terrain)
TURN { MOVE(player, MOVE_GRASSY_TERRAIN); }
TURN { MOVE(player, move); }
} SCENE {
ANIMATION(ANIM_TYPE_MOVE, move, player);
HP_BAR(opponent, captureDamage: &results[i].damage);
} FINALLY {
EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage);
EXPECT_MUL_EQ(results[2].damage, Q_4_12(0.5), results[3].damage);
}
}
2 changes: 1 addition & 1 deletion test/battle/move_effect/embargo.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ SINGLE_BATTLE_TEST("Embargo doesn't stop an item flung at an affected target fro
}
}

SINGLE_BATTLE_TEST("Embargo is passed via Baton Pass")
SINGLE_BATTLE_TEST("Baton Pass passes Embargo's effect")
{
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
Expand Down
3 changes: 3 additions & 0 deletions test/battle/move_effect/gastro_acid.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ SINGLE_BATTLE_TEST("Gastro Acid fails if target has a banned ability")
MESSAGE("But it failed!");
}
}

TO_DO_BATTLE_TEST("Baton Pass passes Gastro Acid's effect");
TO_DO_BATTLE_TEST("Baton Pass removes Gastro Acid if its ability cannot be surpressed");
1 change: 1 addition & 0 deletions test/battle/move_effect/leech_seed.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ TO_DO_BATTLE_TEST("Leech Seed doesn't affect already seeded targets")
TO_DO_BATTLE_TEST("Leech Seeded targets lose 1/8 of its max HP every turn and give it to the user")
TO_DO_BATTLE_TEST("Leech Seed's effect is paused until a new battler replaces the original user's position") // Faint, can't be replaced, then revived.
TO_DO_BATTLE_TEST("Leech Seed's effect pause still prevents it from being seeded again")
TO_DO_BATTLE_TEST("Baton Pass passes Leech Seed's effect");
2 changes: 2 additions & 0 deletions test/battle/move_effect/pursuit.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ SINGLE_BATTLE_TEST("Pursuited mon correctly switches out after it got hit and ac
MESSAGE("Go! Wobbuffet!");
}
}

TO_DO_BATTLE_TEST("Baton Pass doesn't cause Pursuit to increase its power or priority");
Loading

0 comments on commit 0a8284c

Please sign in to comment.