Adds callnative for soundproofcheck to addtionally check the flag (#5301)

* Adds callnative for soundproofcheck to addtionally check the flag

* rename callnative, include parish song and missing ability recording
This commit is contained in:
Alex 2024-09-09 11:52:26 +02:00 committed by GitHub
parent d62b7270c8
commit 5089b1d0b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 25 additions and 2 deletions

View file

@ -1679,6 +1679,12 @@
.4byte \failInstr
.endm
.macro jumpifblockedbysoundproof battler:req, failInstr:req
callnative BS_JumpIfBlockedBySoundproof
.byte \battler
.4byte \failInstr
.endm
@ various command changed to more readable macros
.macro cancelmultiturnmoves battler:req
various \battler, VARIOUS_CANCEL_MULTI_TURN_MOVES

View file

@ -508,7 +508,7 @@ BattleScript_EffectAttackUpUserAlly_TryAlly:
BattleScript_EffectAttackUpUserAlly_End:
goto BattleScript_MoveEnd
BattleScript_EffectAttackUpUserAlly_TryAlly_:
jumpifability BS_ATTACKER_PARTNER, ABILITY_SOUNDPROOF, BattleScript_EffectAttackUpUserAlly_TryAllyBlocked
jumpifblockedbysoundproof BS_ATTACKER_PARTNER, BattleScript_EffectAttackUpUserAlly_TryAllyBlocked
setstatchanger STAT_ATK, 1, FALSE
statbuffchange STAT_CHANGE_ALLOW_PTR, BattleScript_EffectAttackUpUserAlly_End
jumpifbyte CMP_NOT_EQUAL, cMULTISTRING_CHOOSER, B_MSG_STAT_WONT_INCREASE, BattleScript_EffectAttackUpUserAlly_AllyAnim
@ -4281,7 +4281,7 @@ BattleScript_EffectPerishSong::
waitmessage B_WAIT_TIME_LONG
setbyte gBattlerTarget, 0
BattleScript_PerishSongLoop::
jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked
jumpifblockedbysoundproof BS_TARGET, BattleScript_PerishSongBlocked
jumpifpranksterblocked BS_TARGET, BattleScript_PerishSongNotAffected
BattleScript_PerishSongLoopIncrement::
addbyte gBattlerTarget, 1

View file

@ -17218,3 +17218,20 @@ void BS_TryTarShot(void)
gBattlescriptCurrInstr = cmd->nextInstr;
}
}
void BS_JumpIfBlockedBySoundproof(void)
{
NATIVE_ARGS(u8 battler, const u8 *jumpInstr);
u32 battler = GetBattlerForBattleScript(cmd->battler);
if (gMovesInfo[gCurrentMove].soundMove && GetBattlerAbility(battler) == ABILITY_SOUNDPROOF)
{
gLastUsedAbility = ABILITY_SOUNDPROOF;
gBattlescriptCurrInstr = cmd->jumpInstr;
RecordAbilityBattle(battler, gLastUsedAbility);
gBattlerAbility = battler;
}
else
{
gBattlescriptCurrInstr = cmd->nextInstr;
}
}