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

@ -1796,6 +1796,11 @@
.4byte \terrainFlags .4byte \terrainFlags
.4byte \ptr .4byte \ptr
.endm .endm
.macro jumpifpranksterblocked battler:req, ptr:req
various \battler, VARIOUS_JUMP_IF_PRANKSTER_BLOCKED
.4byte \ptr
.endm
@ helpful macros @ helpful macros
.macro setstatchanger stat:req, stages:req, down:req .macro setstatchanger stat:req, stages:req, down:req

View File

@ -3700,12 +3700,7 @@ BattleScript_EffectPerishSong::
setbyte gBattlerTarget, 0 setbyte gBattlerTarget, 0
BattleScript_PerishSongLoop:: BattleScript_PerishSongLoop::
jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked jumpifability BS_TARGET, ABILITY_SOUNDPROOF, BattleScript_PerishSongBlocked
jumpifbyteequal gBattlerAttacker, gBattlerTarget, BattleScript_PerishSongLoopIncrement @ Cannot block your own perish song jumpifpranksterblocked BS_TARGET, BattleScript_PerishSongNotAffected
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
BattleScript_PerishSongLoopIncrement:: BattleScript_PerishSongLoopIncrement::
addbyte gBattlerTarget, 1 addbyte gBattlerTarget, 1
jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_PerishSongLoop jumpifbytenotequal gBattlerTarget, gBattlersCount, BattleScript_PerishSongLoop

View File

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

View File

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

View File

@ -3414,17 +3414,15 @@ u8 AtkCanceller_UnableToUseMove(void)
gBattleStruct->atkCancellerTracker++; gBattleStruct->atkCancellerTracker++;
break; break;
case CANCELLER_PRANKSTER: case CANCELLER_PRANKSTER:
#if B_PRANKSTER_DARK_TYPES >= GEN_7 if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget)
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget) && !(IS_MOVE_STATUS(gCurrentMove) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE))
&& !(IS_MOVE_STATUS(gCurrentMove) && GetBattlerAbility(gBattlerTarget) == ABILITY_MAGIC_BOUNCE)) {
{ if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY)))
if (!(gBattleTypeFlags & BATTLE_TYPE_DOUBLE) || !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_BOTH | MOVE_TARGET_FOES_AND_ALLY))) CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected
CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected gBattleScripting.battler = gBattlerAbility = gBattlerTarget;
gBattleScripting.battler = gBattlerAbility = gBattlerTarget; gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster;
gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster; effect = 1;
effect = 1; }
}
#endif
gBattleStruct->atkCancellerTracker++; gBattleStruct->atkCancellerTracker++;
break; break;
case CANCELLER_END: case CANCELLER_END:
@ -9236,6 +9234,7 @@ void DoBurmyFormChange(u32 monId)
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef) bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef)
{ {
#if B_PRANKSTER_DARK_TYPES >= GEN_7
if (gProtectStructs[battlerPrankster].pranksterElevated if (gProtectStructs[battlerPrankster].pranksterElevated
&& GetBattlerSide(battlerPrankster) != GetBattlerSide(battlerDef) && GetBattlerSide(battlerPrankster) != GetBattlerSide(battlerDef)
&& !(gBattleMoves[gCurrentMove].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)) // Don't block hazards, assist-type moves && !(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)) && !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE))
return TRUE; return TRUE;
else else
#endif
return FALSE; return FALSE;
} }