From 9be9863e529940dd6d0b75934ce1924243f3e075 Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Thu, 22 Aug 2024 11:17:28 -0500 Subject: [PATCH 1/2] Adaptability, Aerilate, Aftermath tests --- src/battle_main.c | 4 +++- test/battle/ability/adaptability.c | 20 +++++++++++++++++++- test/battle/ability/aerilate.c | 25 ++++++++++++++++++++++++- test/battle/ability/aftermath.c | 20 +++++++++++++++++++- 4 files changed, 65 insertions(+), 4 deletions(-) diff --git a/src/battle_main.c b/src/battle_main.c index cba22fa5ef91..3f99e79a45b9 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -5746,8 +5746,10 @@ bool32 TrySetAteType(u32 move, u32 battlerAtk, u32 attackerAbility) break; case EFFECT_HIDDEN_POWER: case EFFECT_WEATHER_BALL: - case EFFECT_CHANGE_TYPE_ON_ITEM: case EFFECT_NATURAL_GIFT: + case EFFECT_CHANGE_TYPE_ON_ITEM: + case EFFECT_REVELATION_DANCE: + case EFFECT_TERRAIN_PULSE: return FALSE; } diff --git a/test/battle/ability/adaptability.c b/test/battle/ability/adaptability.c index fecdc6b7e26f..4c1c8439b7d5 100644 --- a/test/battle/ability/adaptability.c +++ b/test/battle/ability/adaptability.c @@ -1,7 +1,25 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("Adaptability increases same-type attack bonus from x1.5 to x2"); +SINGLE_BATTLE_TEST("Adaptability increases same-type attack bonus from x1.5 to x2", s16 damage) +{ + u32 ability; + PARAMETRIZE { ability = ABILITY_HYPER_CUTTER; } + PARAMETRIZE { ability = ABILITY_ADAPTABILITY; } + GIVEN { + PLAYER(SPECIES_CRAWDAUNT) { Ability(ability); } + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_WATER_GUN); } + } SCENE { + MESSAGE("Crawdaunt used Water Gun!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_WATER_GUN, player); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + // The jump from 1.5x STAB to 2.0x STAB is a 1.33x boost. + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.33), results[1].damage); + } +} SINGLE_BATTLE_TEST("(TERA) Terastallizing into a different type with Adaptability gives 2.0x STAB", s16 damage) { diff --git a/test/battle/ability/aerilate.c b/test/battle/ability/aerilate.c index 8a5f889a662a..c68f354f1d74 100644 --- a/test/battle/ability/aerilate.c +++ b/test/battle/ability/aerilate.c @@ -21,7 +21,30 @@ SINGLE_BATTLE_TEST("Aerilate turns a Normal-type move into Flying-type move") } } -TO_DO_BATTLE_TEST("Aerilate can not turn certain moves into Flying type moves"); +SINGLE_BATTLE_TEST("Aerilate can not turn certain moves into Flying type moves") +{ + u32 move; + PARAMETRIZE { move = MOVE_WEATHER_BALL; } + // PARAMETRIZE { move = MOVE_NATURAL_GIFT; } can't hold berry + PARAMETRIZE { move = MOVE_JUDGMENT; } + PARAMETRIZE { move = MOVE_TECHNO_BLAST; } + PARAMETRIZE { move = MOVE_REVELATION_DANCE; } + PARAMETRIZE { move = MOVE_MULTI_ATTACK; } + PARAMETRIZE { move = MOVE_TERRAIN_PULSE; } + GIVEN { + PLAYER(SPECIES_MEGANIUM); + OPPONENT(SPECIES_SALAMENCE) { Item(ITEM_SALAMENCITE); } + } WHEN { + TURN { MOVE(opponent, move, gimmick: GIMMICK_MEGA); } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_MEGA_EVOLUTION, opponent); + ANIMATION(ANIM_TYPE_MOVE, move, opponent); + NONE_OF { + MESSAGE("It's super effective!"); + } + } +} + TO_DO_BATTLE_TEST("Aerilate boosts power of affected moves by 20% (Gen7+)"); TO_DO_BATTLE_TEST("Aerilate boosts power of affected moves by 30% (Gen6)"); diff --git a/test/battle/ability/aftermath.c b/test/battle/ability/aftermath.c index 65c0be7dfd2f..5cfd5ef0342d 100644 --- a/test/battle/ability/aftermath.c +++ b/test/battle/ability/aftermath.c @@ -1,4 +1,22 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("Aftermath damages the attacker by 1/4th of its max HP if they faint the target has this ability by a contact move"); +SINGLE_BATTLE_TEST("Aftermath damages the attacker by 1/4th of its max HP if fainted by a contact move") +{ + s16 aftermathDamage; + + GIVEN { + PLAYER(SPECIES_VOLTORB) { HP(1); Ability(ABILITY_AFTERMATH); }; + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN {MOVE(opponent, MOVE_TACKLE);} + } SCENE { + MESSAGE("Foe Wobbuffet used Tackle!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_TACKLE, opponent); + MESSAGE("Voltorb fainted!"); + ABILITY_POPUP(player, ABILITY_AFTERMATH); + HP_BAR(opponent, captureDamage: &aftermathDamage); + } THEN { + EXPECT_EQ(aftermathDamage, opponent->maxHP / 4); + } +} From 001360621c72ff8e46fb3a4c6384da55f110f66a Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Thu, 22 Aug 2024 16:56:01 -0500 Subject: [PATCH 2/2] Update test/battle/ability/aerilate.c Co-authored-by: Eduardo Quezada --- test/battle/ability/aerilate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/battle/ability/aerilate.c b/test/battle/ability/aerilate.c index c68f354f1d74..4386034a59f1 100644 --- a/test/battle/ability/aerilate.c +++ b/test/battle/ability/aerilate.c @@ -25,7 +25,7 @@ SINGLE_BATTLE_TEST("Aerilate can not turn certain moves into Flying type moves") { u32 move; PARAMETRIZE { move = MOVE_WEATHER_BALL; } - // PARAMETRIZE { move = MOVE_NATURAL_GIFT; } can't hold berry + // PARAMETRIZE { move = MOVE_NATURAL_GIFT; } TODO: handle this case via Skill Swap PARAMETRIZE { move = MOVE_JUDGMENT; } PARAMETRIZE { move = MOVE_TECHNO_BLAST; } PARAMETRIZE { move = MOVE_REVELATION_DANCE; }