mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
syntax fixes. Use BlocksPrankster for perish song battle script
This commit is contained in:
parent
8a9d28d97f
commit
94ec25319f
@ -1796,6 +1796,11 @@
|
||||
.4byte \terrainFlags
|
||||
.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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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++;
|
||||
}
|
||||
|
@ -3414,17 +3414,15 @@ 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))
|
||||
{
|
||||
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
|
||||
gBattleScripting.battler = gBattlerAbility = gBattlerTarget;
|
||||
gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster;
|
||||
effect = 1;
|
||||
}
|
||||
#endif
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget)
|
||||
&& !(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)))
|
||||
CancelMultiTurnMoves(gBattlerAttacker); // Don't cancel moves that can hit two targets bc one target might not be protected
|
||||
gBattleScripting.battler = gBattlerAbility = gBattlerTarget;
|
||||
gBattlescriptCurrInstr = BattleScript_DarkTypePreventsPrankster;
|
||||
effect = 1;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user