From 2fed75f7c5a1d9744b5f7815f5cf6c6a014be4ac Mon Sep 17 00:00:00 2001 From: kittenchilly Date: Sat, 24 Aug 2024 09:53:19 -0500 Subject: [PATCH] Adaptability, Aerilate, Aftermath tests (#5242) * Adaptability, Aerilate, Aftermath tests * Update test/battle/ability/aerilate.c Co-authored-by: Eduardo Quezada --------- Co-authored-by: Eduardo Quezada --- 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 ad7f877fd9..4165dea20d 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 fecdc6b7e2..4c1c8439b7 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 8a5f889a66..4386034a59 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; } TODO: handle this case via Skill Swap + 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 65c0be7dfd..5cfd5ef034 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); + } +}