sovereignx/test/battle/exp.c
kittenchilly db24128ee3
Update battle messages to Gen 5+ standards (#3240)
Co-authored-by: Eduardo Quezada <eduardo602002@gmail.com>
2024-10-21 14:52:45 -03:00

150 lines
4.4 KiB
C

#include "global.h"
#include "test/battle.h"
#if B_EXP_CATCH >= GEN_6
WILD_BATTLE_TEST("Pokemon gain exp after catching a Pokemon")
{
u8 level = 0;
PARAMETRIZE { level = 50; }
PARAMETRIZE { level = MAX_LEVEL; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Level(level); }
OPPONENT(SPECIES_CATERPIE) { HP(1); }
} WHEN {
TURN { USE_ITEM(player, ITEM_ULTRA_BALL); }
} SCENE {
MESSAGE("You used Ultra Ball!");
ANIMATION(ANIM_TYPE_SPECIAL, B_ANIM_BALL_THROW, player);
if (level != MAX_LEVEL) {
EXPERIENCE_BAR(player);
}
}
}
#endif // B_EXP_CATCH
WILD_BATTLE_TEST("Higher leveled Pokemon give more exp", s32 exp)
{
u8 level = 0;
PARAMETRIZE { level = 5; }
PARAMETRIZE { level = 10; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Level(20); }
OPPONENT(SPECIES_CATERPIE) { Level(level); HP(1); }
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
MESSAGE("Wobbuffet used Tackle!");
MESSAGE("The wild Caterpie fainted!");
EXPERIENCE_BAR(player, captureGainedExp: &results[i].exp);
} FINALLY {
EXPECT_GT(results[1].exp, results[0].exp);
}
}
WILD_BATTLE_TEST("Lucky Egg boosts gained exp points by 50%", s32 exp)
{
u32 item = 0;
PARAMETRIZE { item = ITEM_LUCKY_EGG; }
PARAMETRIZE { item = ITEM_NONE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Level(20); Item(item); }
OPPONENT(SPECIES_CATERPIE) { Level(10); HP(1); }
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
MESSAGE("Wobbuffet used Tackle!");
MESSAGE("The wild Caterpie fainted!");
EXPERIENCE_BAR(player, captureGainedExp: &results[i].exp);
} FINALLY {
EXPECT_MUL_EQ(results[1].exp, Q_4_12(1.5), results[0].exp);
}
}
#if (B_SCALED_EXP == GEN_5 || B_SCALED_EXP >= GEN_7)
WILD_BATTLE_TEST("Exp is scaled to player and opponent's levels", s32 exp)
{
u8 level = 0;
PARAMETRIZE { level = 5; }
PARAMETRIZE { level = 10; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Level(level); }
OPPONENT(SPECIES_CATERPIE) { Level(5); HP(1); }
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
MESSAGE("Wobbuffet used Tackle!");
MESSAGE("The wild Caterpie fainted!");
EXPERIENCE_BAR(player, captureGainedExp: &results[i].exp);
} FINALLY {
EXPECT_GT(results[0].exp, results[1].exp);
}
}
#endif
WILD_BATTLE_TEST("Large exp gains are supported", s32 exp) // #1455
{
u8 level = 0;
PARAMETRIZE { level = 10; }
PARAMETRIZE { level = 50; }
PARAMETRIZE { level = MAX_LEVEL; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Level(1); Item(ITEM_LUCKY_EGG); OTName("Test"); } // OT Name is different so it gets more exp as a traded mon
OPPONENT(SPECIES_BLISSEY) { Level(level); HP(1); }
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
MESSAGE("Wobbuffet used Tackle!");
MESSAGE("The wild Blissey fainted!");
EXPERIENCE_BAR(player, captureGainedExp: &results[i].exp);
} THEN {
EXPECT(GetMonData(&gPlayerParty[0], MON_DATA_LEVEL) > 1);
EXPECT(GetMonData(&gPlayerParty[0], MON_DATA_EXP) > 1);
} FINALLY {
EXPECT_GT(results[1].exp, results[0].exp);
EXPECT_GT(results[2].exp, results[1].exp);
}
}
#if I_EXP_SHARE_ITEM < GEN_6
WILD_BATTLE_TEST("Exp Share(held) gives Experience to mons which did not participate in battle")
{
u32 item = 0;
PARAMETRIZE { item = ITEM_NONE; }
PARAMETRIZE { item = ITEM_EXP_SHARE; }
GIVEN {
PLAYER(SPECIES_WOBBUFFET);
PLAYER(SPECIES_WYNAUT) { Level(40); Item(item); }
OPPONENT(SPECIES_CATERPIE) { Level(10); HP(1); }
} WHEN {
TURN { MOVE(player, MOVE_TACKLE); }
} SCENE {
MESSAGE("Wobbuffet used Tackle!");
MESSAGE("The wild Caterpie fainted!");
// This message should appear only for gen6> exp share.
NOT MESSAGE("The rest of your team gained EXP. Points thanks to the Exp. Share!");
} THEN {
if (item == ITEM_EXP_SHARE)
EXPECT_GT(GetMonData(&gPlayerParty[1], MON_DATA_EXP), gExperienceTables[gSpeciesInfo[SPECIES_WYNAUT].growthRate][40]);
else
EXPECT_EQ(GetMonData(&gPlayerParty[1], MON_DATA_EXP), gExperienceTables[gSpeciesInfo[SPECIES_WYNAUT].growthRate][40]);
}
}
#endif // I_EXP_SHARE_ITEM