syntax fixes. Use BlocksPrankster for perish song battle script

This commit is contained in:
ghoulslash 2021-09-23 14:35:37 -04:00
parent 8a9d28d97f
commit 94ec25319f
5 changed files with 25 additions and 22 deletions

View File

@ -1797,6 +1797,11 @@
.4byte \ptr
.endm
.macro jumpifpranksterblocked battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_PRANKSTER_BLOCKED
.4byte \ptr
.endm
@ helpful macros
.macro setstatchanger stat:req, stages:req, down:req
setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7

View File

@ -3700,12 +3700,7 @@ BattleScript_EffectPerishSong::
setbyte gBattlerTarget, 0
BattleScript_PerishSongLoop::
jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked
jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ Cannot block your own perish song
jumpiftargetally BattleScript_PerishSongLoopIncrement @ Cannot block ally perish song
jumpifability BS_ATTACKER, ABILITY_PRANKSTER, BattleScript_PerishSongCheckPrankster
goto BattleScript_PerishSongLoopIncrement
BattleScript_PerishSongCheckPrankster:
jumpiftype BS_TARGET, TYPE_DARK, BattleScript_PerishSongNotAffected
jumpifpranksterblocked BS_TARGET, BattleScript_PerishSongNotAffected
BattleScript_PerishSongLoopIncrement::
addbyte gBattlerTarget, 1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_PerishSongLoop

View File

@ -179,6 +179,7 @@
#define VARIOUS_MAKE_INVISIBLE 107
#define VARIOUS_ROOM_SERVICE 108
#define VARIOUS_JUMP_IF_TERRAIN_AFFECTED 109
#define VARIOUS_JUMP_IF_PRANKSTER_BLOCKED 110
// Cmd_manipulatedamage
#define DMG_CHANGE_SIGN 0

View File

@ -8604,6 +8604,12 @@ static void Cmd_various(void)
gBattlescriptCurrInstr += 11;
}
return;
case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED:
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler))
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
else
gBattlescriptCurrInstr += 7;
return;
}
gBattlescriptCurrInstr += 3;
@ -10757,11 +10763,7 @@ static void Cmd_trysetperishsong(void)
{
if (gStatuses3[i] & STATUS3_PERISH_SONG
|| gBattleMons[i].ability == ABILITY_SOUNDPROOF
|| (B_PRANKSTER_DARK_TYPES >= GEN_7
&& GetBattlerSide(i) != GetBattlerSide(gBattlerAttacker)
&& GetBattlerAbility(gBattlerAttacker) == ABILITY_PRANKSTER
&& IS_BATTLER_OF_TYPE(i, TYPE_DARK))
)
|| BlocksPrankster(gCurrentMove, gBattlerAttacker, i))
{
notAffectedCount++;
}

View File

@ -3414,7 +3414,6 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattleStruct->atkCancellerTracker++;
break;
case CANCELLER_PRANKSTER:
#if B_PRANKSTER_DARK_TYPES >= GEN_7
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget)
&& !(IS_MOVE_STATUS(gCurrentMove) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE))
{
@ -3424,7 +3423,6 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster;
effect = 1;
}
#endif
gBattleStruct->atkCancellerTracker++;
break;
case CANCELLER_END:
@ -9236,6 +9234,7 @@ void DoBurmyFormChange(u32 monId)
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef)
{
#if B_PRANKSTER_DARK_TYPES >= GEN_7
if (gProtectStructs[battlerPrankster].pranksterElevated
&& GetBattlerSide(battlerPrankster) != GetBattlerSide(battlerDef)
&& !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves
@ -9243,5 +9242,6 @@ bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef)
&& !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE))
return TRUE;
else
#endif
return FALSE;
}