From 68aa18d0cb30aac1f0061bc4dae5a4f75751f566 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Sun, 14 Dec 2025 18:11:22 -0300 Subject: [PATCH] `B_SYMBIOSIS_GEMS` tests (#8534) --- include/constants/generational_changes.h | 2 +- src/battle_script_commands.c | 4 +-- test/battle/ability/symbiosis.c | 46 ++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/include/constants/generational_changes.h b/include/constants/generational_changes.h index 1926c5b1f7..57781784c0 100644 --- a/include/constants/generational_changes.h +++ b/include/constants/generational_changes.h @@ -135,7 +135,7 @@ F(STURDY, sturdy, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ F(PLUS_MINUS_INTERACTION, plusMinusInteraction, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ F(WEATHER_FORMS, weatherForms, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ - F(SYMBIOSIS_GEMS, symbiosisGems, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ + F(SYMBIOSIS_GEMS, symbiosisGems, (u32, GEN_COUNT - 1)) \ F(ABSORBING_ABILITY_STRING, absorbingAbilityString, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ F(REDIRECT_ABILITY_IMMUNITY, redirectAbilityImmunity, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ F(REDIRECT_ABILITY_ALLIES, redirectAbilityAllies, (u32, GEN_COUNT - 1)) /* TODO: use in tests */ \ diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index ba546a5c99..49c279c695 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6295,7 +6295,7 @@ static void Cmd_moveend(void) for (i = 0; i < gBattlersCount; i++) { if ((gSpecialStatuses[i].berryReduced - || (B_SYMBIOSIS_GEMS >= GEN_7 && gSpecialStatuses[i].gemBoost)) + || (GetConfig(CONFIG_SYMBIOSIS_GEMS) >= GEN_7 && gSpecialStatuses[i].gemBoost)) && TryTriggerSymbiosis(i, BATTLE_PARTNER(i))) { BestowItem(BATTLE_PARTNER(i), i); @@ -8810,7 +8810,7 @@ static bool32 TrySymbiosis(u32 battler, u32 itemId, bool32 moveEnd) && gBattleStruct->changedItems[battler] == ITEM_NONE && GetBattlerHoldEffect(battler) != HOLD_EFFECT_EJECT_BUTTON && GetBattlerHoldEffect(battler) != HOLD_EFFECT_EJECT_PACK - && (B_SYMBIOSIS_GEMS < GEN_7 || !(gSpecialStatuses[battler].gemBoost)) + && (GetConfig(CONFIG_SYMBIOSIS_GEMS) < GEN_7 || !(gSpecialStatuses[battler].gemBoost)) && GetMoveEffect(gCurrentMove) != EFFECT_FLING //Fling and damage-reducing berries are handled separately. && !gSpecialStatuses[battler].berryReduced && TryTriggerSymbiosis(battler, BATTLE_PARTNER(battler))) diff --git a/test/battle/ability/symbiosis.c b/test/battle/ability/symbiosis.c index 932008d9d7..44e7c5f1bd 100644 --- a/test/battle/ability/symbiosis.c +++ b/test/battle/ability/symbiosis.c @@ -132,3 +132,49 @@ DOUBLE_BATTLE_TEST("Symbiosis transfers its item to an ally after it consumes a EXPECT_EQ(playerRight->item, ITEM_NONE); } } + +DOUBLE_BATTLE_TEST("Symbiosis transfers its item after Gem consumption and move execution (Gen7+)") +{ + GIVEN { + ASSUME(GetItemHoldEffect(ITEM_NORMAL_GEM) == HOLD_EFFECT_GEMS); + WITH_CONFIG(CONFIG_SYMBIOSIS_GEMS, GEN_7); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_NORMAL_GEM); } + PLAYER(SPECIES_ORANGURU) { Ability(ABILITY_SYMBIOSIS); Item(ITEM_TOXIC_ORB); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SCRATCH, target: opponentLeft); } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, playerLeft); + MESSAGE("The Normal Gem strengthened Wobbuffet's power!"); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SCRATCH, playerLeft); + ABILITY_POPUP(playerRight, ABILITY_SYMBIOSIS); + STATUS_ICON(playerLeft, STATUS1_TOXIC_POISON); + } THEN { + EXPECT_EQ(playerLeft->item, ITEM_TOXIC_ORB); + EXPECT_EQ(playerRight->item, ITEM_NONE); + } +} + +DOUBLE_BATTLE_TEST("Symbiosis transfers its item after Gem consumption, but before move execution (Gen6)") +{ + GIVEN { + ASSUME(GetItemHoldEffect(ITEM_NORMAL_GEM) == HOLD_EFFECT_GEMS); + WITH_CONFIG(CONFIG_SYMBIOSIS_GEMS, GEN_6); + PLAYER(SPECIES_WOBBUFFET) { Item(ITEM_NORMAL_GEM); } + PLAYER(SPECIES_ORANGURU) { Ability(ABILITY_SYMBIOSIS); Item(ITEM_TOXIC_ORB); } + OPPONENT(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(playerLeft, MOVE_SCRATCH, target: opponentLeft); } + } SCENE { + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_HELD_ITEM_EFFECT, playerLeft); + MESSAGE("The Normal Gem strengthened Wobbuffet's power!"); + ABILITY_POPUP(playerRight, ABILITY_SYMBIOSIS); + ANIMATION(ANIM_TYPE_MOVE, MOVE_SCRATCH, playerLeft); + STATUS_ICON(playerLeft, STATUS1_TOXIC_POISON); + } THEN { + EXPECT_EQ(playerLeft->item, ITEM_TOXIC_ORB); + EXPECT_EQ(playerRight->item, ITEM_NONE); + } +}