From 75be596933100a3e5c607f5189a4f5575549fe8d Mon Sep 17 00:00:00 2001 From: sneed <56992013+Sneed69@users.noreply.github.com> Date: Sat, 29 Jun 2024 19:54:58 +0300 Subject: [PATCH] fix sticky hold softlock (#4885) --- data/battle_scripts_1.s | 2 +- src/battle_script_commands.c | 2 +- test/battle/ability/sticky_hold.c | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 test/battle/ability/sticky_hold.c diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index 1bbb75946015..8bceedfa47ad 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -8573,7 +8573,7 @@ BattleScript_SynchronizeActivates:: return BattleScript_NoItemSteal:: - pause B_WAIT_TIME_SHORT + call BattleScript_AbilityPopUpTarget printstring STRINGID_PKMNSXMADEYINEFFECTIVE waitmessage B_WAIT_TIME_LONG return diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 83c910f6b0c3..eaa69de10db4 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -3454,7 +3454,7 @@ void SetMoveEffect(bool32 primary, bool32 certain) } else if (GetBattlerAbility(gBattlerTarget) == ABILITY_STICKY_HOLD) { - BattleScriptPushCursor(); + BattleScriptPush(gBattlescriptCurrInstr + 1); gBattlescriptCurrInstr = BattleScript_NoItemSteal; gLastUsedAbility = gBattleMons[gBattlerTarget].ability; diff --git a/test/battle/ability/sticky_hold.c b/test/battle/ability/sticky_hold.c new file mode 100644 index 000000000000..2c7cc095350c --- /dev/null +++ b/test/battle/ability/sticky_hold.c @@ -0,0 +1,18 @@ +#include "global.h" +#include "test/battle.h" + +SINGLE_BATTLE_TEST("Sticky Hold prevents item theft") +{ + GIVEN { + ASSUME(MoveHasAdditionalEffect(MOVE_THIEF, MOVE_EFFECT_STEAL_ITEM)); + PLAYER(SPECIES_URSALUNA) { Item(ITEM_NONE); } + OPPONENT(SPECIES_GASTRODON) { Ability(ABILITY_STICKY_HOLD); Item(ITEM_LIFE_ORB); } + } WHEN { + TURN { MOVE(player, MOVE_THIEF); } + } SCENE { + MESSAGE("Ursaluna used Thief!"); + ABILITY_POPUP(opponent, ABILITY_STICKY_HOLD); + MESSAGE("Foe Gastrodon's Sticky Hold made Thief ineffective!"); + } +} +