2023-08-11 21:28:38 +01:00
|
|
|
#include "global.h"
|
2023-08-12 21:31:44 +01:00
|
|
|
#include "test/battle.h"
|
2023-08-11 21:28:38 +01:00
|
|
|
|
|
|
|
// From https://bulbapedia.bulbagarden.net/wiki/Damage#Example
|
|
|
|
|
|
|
|
SINGLE_BATTLE_TEST("Damage calculation matches Gen5+")
|
|
|
|
{
|
|
|
|
s16 dmg;
|
|
|
|
s16 expectedDamage;
|
|
|
|
PARAMETRIZE { expectedDamage = 196; }
|
|
|
|
PARAMETRIZE { expectedDamage = 192; }
|
|
|
|
PARAMETRIZE { expectedDamage = 192; }
|
|
|
|
PARAMETRIZE { expectedDamage = 192; }
|
|
|
|
PARAMETRIZE { expectedDamage = 184; }
|
|
|
|
PARAMETRIZE { expectedDamage = 184; }
|
|
|
|
PARAMETRIZE { expectedDamage = 184; }
|
|
|
|
PARAMETRIZE { expectedDamage = 180; }
|
|
|
|
PARAMETRIZE { expectedDamage = 180; }
|
|
|
|
PARAMETRIZE { expectedDamage = 180; }
|
|
|
|
PARAMETRIZE { expectedDamage = 172; }
|
|
|
|
PARAMETRIZE { expectedDamage = 172; }
|
|
|
|
PARAMETRIZE { expectedDamage = 172; }
|
|
|
|
PARAMETRIZE { expectedDamage = 168; }
|
|
|
|
PARAMETRIZE { expectedDamage = 168; }
|
|
|
|
PARAMETRIZE { expectedDamage = 168; }
|
|
|
|
GIVEN {
|
2024-01-29 11:51:32 +00:00
|
|
|
ASSUME(gMovesInfo[MOVE_ICE_FANG].category == DAMAGE_CATEGORY_PHYSICAL);
|
2023-08-11 21:28:38 +01:00
|
|
|
PLAYER(SPECIES_GLACEON) { Level(75); Attack(123); }
|
|
|
|
OPPONENT(SPECIES_GARCHOMP) { Defense(163); }
|
|
|
|
} WHEN {
|
|
|
|
TURN {
|
|
|
|
MOVE(player, MOVE_ICE_FANG, WITH_RNG(RNG_DAMAGE_MODIFIER, i));
|
|
|
|
}
|
|
|
|
}
|
2023-11-21 15:23:22 +00:00
|
|
|
SCENE {
|
2023-08-11 21:28:38 +01:00
|
|
|
MESSAGE("Glaceon used Ice Fang!");
|
|
|
|
HP_BAR(opponent, captureDamage: &dmg);
|
|
|
|
}
|
2023-11-21 15:23:22 +00:00
|
|
|
THEN {
|
2023-08-11 21:28:38 +01:00
|
|
|
EXPECT_EQ(expectedDamage, dmg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SINGLE_BATTLE_TEST("Damage calculation matches Gen5+ (Muscle Band, crit)")
|
|
|
|
{
|
|
|
|
s16 dmg;
|
|
|
|
s16 expectedDamage;
|
|
|
|
PARAMETRIZE { expectedDamage = 324; }
|
|
|
|
PARAMETRIZE { expectedDamage = 316; }
|
|
|
|
PARAMETRIZE { expectedDamage = 312; }
|
|
|
|
PARAMETRIZE { expectedDamage = 312; }
|
|
|
|
PARAMETRIZE { expectedDamage = 304; }
|
|
|
|
PARAMETRIZE { expectedDamage = 304; }
|
|
|
|
PARAMETRIZE { expectedDamage = 300; }
|
|
|
|
PARAMETRIZE { expectedDamage = 300; }
|
|
|
|
PARAMETRIZE { expectedDamage = 292; }
|
|
|
|
PARAMETRIZE { expectedDamage = 292; }
|
|
|
|
PARAMETRIZE { expectedDamage = 288; }
|
|
|
|
PARAMETRIZE { expectedDamage = 288; }
|
|
|
|
PARAMETRIZE { expectedDamage = 280; }
|
|
|
|
PARAMETRIZE { expectedDamage = 276; }
|
|
|
|
PARAMETRIZE { expectedDamage = 276; }
|
|
|
|
PARAMETRIZE { expectedDamage = 268; }
|
|
|
|
GIVEN {
|
2024-01-29 11:51:32 +00:00
|
|
|
ASSUME(gMovesInfo[MOVE_ICE_FANG].category == DAMAGE_CATEGORY_PHYSICAL);
|
2023-08-11 21:28:38 +01:00
|
|
|
PLAYER(SPECIES_GLACEON) { Level(75); Attack(123); Item(ITEM_MUSCLE_BAND); }
|
|
|
|
OPPONENT(SPECIES_GARCHOMP) { Defense(163); }
|
|
|
|
} WHEN {
|
|
|
|
TURN {
|
|
|
|
MOVE(player, MOVE_ICE_FANG, WITH_RNG(RNG_DAMAGE_MODIFIER, i), criticalHit: TRUE);
|
|
|
|
}
|
|
|
|
}
|
2023-11-21 15:23:22 +00:00
|
|
|
SCENE {
|
2023-08-11 21:28:38 +01:00
|
|
|
MESSAGE("Glaceon used Ice Fang!");
|
|
|
|
HP_BAR(opponent, captureDamage: &dmg);
|
|
|
|
}
|
2023-11-21 15:23:22 +00:00
|
|
|
THEN {
|
2023-08-11 21:28:38 +01:00
|
|
|
EXPECT_EQ(expectedDamage, dmg);
|
|
|
|
}
|
|
|
|
}
|
2023-10-13 13:08:44 +01:00
|
|
|
|
|
|
|
SINGLE_BATTLE_TEST("Damage calculation matches Gen5+ (Marshadow vs Mawile)")
|
|
|
|
{
|
|
|
|
s16 dmg;
|
|
|
|
s16 expectedDamage;
|
|
|
|
PARAMETRIZE { expectedDamage = 145; }
|
|
|
|
PARAMETRIZE { expectedDamage = 144; }
|
|
|
|
PARAMETRIZE { expectedDamage = 142; }
|
|
|
|
PARAMETRIZE { expectedDamage = 141; }
|
|
|
|
PARAMETRIZE { expectedDamage = 139; }
|
|
|
|
PARAMETRIZE { expectedDamage = 138; }
|
|
|
|
PARAMETRIZE { expectedDamage = 136; }
|
|
|
|
PARAMETRIZE { expectedDamage = 135; }
|
|
|
|
PARAMETRIZE { expectedDamage = 133; }
|
|
|
|
PARAMETRIZE { expectedDamage = 132; }
|
|
|
|
PARAMETRIZE { expectedDamage = 130; }
|
|
|
|
PARAMETRIZE { expectedDamage = 129; }
|
|
|
|
PARAMETRIZE { expectedDamage = 127; }
|
|
|
|
PARAMETRIZE { expectedDamage = 126; }
|
|
|
|
PARAMETRIZE { expectedDamage = 124; }
|
|
|
|
PARAMETRIZE { expectedDamage = 123; }
|
|
|
|
GIVEN {
|
2024-01-29 11:51:32 +00:00
|
|
|
ASSUME(gMovesInfo[MOVE_SPECTRAL_THIEF].category == DAMAGE_CATEGORY_PHYSICAL);
|
2023-10-13 13:08:44 +01:00
|
|
|
PLAYER(SPECIES_MARSHADOW) { Level(100); Attack(286); }
|
|
|
|
OPPONENT(SPECIES_MAWILE) { Level(100); Defense(226); HP(241); }
|
|
|
|
} WHEN {
|
|
|
|
TURN {
|
|
|
|
MOVE(player, MOVE_SPECTRAL_THIEF, WITH_RNG(RNG_DAMAGE_MODIFIER, i), criticalHit: FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SCENE{
|
|
|
|
MESSAGE("Marshadow used SpectrlThief!");
|
|
|
|
HP_BAR(opponent, captureDamage: &dmg);
|
|
|
|
}
|
|
|
|
THEN{
|
|
|
|
EXPECT_EQ(expectedDamage, dmg);
|
|
|
|
}
|
|
|
|
}
|