From 1cc28c89ef6b23bb37555e40d02839684dc80a91 Mon Sep 17 00:00:00 2001 From: CallmeEchoo Date: Fri, 21 Apr 2023 20:36:41 +0200 Subject: [PATCH] X item tests --- test/item_effect_increase_stat.c | 125 ++++++++++++++++++++++++++++++- 1 file changed, 124 insertions(+), 1 deletion(-) diff --git a/test/item_effect_increase_stat.c b/test/item_effect_increase_stat.c index b459e3ac8..7fcbe7279 100644 --- a/test/item_effect_increase_stat.c +++ b/test/item_effect_increase_stat.c @@ -1,7 +1,7 @@ #include "global.h" #include "test_battle.h" -SINGLE_BATTLE_TEST("X-Attack sharply raises battler's Attack stat", s16 damage) +SINGLE_BATTLE_TEST("X Attack sharply raises battler's Attack stat", s16 damage) { u16 useItem; PARAMETRIZE { useItem = FALSE; } @@ -23,3 +23,126 @@ SINGLE_BATTLE_TEST("X-Attack sharply raises battler's Attack stat", s16 damage) EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); } } + +SINGLE_BATTLE_TEST("X Defense sharply raises battler's Defense stat", s16 damage) +{ + u16 useItem; + PARAMETRIZE { useItem = FALSE; } + PARAMETRIZE { useItem = TRUE; } + GIVEN { + ASSUME(gItems[ITEM_X_DEFENSE].battleUsage == EFFECT_ITEM_INCREASE_STAT); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + if (useItem) TURN { USE_ITEM(player, ITEM_X_DEFENSE); } + TURN { MOVE(opponent, MOVE_TACKLE); } + } SCENE { + MESSAGE("Foe Wobbuffet used Tackle!"); + HP_BAR(player, captureDamage: &results[i].damage); + } FINALLY { + if (B_X_ITEMS_BUFF >= GEN_7) + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + else + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.66), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("X Sp. Atk sharply raises battler's Sp. Attack stat", s16 damage) +{ + u16 useItem; + PARAMETRIZE { useItem = FALSE; } + PARAMETRIZE { useItem = TRUE; } + GIVEN { + ASSUME(gItems[ITEM_X_SP_ATK].battleUsage == EFFECT_ITEM_INCREASE_STAT); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + if (useItem) TURN { USE_ITEM(player, ITEM_X_SP_ATK); } + TURN { MOVE(player, MOVE_DISARMING_VOICE); } + } SCENE { + MESSAGE("Wobbuffet used DisrmngVoice!"); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + if (B_X_ITEMS_BUFF >= GEN_7) + EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.0), results[1].damage); + else + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.5), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("X Sp. Def sharply raises battler's Sp. Defense stat", s16 damage) +{ + u16 useItem; + PARAMETRIZE { useItem = FALSE; } + PARAMETRIZE { useItem = TRUE; } + GIVEN { + ASSUME(gItems[ITEM_X_SP_DEF].battleUsage == EFFECT_ITEM_INCREASE_STAT); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + if (useItem) TURN { USE_ITEM(player, ITEM_X_SP_DEF); } + TURN { MOVE(opponent, MOVE_DISARMING_VOICE); } + } SCENE { + MESSAGE("Foe Wobbuffet used DisrmngVoice!"); + HP_BAR(player, captureDamage: &results[i].damage); + } FINALLY { + if (B_X_ITEMS_BUFF >= GEN_7) + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.5), results[1].damage); + else + EXPECT_MUL_EQ(results[0].damage, Q_4_12(0.66), results[1].damage); + } +} + +SINGLE_BATTLE_TEST("X Speed sharply raises battler's Speed stat", s16 damage) +{ + u16 useItem; + PARAMETRIZE { useItem = FALSE; } + PARAMETRIZE { useItem = TRUE; } + GIVEN { + ASSUME(gItems[ITEM_X_SPEED].battleUsage == EFFECT_ITEM_INCREASE_STAT); + if (B_X_ITEMS_BUFF >= GEN_7) + { + PLAYER(SPECIES_WOBBUFFET) { Speed(3); }; + OPPONENT(SPECIES_WOBBUFFET) { Speed(4); }; + } + else + { + PLAYER(SPECIES_WOBBUFFET) { Speed(4); }; + OPPONENT(SPECIES_WOBBUFFET) { Speed(5); }; + } + } WHEN { + if (useItem) TURN { USE_ITEM(player, ITEM_X_SPEED); } + TURN { MOVE(player, MOVE_TACKLE); MOVE(opponent, MOVE_TACKLE); } + } SCENE { + if (useItem) + { + MESSAGE("Wobbuffet used Tackle!"); + MESSAGE("Foe Wobbuffet used Tackle!"); + } else + { + MESSAGE("Foe Wobbuffet used Tackle!"); + MESSAGE("Wobbuffet used Tackle!"); + } + } +} + +SINGLE_BATTLE_TEST("X Accuracy sharply raises battler's Accuracy stat", s16 damage) +{ + + ASSUME(gBattleMoves[MOVE_SING].accuracy == 55); + if (B_X_ITEMS_BUFF >= GEN_7) + PASSES_RANDOMLY(gBattleMoves[MOVE_SING].accuracy * 5 / 3, 100, RNG_ACCURACY); + else + PASSES_RANDOMLY(gBattleMoves[MOVE_SING].accuracy * 4 / 3, 100, RNG_ACCURACY); + GIVEN { + ASSUME(gItems[ITEM_X_ACCURACY].battleUsage == EFFECT_ITEM_INCREASE_STAT); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { USE_ITEM(player, ITEM_X_ACCURACY); } + TURN { MOVE(player, MOVE_SING); } + } SCENE { + MESSAGE("Wobbuffet used Sing!"); + MESSAGE("Foe Wobbuffet fell asleep!"); + } +}