Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptability, Aerilate, Aftermath tests #5242

Merged
merged 2 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/battle_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
20 changes: 19 additions & 1 deletion test/battle/ability/adaptability.c
Original file line number Diff line number Diff line change
@@ -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)
{
Expand Down
25 changes: 24 additions & 1 deletion test/battle/ability/aerilate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)");

Expand Down
20 changes: 19 additions & 1 deletion test/battle/ability/aftermath.c
Original file line number Diff line number Diff line change
@@ -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);
}
}
Loading