From 63254a8fdc1b71344258236b4a8db8fdc6f746c4 Mon Sep 17 00:00:00 2001 From: PhallenTree <168426989+PhallenTree@users.noreply.github.com> Date: Thu, 9 May 2024 08:22:56 +0100 Subject: [PATCH] Fixes Thief and Covet used by an opponent not stealing items (#4506) * Fixes MOVE_EFFECT_STEAL_ITEM (Thief and Covet) * Fix stealing consumed item * Removed unnecessary instructions * Removes unnecessary check for item to trigger Sticky Hold --- src/battle_script_commands.c | 39 +++++------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 7bb2390143..5f4ed78aa8 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3164,7 +3164,6 @@ void SetMoveEffect(bool32 primary, bool32 certain) } else { - u8 side; switch (gBattleScripting.moveEffect) { case MOVE_EFFECT_CONFUSION: @@ -3178,7 +3177,7 @@ void SetMoveEffect(bool32 primary, bool32 certain) // If the confusion is activating due to being released from Sky Drop, go to "confused due to fatigue" script. // Otherwise, do normal confusion script. - if(gCurrentMove == MOVE_SKY_DROP) + if (gCurrentMove == MOVE_SKY_DROP) { gBattleMons[gEffectBattler].status2 &= ~(STATUS2_LOCK_CONFUSE); gBattlerAttacker = gEffectBattler; @@ -3422,35 +3421,13 @@ void SetMoveEffect(bool32 primary, bool32 certain) break; case MOVE_EFFECT_STEAL_ITEM: { - if (!CanStealItem(gBattlerAttacker, gBattlerTarget, gBattleMons[gBattlerTarget].item)) - { - gBattlescriptCurrInstr++; - break; - } - - side = GetBattlerSide(gBattlerAttacker); - if (GetBattlerSide(gBattlerAttacker) == B_SIDE_OPPONENT - && !(gBattleTypeFlags & - (BATTLE_TYPE_EREADER_TRAINER - | BATTLE_TYPE_FRONTIER - | BATTLE_TYPE_LINK - | BATTLE_TYPE_RECORDED_LINK - | BATTLE_TYPE_SECRET_BASE))) + if (!CanStealItem(gBattlerAttacker, gBattlerTarget, gBattleMons[gBattlerTarget].item) + || gBattleMons[gBattlerAttacker].item != ITEM_NONE + || gBattleMons[gBattlerTarget].item == ITEM_NONE) { gBattlescriptCurrInstr++; } - else if (!(gBattleTypeFlags & - (BATTLE_TYPE_EREADER_TRAINER - | BATTLE_TYPE_FRONTIER - | BATTLE_TYPE_LINK - | BATTLE_TYPE_RECORDED_LINK - | BATTLE_TYPE_SECRET_BASE)) - && (gWishFutureKnock.knockedOffMons[side] & gBitTable[gBattlerPartyIndexes[gBattlerAttacker]])) - { - gBattlescriptCurrInstr++; - } - else if (gBattleMons[gBattlerTarget].item - && GetBattlerAbility(gBattlerTarget) == ABILITY_STICKY_HOLD) + else if (GetBattlerAbility(gBattlerTarget) == ABILITY_STICKY_HOLD) { BattleScriptPushCursor(); gBattlescriptCurrInstr = BattleScript_NoItemSteal; @@ -3458,12 +3435,6 @@ void SetMoveEffect(bool32 primary, bool32 certain) gLastUsedAbility = gBattleMons[gBattlerTarget].ability; RecordAbilityBattle(gBattlerTarget, gLastUsedAbility); } - else if (gBattleMons[gBattlerAttacker].item != ITEM_NONE - || gBattleMons[gBattlerTarget].item == ITEM_ENIGMA_BERRY_E_READER - || gBattleMons[gBattlerTarget].item == ITEM_NONE) - { - gBattlescriptCurrInstr++; - } else { StealTargetItem(gBattlerAttacker, gBattlerTarget); // Attacker steals target item