mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-26 13:31:03 +01:00
handle rototiller + prankster
This commit is contained in:
parent
4aeadd96c9
commit
fcada4fcad
@ -942,10 +942,6 @@ BattleScript_FlowerShieldMoveTargetEnd:
|
||||
jumpifnexttargetvalid BattleScript_FlowerShieldLoop
|
||||
end
|
||||
|
||||
BattleScript_RototillerRet::
|
||||
|
||||
return
|
||||
|
||||
BattleScript_EffectRototiller:
|
||||
attackcanceler
|
||||
attackstring
|
||||
|
@ -152,7 +152,7 @@ bool32 CompareStat(u8 battlerId, u8 statId, u8 cmpTo, u8 cmpKind);
|
||||
bool32 TryRoomService(u8 battlerId);
|
||||
void BufferStatChange(u8 battlerId, u8 statId, u8 stringId);
|
||||
void DoBurmyFormChange(u32 monId);
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef);
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget);
|
||||
|
||||
// ability checks
|
||||
bool32 IsRolePlayBannedAbilityAtk(u16 ability);
|
||||
|
@ -1416,7 +1416,7 @@ static void Cmd_attackcanceler(void)
|
||||
gProtectStructs[gBattlerTarget].bounceMove = 0;
|
||||
gProtectStructs[gBattlerTarget].usesBouncedMove = 1;
|
||||
gBattleCommunication[MULTISTRING_CHOOSER] = 0;
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker))
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerTarget, gBattlerAttacker, TRUE))
|
||||
{
|
||||
// Opponent used a prankster'd magic coat -> reflected status move should fail against a dark-type attacker
|
||||
gBattlerTarget = gBattlerAttacker;
|
||||
@ -7345,8 +7345,8 @@ static bool32 IsRototillerAffected(u32 battlerId)
|
||||
return FALSE; // Only grass types affected
|
||||
if (gStatuses3[battlerId] & STATUS3_SEMI_INVULNERABLE)
|
||||
return FALSE; // Rototiller doesn't affected semi-invulnerable battlers
|
||||
//if (!CompareStat(battlerId, STAT_ATK, MAX_STAT_STAGE, CMP_LESS_THAN) && !CompareStat(battlerId, STAT_SPATK, MAX_STAT_STAGE, CMP_LESS_THAN))
|
||||
//return FALSE; // Battler unaffected if atk and spatk are maxed
|
||||
if (BlocksPrankster(MOVE_ROTOTILLER, gBattlerAttacker, battlerId, FALSE))
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -8757,21 +8757,22 @@ static void Cmd_various(void)
|
||||
}
|
||||
gFieldStatuses &= ~STATUS_FIELD_TERRAIN_ANY; // remove the terrain
|
||||
break;
|
||||
case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED:
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler))
|
||||
case VARIOUS_JUMP_IF_PRANKSTER_BLOCKED:
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gActiveBattler, TRUE))
|
||||
gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 3);
|
||||
else
|
||||
gBattlescriptCurrInstr += 7;
|
||||
return;
|
||||
case VARIOUS_GET_ROTOTILLER_TARGETS:
|
||||
case VARIOUS_GET_ROTOTILLER_TARGETS:
|
||||
// Gets the battlers to be affected by rototiller. If there are none, print 'But it failed!'
|
||||
{
|
||||
u32 count = 0;
|
||||
for (i = 0; i < gBattlersCount; i++)
|
||||
{
|
||||
gSpecialStatuses[i].rototillerAffected = FALSE;
|
||||
if (IsRototillerAffected(i))
|
||||
{
|
||||
gSpecialStatuses[i].rototillerAffected = 1;
|
||||
gSpecialStatuses[i].rototillerAffected = TRUE;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
@ -8785,7 +8786,7 @@ static void Cmd_various(void)
|
||||
case VARIOUS_JUMP_IF_NOT_ROTOTILLER_AFFECTED:
|
||||
if (gSpecialStatuses[gActiveBattler].rototillerAffected)
|
||||
{
|
||||
gSpecialStatuses[gActiveBattler].rototillerAffected = 0;
|
||||
gSpecialStatuses[gActiveBattler].rototillerAffected = FALSE;
|
||||
gBattlescriptCurrInstr += 7;
|
||||
}
|
||||
else
|
||||
@ -10954,7 +10955,7 @@ static void Cmd_trysetperishsong(void)
|
||||
{
|
||||
if (gStatuses3[i] & STATUS3_PERISH_SONG
|
||||
|| GetBattlerAbility(i) == ABILITY_SOUNDPROOF
|
||||
|| BlocksPrankster(gCurrentMove, gBattlerAttacker, i))
|
||||
|| BlocksPrankster(gCurrentMove, gBattlerAttacker, i, TRUE))
|
||||
{
|
||||
notAffectedCount++;
|
||||
}
|
||||
|
@ -3421,7 +3421,7 @@ u8 AtkCanceller_UnableToUseMove(void)
|
||||
gBattleStruct->atkCancellerTracker++;
|
||||
break;
|
||||
case CANCELLER_PRANKSTER:
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget)
|
||||
if (BlocksPrankster(gCurrentMove, gBattlerAttacker, gBattlerTarget, TRUE)
|
||||
&& !(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)))
|
||||
@ -9344,16 +9344,21 @@ void DoBurmyFormChange(u32 monId)
|
||||
}
|
||||
}
|
||||
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef)
|
||||
bool32 BlocksPrankster(u16 move, u8 battlerPrankster, u8 battlerDef, bool32 checkTarget)
|
||||
{
|
||||
#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
|
||||
&& IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK) // Only Dark-types can block Prankster'd
|
||||
&& !(gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE))
|
||||
return TRUE;
|
||||
else
|
||||
#endif
|
||||
if (!gProtectStructs[battlerPrankster].pranksterElevated)
|
||||
return FALSE;
|
||||
if (GetBattlerSide(battlerPrankster) == GetBattlerSide(battlerDef))
|
||||
return FALSE;
|
||||
if (checkTarget && (gBattleMoves[move].target & (MOVE_TARGET_OPPONENTS_FIELD | MOVE_TARGET_DEPENDS)))
|
||||
return FALSE;
|
||||
if (!IS_BATTLER_OF_TYPE(battlerDef, TYPE_DARK))
|
||||
return FALSE;
|
||||
if (gStatuses3[battlerDef] & STATUS3_SEMI_INVULNERABLE)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user