Fix octolock + defiant (#5781)

Co-authored-by: ghoulslash <pokevoyager0@gmail.com>
This commit is contained in:
ghoulslash 2024-12-07 07:38:34 -05:00 committed by GitHub
parent a45f18b9b7
commit a775098e83
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 3 deletions

View file

@ -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

View file

@ -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)

View file

@ -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!");
}
}