From a775098e83e4b5e9b171e085664a364591de13d1 Mon Sep 17 00:00:00 2001 From: ghoulslash <41651341+ghoulslash@users.noreply.github.com> Date: Sat, 7 Dec 2024 07:38:34 -0500 Subject: [PATCH] Fix octolock + defiant (#5781) Co-authored-by: ghoulslash --- data/battle_scripts_1.s | 2 +- src/battle_util.c | 3 +-- test/battle/move_effect/octolock.c | 21 +++++++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index b38dc4b7f8..6c2b9ecac1 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -864,7 +864,7 @@ BattleScript_EffectOctolock:: goto BattleScript_MoveEnd BattleScript_OctolockEndTurn:: - playstatchangeanimation BS_ATTACKER, BIT_DEF | BIT_SPDEF, STAT_CHANGE_NEGATIVE + playstatchangeanimation BS_TARGET, BIT_DEF | BIT_SPDEF, STAT_CHANGE_NEGATIVE setstatchanger STAT_DEF, 1, TRUE statbuffchange STAT_CHANGE_ALLOW_PTR | STAT_CHANGE_NOT_PROTECT_AFFECTED, BattleScript_OctolockTryLowerSpDef printfromtable gStatDownStringIds diff --git a/src/battle_util.c b/src/battle_util.c index b376a20920..3aaa756e44 100644 --- a/src/battle_util.c +++ b/src/battle_util.c @@ -2618,15 +2618,14 @@ u8 DoBattlerEndTurnEffects(void) gBattleStruct->turnEffectsTracker++; break; case ENDTURN_OCTOLOCK: - { if (gDisableStructs[battler].octolock) { + gBattlerAttacker = gDisableStructs[battler].battlerPreventingEscape; gBattlerTarget = battler; BattleScriptExecute(BattleScript_OctolockEndTurn); effect++; } gBattleStruct->turnEffectsTracker++; - } break; case ENDTURN_UPROAR: // uproar if (gBattleMons[battler].status2 & STATUS2_UPROAR) diff --git a/test/battle/move_effect/octolock.c b/test/battle/move_effect/octolock.c index 1a04de7331..e93f6f29cb 100644 --- a/test/battle/move_effect/octolock.c +++ b/test/battle/move_effect/octolock.c @@ -131,3 +131,24 @@ SINGLE_BATTLE_TEST("Octolock will not decrease Defense and Sp. Def further then } } } + +SINGLE_BATTLE_TEST("Octolock triggers Defiant for both stat reductions") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_BISHARP) { Ability(ABILITY_DEFIANT); } + } WHEN { + TURN { MOVE(player, MOVE_OCTOLOCK); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_OCTOLOCK, player); + MESSAGE("The opposing Bisharp can no longer escape because of Octolock!"); + ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent); + MESSAGE("The opposing Bisharp's Defense fell!"); + ABILITY_POPUP(opponent, ABILITY_DEFIANT); + MESSAGE("The opposing Bisharp's Attack sharply rose!"); + NOT ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, opponent); + MESSAGE("The opposing Bisharp's Sp. Def fell!"); + ABILITY_POPUP(opponent, ABILITY_DEFIANT); + MESSAGE("The opposing Bisharp's Attack sharply rose!"); + } +}