Fix captivate-oblivious interaction and related test (#6653)

This commit is contained in:
cawtds 2025-04-21 11:01:01 +02:00 committed by GitHub
parent 86969f9919
commit 0069ec1f0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 24 additions and 12 deletions

View File

@ -1331,7 +1331,7 @@
.byte \stat .byte \stat
.endm .endm
.macro jumpifoppositegenders jumpInstr:req .macro jumpifcaptivateaffected jumpInstr:req
.byte 0xfc .byte 0xfc
.4byte \jumpInstr .4byte \jumpInstr
.endm .endm

View File

@ -2743,11 +2743,13 @@ BattleScript_EffectRoost::
BattleScript_EffectCaptivate:: BattleScript_EffectCaptivate::
setstatchanger STAT_SPATK, 2, TRUE setstatchanger STAT_SPATK, 2, TRUE
attackcanceler attackcanceler
jumpifsubstituteblocks BattleScript_FailedFromAtkString attackstring
jumpifoppositegenders BattleScript_CaptivateCheckAcc ppreduce
goto BattleScript_FailedFromAtkString jumpifsubstituteblocks BattleScript_ButItFailed
jumpifcaptivateaffected BattleScript_CaptivateCheckAcc
goto BattleScript_ButItFailed
BattleScript_CaptivateCheckAcc: BattleScript_CaptivateCheckAcc:
accuracycheck BattleScript_PrintMoveMissed, ACC_CURR_MOVE accuracycheck BattleScript_MoveMissedPause, ACC_CURR_MOVE
goto BattleScript_StatDownFromAttackString goto BattleScript_StatDownFromAttackString
BattleScript_EffectHealBlock:: BattleScript_EffectHealBlock::

View File

@ -599,7 +599,7 @@ static void Cmd_trainerslideout(void);
static void Cmd_settelekinesis(void); static void Cmd_settelekinesis(void);
static void Cmd_swapstatstages(void); static void Cmd_swapstatstages(void);
static void Cmd_averagestats(void); static void Cmd_averagestats(void);
static void Cmd_jumpifoppositegenders(void); static void Cmd_jumpifcaptivateaffected(void);
static void Cmd_unused(void); static void Cmd_unused(void);
static void Cmd_tryworryseed(void); static void Cmd_tryworryseed(void);
static void Cmd_callnative(void); static void Cmd_callnative(void);
@ -836,8 +836,8 @@ void (* const gBattleScriptingCommandsTable[])(void) =
Cmd_jumpifhasnohp, //0xE3 Cmd_jumpifhasnohp, //0xE3
Cmd_jumpifnotcurrentmoveargtype, //0xE4 Cmd_jumpifnotcurrentmoveargtype, //0xE4
Cmd_pickup, //0xE5 Cmd_pickup, //0xE5
Cmd_unused_0xE6, //0xE6 Cmd_unused_0xE6, //0xE6
Cmd_unused_0xE7, //0xE7 Cmd_unused_0xE7, //0xE7
Cmd_settypebasedhalvers, //0xE8 Cmd_settypebasedhalvers, //0xE8
Cmd_jumpifsubstituteblocks, //0xE9 Cmd_jumpifsubstituteblocks, //0xE9
Cmd_tryrecycleitem, //0xEA Cmd_tryrecycleitem, //0xEA
@ -858,7 +858,7 @@ void (* const gBattleScriptingCommandsTable[])(void) =
Cmd_settelekinesis, //0xF9 Cmd_settelekinesis, //0xF9
Cmd_swapstatstages, //0xFA Cmd_swapstatstages, //0xFA
Cmd_averagestats, //0xFB Cmd_averagestats, //0xFB
Cmd_jumpifoppositegenders, //0xFC Cmd_jumpifcaptivateaffected, //0xFC
Cmd_unused, //0xFD Cmd_unused, //0xFD
Cmd_tryworryseed, //0xFE Cmd_tryworryseed, //0xFE
Cmd_callnative, //0xFF Cmd_callnative, //0xFF
@ -16665,14 +16665,24 @@ static void Cmd_averagestats(void)
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
} }
static void Cmd_jumpifoppositegenders(void) static void Cmd_jumpifcaptivateaffected(void)
{ {
CMD_ARGS(const u8 *jumpInstr); CMD_ARGS(const u8 *jumpInstr);
if (AreBattlersOfOppositeGender(gBattlerAttacker, gBattlerTarget)) if (GetBattlerAbility(gBattlerTarget) == ABILITY_OBLIVIOUS)
{
gBattlescriptCurrInstr = BattleScript_NotAffectedAbilityPopUp;
gLastUsedAbility = ABILITY_OBLIVIOUS;
RecordAbilityBattle(gBattlerTarget, ABILITY_OBLIVIOUS);
}
else if (AreBattlersOfOppositeGender(gBattlerAttacker, gBattlerTarget))
{
gBattlescriptCurrInstr = cmd->jumpInstr; gBattlescriptCurrInstr = cmd->jumpInstr;
}
else else
{
gBattlescriptCurrInstr = cmd->nextInstr; gBattlescriptCurrInstr = cmd->nextInstr;
}
} }
static void Cmd_unused(void) static void Cmd_unused(void)

View File

@ -23,7 +23,7 @@ SINGLE_BATTLE_TEST("Oblivious prevents Captivate")
PLAYER(SPECIES_SLOWPOKE) { Ability(ABILITY_OBLIVIOUS); Gender(MON_MALE); } PLAYER(SPECIES_SLOWPOKE) { Ability(ABILITY_OBLIVIOUS); Gender(MON_MALE); }
OPPONENT(SPECIES_WOBBUFFET) { Gender(MON_FEMALE); } OPPONENT(SPECIES_WOBBUFFET) { Gender(MON_FEMALE); }
} WHEN { } WHEN {
TURN { MOVE(opponent, MOVE_ATTRACT); } TURN { MOVE(opponent, MOVE_CAPTIVATE); }
} SCENE { } SCENE {
ABILITY_POPUP(player, ABILITY_OBLIVIOUS); ABILITY_POPUP(player, ABILITY_OBLIVIOUS);
NONE_OF { ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); } NONE_OF { ANIMATION(ANIM_TYPE_GENERAL, B_ANIM_STATS_CHANGE, player); }