diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index d64336638b..238c0e21bd 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -441,14 +441,18 @@ BattleScript_EffectStoneAxe:: waitmessage B_WAIT_TIME_LONG resultmessage waitmessage B_WAIT_TIME_LONG - seteffectwithchance tryfaintmon BS_TARGET - setstealthrock BattleScript_ButItFailed - printstring STRINGID_POINTEDSTONESFLOAT - waitmessage B_WAIT_TIME_LONG + setmoveeffect MOVE_EFFECT_STEALTH_ROCK + seteffectprimary moveendall end +BattleScript_StealthRockActivates:: + setstealthrock BattleScript_MoveEnd + printstring STRINGID_POINTEDSTONESFLOAT + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + BattleScript_EffectDireClaw:: setmoveeffect MOVE_EFFECT_DIRE_CLAW goto BattleScript_EffectHit @@ -472,14 +476,18 @@ BattleScript_EffectCeaselessEdge:: waitmessage B_WAIT_TIME_LONG resultmessage waitmessage B_WAIT_TIME_LONG - seteffectwithchance tryfaintmon BS_TARGET - trysetspikes BattleScript_ButItFailedAtkStringPpReduce - printstring STRINGID_SPIKESSCATTERED - waitmessage B_WAIT_TIME_LONG + setmoveeffect MOVE_EFFECT_SPIKES + seteffectprimary moveendall end +BattleScript_SpikesActivate:: + trysetspikes BattleScript_MoveEnd + printstring STRINGID_SPIKESSCATTERED + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + BattleScript_EffectTeatime:: attackcanceler attackstring diff --git a/include/battle_scripts.h b/include/battle_scripts.h index d79566a44b..55caf9022f 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -448,6 +448,8 @@ extern const u8 BattleScript_SupremeOverlordActivates[]; extern const u8 BattleScript_CostarActivates[]; extern const u8 BattleScript_ToxicDebrisActivates[]; extern const u8 BattleScript_EarthEaterActivates[]; +extern const u8 BattleScript_StealthRockActivates[]; +extern const u8 BattleScript_SpikesActivate[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/constants/battle.h b/include/constants/battle.h index fa9d4bd186..e7e65951b1 100644 --- a/include/constants/battle.h +++ b/include/constants/battle.h @@ -372,8 +372,10 @@ #define MOVE_EFFECT_TRAP_BOTH 70 #define MOVE_EFFECT_DOUBLE_SHOCK 71 #define MOVE_EFFECT_DIRE_CLAW 72 +#define MOVE_EFFECT_STEALTH_ROCK 73 +#define MOVE_EFFECT_SPIKES 74 -#define NUM_MOVE_EFFECTS 73 +#define NUM_MOVE_EFFECTS 75 #define MOVE_EFFECT_AFFECTS_USER 0x4000 #define MOVE_EFFECT_CERTAIN 0x8000 diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index fcf09641f5..9a8a2cabf6 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -2789,6 +2789,7 @@ void SetMoveEffect(bool32 primary, u32 certain) bool32 mirrorArmorReflected = (GetBattlerAbility(gBattlerTarget) == ABILITY_MIRROR_ARMOR); u32 flags = 0; u16 battlerAbility; + bool8 activateAfterFaint = FALSE; if (gSpecialStatuses[gBattlerAttacker].parentalBondState == PARENTAL_BOND_1ST_HIT && gBattleMons[gBattlerTarget].hp != 0 @@ -2806,6 +2807,10 @@ void SetMoveEffect(bool32 primary, u32 certain) gBattleStruct->moveEffect2 = gBattleScripting.moveEffect; gBattlescriptCurrInstr++; return; + case MOVE_EFFECT_STEALTH_ROCK: + case MOVE_EFFECT_SPIKES: + activateAfterFaint = TRUE; + break; } if (gBattleScripting.moveEffect & MOVE_EFFECT_AFFECTS_USER) @@ -2838,6 +2843,7 @@ void SetMoveEffect(bool32 primary, u32 certain) INCREMENT_RESET_RETURN if (gBattleMons[gEffectBattler].hp == 0 + && !activateAfterFaint && gBattleScripting.moveEffect != MOVE_EFFECT_PAYDAY && gBattleScripting.moveEffect != MOVE_EFFECT_STEAL_ITEM && gBattleScripting.moveEffect != MOVE_EFFECT_BUG_BITE) @@ -3659,6 +3665,20 @@ void SetMoveEffect(bool32 primary, u32 certain) SetMoveEffect(TRUE, 0); } break; + case MOVE_EFFECT_STEALTH_ROCK: + if (!(gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_STEALTH_ROCK)) + { + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_StealthRockActivates; + } + break; + case MOVE_EFFECT_SPIKES: + if (!(gSideStatuses[GetBattlerSide(gEffectBattler)] & SIDE_STATUS_SPIKES)) + { + BattleScriptPush(gBattlescriptCurrInstr + 1); + gBattlescriptCurrInstr = BattleScript_SpikesActivate; + } + break; } } }