From 4fb0b5566478a67b55657588cbda5472de83f825 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 14 Sep 2023 19:13:11 +0200 Subject: [PATCH] Bug bite/Fling enigma berry interaction & tests (#3311) --- src/battle_util.c | 7 +++---- test/battle/move_effect/bug_bite.c | 10 +++++----- test/battle/move_effect/fling.c | 8 +++++++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/battle_util.c b/src/battle_util.c index a9901d2c4..5ce61373d 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -6557,19 +6557,18 @@ static u8 TrySetMicleBerry(u32 battler, u32 itemId, bool32 end2) static u8 TrySetEnigmaBerry(u32 battler) { if (IsBattlerAlive(battler) - && TARGET_TURN_DAMAGED && !DoesSubstituteBlockMove(gBattlerAttacker, battler, gCurrentMove) + && ((TARGET_TURN_DAMAGED && gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) || gBattleScripting.overrideBerryRequirements) && !(gBattleScripting.overrideBerryRequirements && gBattleMons[battler].hp == gBattleMons[battler].maxHP) #if B_HEAL_BLOCKING >= GEN_5 - && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK) + && !(gStatuses3[battler] & STATUS3_HEAL_BLOCK)) #endif - && gMoveResultFlags & MOVE_RESULT_SUPER_EFFECTIVE) { gBattleScripting.battler = battler; gBattleMoveDamage = (gBattleMons[battler].maxHP * 25 / 100) * -1; if (GetBattlerAbility(battler) == ABILITY_RIPEN) gBattleMoveDamage *= 2; - + BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_ItemHealHP_RemoveItemRet; return ITEM_HP_CHANGE; diff --git a/test/battle/move_effect/bug_bite.c b/test/battle/move_effect/bug_bite.c index 315d52109..385b8a400 100644 --- a/test/battle/move_effect/bug_bite.c +++ b/test/battle/move_effect/bug_bite.c @@ -10,13 +10,13 @@ ASSUMPTIONS // Pretty much copy/paste of the Berry Fling Test. SINGLE_BATTLE_TEST("Bug Bite eats the target's berry and immediately gains its effect") { - u16 item; - u32 status1 = STATUS1_NONE, effect, statId; + u16 item = ITEM_NONE; + u32 status1 = STATUS1_NONE, effect = HOLD_EFFECT_NONE, statId = 0; PARAMETRIZE { item = ITEM_NONE; } PARAMETRIZE { item = ITEM_ORAN_BERRY; effect = HOLD_EFFECT_RESTORE_HP; } PARAMETRIZE { item = ITEM_SITRUS_BERRY; effect = HOLD_EFFECT_RESTORE_HP; } - // PARAMETRIZE { item = ITEM_ENIGMA_BERRY; effect = HOLD_EFFECT_RESTORE_HP; } To do once Enigma Berry's effect is done + PARAMETRIZE { item = ITEM_ENIGMA_BERRY; effect = HOLD_EFFECT_ENIGMA_BERRY; } PARAMETRIZE { item = ITEM_LEPPA_BERRY; effect = HOLD_EFFECT_RESTORE_PP; } PARAMETRIZE { item = ITEM_CHESTO_BERRY; effect = HOLD_EFFECT_CURE_SLP; status1 = STATUS1_SLEEP; } PARAMETRIZE { item = ITEM_CHERI_BERRY; effect = HOLD_EFFECT_CURE_PAR; status1 = STATUS1_PARALYSIS; } @@ -50,13 +50,13 @@ SINGLE_BATTLE_TEST("Bug Bite eats the target's berry and immediately gains its e MESSAGE("Wobbuffet used Bug Bite!"); ANIMATION(ANIM_TYPE_MOVE, MOVE_BUG_BITE, player); HP_BAR(opponent); - if (effect == HOLD_EFFECT_RESTORE_HP) { + if (effect == HOLD_EFFECT_RESTORE_HP || effect == HOLD_EFFECT_ENIGMA_BERRY) { if (item == ITEM_ORAN_BERRY) { MESSAGE("Wobbuffet's Oran Berry restored health!"); } else if (item == ITEM_SITRUS_BERRY) { MESSAGE("Wobbuffet's Sitrus Berry restored health!"); } else { - // MESSAGE("Wobbuffet's Enigma Berry restored health!"); + MESSAGE("Wobbuffet's Enigma Berry restored health!"); } HP_BAR(player); } diff --git a/test/battle/move_effect/fling.c b/test/battle/move_effect/fling.c index 5abb883e1..8d44d9b9f 100644 --- a/test/battle/move_effect/fling.c +++ b/test/battle/move_effect/fling.c @@ -255,6 +255,7 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even PARAMETRIZE { item = ITEM_ORAN_BERRY; effect = HOLD_EFFECT_RESTORE_HP; } PARAMETRIZE { item = ITEM_SITRUS_BERRY; effect = HOLD_EFFECT_RESTORE_HP; } + PARAMETRIZE { item = ITEM_ENIGMA_BERRY; effect = HOLD_EFFECT_ENIGMA_BERRY; } PARAMETRIZE { item = ITEM_LEPPA_BERRY; effect = HOLD_EFFECT_RESTORE_PP; } PARAMETRIZE { item = ITEM_CHESTO_BERRY; effect = HOLD_EFFECT_CURE_SLP; status1 = STATUS1_SLEEP; } PARAMETRIZE { item = ITEM_CHERI_BERRY; effect = HOLD_EFFECT_CURE_PAR; status1 = STATUS1_PARALYSIS; } @@ -262,6 +263,7 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even PARAMETRIZE { item = ITEM_PECHA_BERRY; effect = HOLD_EFFECT_CURE_PSN; status1 = STATUS1_TOXIC_POISON; } PARAMETRIZE { item = ITEM_RAWST_BERRY; effect = HOLD_EFFECT_CURE_BRN; status1 = STATUS1_BURN; } PARAMETRIZE { item = ITEM_ASPEAR_BERRY; effect = HOLD_EFFECT_CURE_FRZ; status1 = STATUS1_FREEZE; } + PARAMETRIZE { item = ITEM_ASPEAR_BERRY; effect = HOLD_EFFECT_CURE_FRZ; status1 = STATUS1_FROSTBITE; } PARAMETRIZE { item = ITEM_APICOT_BERRY; effect = HOLD_EFFECT_SP_DEFENSE_UP; statId = STAT_SPDEF; } PARAMETRIZE { item = ITEM_MARANGA_BERRY; effect = HOLD_EFFECT_MARANGA_BERRY; statId = STAT_SPDEF; } PARAMETRIZE { item = ITEM_GANLON_BERRY; effect = HOLD_EFFECT_DEFENSE_UP; statId = STAT_DEF; } @@ -282,8 +284,10 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even if (effect == HOLD_EFFECT_RESTORE_HP) { if (item == ITEM_ORAN_BERRY) { MESSAGE("Foe Wobbuffet's Oran Berry restored health!"); - } else { + } else if (item == ITEM_SITRUS_BERRY) { MESSAGE("Foe Wobbuffet's Sitrus Berry restored health!"); + } else { + MESSAGE("Wobbuffet's Enigma Berry restored health!"); } HP_BAR(opponent); } @@ -297,6 +301,8 @@ SINGLE_BATTLE_TEST("Fling - thrown berry's effect activates for the target even MESSAGE("Foe Wobbuffet's Chesto Berry woke it from its sleep!"); } else if (status1 == STATUS1_FREEZE) { MESSAGE("Foe Wobbuffet's Aspear Berry defrosted it!"); + } else if (status1 == STATUS1_FROSTBITE) { + MESSAGE("Foe Wobbuffet's Aspear Berry healed its frostbite!"); } else if (status1 == STATUS1_PARALYSIS) { MESSAGE("Foe Wobbuffet's Cheri Berry cured paralysis!"); } else if (status1 == STATUS1_TOXIC_POISON || status1 == STATUS1_POISON) {