Psychic Terrain blocks priority moves

This commit is contained in:
DizzyEggg 2018-12-01 11:35:49 +01:00
parent 3be070f0c3
commit 6ae949e360
5 changed files with 43 additions and 0 deletions

View File

@ -5984,6 +5984,11 @@ BattleScript_DazzlingProtected::
printstring STRINGID_POKEMONCANNOTUSEMOVE
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_MoveUsedPsychicTerrainPrevents::
printstring STRINGID_POKEMONCANNOTUSEMOVE
waitmessage 0x40
goto BattleScript_MoveEnd
BattleScript_AbilityNoSpecificStatLoss::
pause 0x20

View File

@ -285,5 +285,6 @@ extern const u8 BattleScript_TrainerSlideMsgEnd2[];
extern const u8 BattleScript_MoveEffectFeint[];
extern const u8 BattleScript_ProteanActivates[];
extern const u8 BattleScript_DazzlingProtected[];
extern const u8 BattleScript_MoveUsedPsychicTerrainPrevents[];
#endif // GUARD_BATTLE_SCRIPTS_H

View File

@ -64,6 +64,7 @@ bool8 HandleWishPerishSongOnTurnEnd(void);
bool8 HandleFaintedMonActions(void);
void TryClearRageAndFuryCutter(void);
u8 AtkCanceller_UnableToUseMove(void);
u8 AtkCanceller_UnableToUseMove2(void);
bool8 HasNoMonsToSwitch(u8 battlerId, u8 r1, u8 r2);
u8 CastformDataTypeChange(u8 battlerId);
bool32 TryChangeBattleWeather(u8 battler, u32 weatherEnumId, bool32 viaAbility);

View File

@ -979,6 +979,8 @@ static void atk00_attackcanceler(void)
return;
}
if (AtkCanceller_UnableToUseMove2())
return;
if (AbilityBattleEffects(ABILITYEFFECT_MOVES_BLOCK, gBattlerTarget, 0, 0, 0))
return;
if (!gBattleMons[gBattlerAttacker].pp[gCurrMovePos] && gCurrentMove != MOVE_STRUGGLE && !(gHitMarker & (HITMARKER_x800000 | HITMARKER_NO_ATTACKSTRING))

View File

@ -1986,6 +1986,8 @@ enum
CANCELLER_BIDE,
CANCELLER_THAW,
CANCELLER_END,
CANCELLER_PSYCHIC_TERRAIN,
CANCELLER_END2,
};
u8 AtkCanceller_UnableToUseMove(void)
@ -2288,6 +2290,38 @@ u8 AtkCanceller_UnableToUseMove(void)
return effect;
}
// After Protean Activation.
u8 AtkCanceller_UnableToUseMove2(void)
{
u8 effect = 0;
do
{
switch (gBattleStruct->atkCancellerTracker)
{
case CANCELLER_END:
gBattleStruct->atkCancellerTracker++;
case CANCELLER_PSYCHIC_TERRAIN:
if (gFieldStatuses & STATUS_FIELD_PSYCHIC_TERRAIN
&& IsBattlerGrounded(gBattlerAttacker)
&& gBattleStruct->movePriorities[gBattlerAttacker] > 0
&& GetBattlerSide(gBattlerAttacker) != GetBattlerSide(gBattlerTarget))
{
CancelMultiTurnMoves(gBattlerAttacker);
gBattlescriptCurrInstr = BattleScript_MoveUsedPsychicTerrainPrevents;
gHitMarker |= HITMARKER_UNABLE_TO_USE_MOVE;
effect = 1;
}
gBattleStruct->atkCancellerTracker++;
break;
case CANCELLER_END2:
break;
}
} while (gBattleStruct->atkCancellerTracker != CANCELLER_END2 && effect == 0);
return effect;
}
bool8 HasNoMonsToSwitch(u8 battler, u8 partyIdBattlerOn1, u8 partyIdBattlerOn2)
{
struct Pokemon *party;