diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index d1d1e670f..f2a0223cf 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -417,6 +417,24 @@ gBattleScriptsForMoveEffects:: .4byte BattleScript_EffectSpecialAttackUpHit @ EFFECT_SPECIAL_ATTACK_UP_HIT .4byte BattleScript_EffectVictoryDance @ EFFECT_VICTORY_DANCE .4byte BattleScript_EffectCeaselessEdge @ EFFECT_CEASELESS_EDGE + .4byte BattleScript_EffectShellTrap @ EFFECT_SHELL_TRAP + +BattleScript_EffectShellTrap: + jumpifnodamage BattleScript_EffectShellTrap_Failed + goto BattleScript_EffectHit + +BattleScript_EffectShellTrap_Failed: + printstring STRINGID_ATTACKERSHELLTRAPDIDNTWORK + waitmessage B_WAIT_TIME_LONG + goto BattleScript_MoveEnd + +BattleScript_ShellTrapSetUp:: + printstring STRINGID_EMPTYSTRING3 + waitmessage 1 + playanimation BS_ATTACKER, B_ANIM_SHELL_TRAP_SETUP, NULL + printstring STRINGID_ATTACKERSETASHELLTRAP + waitmessage B_WAIT_TIME_LONG + end2 BattleScript_EffectCeaselessEdge:: call BattleScript_EffectHit_Ret diff --git a/include/battle_scripts.h b/include/battle_scripts.h index 75afdbf63..89ad9302b 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -433,6 +433,7 @@ extern const u8 BattleScript_MultiHitPrintStrings[]; extern const u8 BattleScript_BurnUpRemoveType[]; extern const u8 BattleScript_TargetAbilityStatRaiseRet[]; extern const u8 BattleScript_DoubleShockRemoveType[]; +extern const u8 BattleScript_ShellTrapSetUp[]; // zmoves extern const u8 BattleScript_ZMoveActivateDamaging[]; diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index 1ac102c35..c16084c30 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -398,7 +398,8 @@ #define EFFECT_SPECIAL_ATTACK_UP_HIT 392 #define EFFECT_VICTORY_DANCE 393 #define EFFECT_CEASELESS_EDGE 394 +#define EFFECT_SHELL_TRAP 395 -#define NUM_BATTLE_MOVE_EFFECTS 395 +#define NUM_BATTLE_MOVE_EFFECTS 396 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 8dd94cca4..64ddcbebd 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -632,8 +632,10 @@ #define STRINGID_TARGETTOUGHEDITOUT 630 #define STRINGID_ATTACKERLOSTELECTRICTYPE 631 #define STRINGID_ATTACKERSWITCHEDSTATWITHTARGET 632 +#define STRINGID_ATTACKERSETASHELLTRAP 633 +#define STRINGID_ATTACKERSHELLTRAPDIDNTWORK 634 -#define BATTLESTRINGS_COUNT 633 +#define BATTLESTRINGS_COUNT 635 // This is the string id that gBattleStringsTable starts with. // String ids before this (e.g. STRINGID_INTROMSG) are not in the table, diff --git a/src/battle_main.c b/src/battle_main.c index d138cf231..8ba87133e 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -101,7 +101,7 @@ static void SetActionsAndBattlersTurnOrder(void); static void UpdateBattlerPartyOrdersOnSwitch(void); static bool8 AllAtActionConfirmed(void); static void TryChangeTurnOrder(void); -static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void); +static void CheckChosenMoveForEffectsBeforeTurnStarts(void); static void CheckMegaEvolutionBeforeTurn(void); static void CheckQuickClaw_CustapBerryActivation(void); static void FreeResetData_ReturnToOvOrDoEvolutions(void); @@ -4878,7 +4878,7 @@ static void CheckMegaEvolutionBeforeTurn(void) } #if B_MEGA_EVO_TURN_ORDER <= GEN_6 - gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts; + gBattleMainFunc = CheckChosenMoveForEffectsBeforeTurnStarts; gBattleStruct->focusPunchBattlerId = 0; #else gBattleMainFunc = TryChangeTurnOrder; // This will just do nothing if no mon has mega evolved @@ -4903,11 +4903,11 @@ static void TryChangeTurnOrder(void) } } } - gBattleMainFunc = CheckFocusPunch_ClearVarsBeforeTurnStarts; + gBattleMainFunc = CheckChosenMoveForEffectsBeforeTurnStarts; gBattleStruct->focusPunchBattlerId = 0; } -static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void) +static void CheckChosenMoveForEffectsBeforeTurnStarts(void) { u32 i; @@ -4921,7 +4921,7 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void) && !(gDisableStructs[gBattlerAttacker].truantCounter) && !(gProtectStructs[gActiveBattler].noValidMoves)) { - switch(gChosenMoveByBattler[gActiveBattler]) + switch (gChosenMoveByBattler[gActiveBattler]) { case MOVE_FOCUS_PUNCH: BattleScriptExecute(BattleScript_FocusPunchSetUp); @@ -4929,6 +4929,9 @@ static void CheckFocusPunch_ClearVarsBeforeTurnStarts(void) case MOVE_BEAK_BLAST: BattleScriptExecute(BattleScript_BeakBlastSetUp); return; + case MOVE_SHELL_TRAP: + BattleScriptExecute(BattleScript_ShellTrapSetUp); + return; } } } diff --git a/src/battle_message.c b/src/battle_message.c index 031261a28..60578897e 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -761,9 +761,13 @@ static const u8 sText_AttackerMeltedTheIce[] = _("{B_ATK_NAME_WITH_PREFIX} melte static const u8 sText_TargetToughedItOut[] = _("{B_DEF_NAME_WITH_PREFIX} toughed it out\nto show you its best side!"); static const u8 sText_AttackerLostElectricType[] = _("{B_ATK_NAME_WITH_PREFIX} used up all\nof its electricity!"); static const u8 sText_AttackerSwitchedStatWithTarget[] = _("{B_ATK_NAME_WITH_PREFIX} switched {B_BUFF1}\nwith its target!"); +static const u8 sText_AttackerSetAShellTrap[] = _("{B_ATK_NAME_WITH_PREFIX} set\na shell trap!"); +static const u8 sText_AttackerShellTrapDidntWork[] = _("{B_ATK_NAME_WITH_PREFIX}'s shell trap\ndidn't work!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_ATTACKERSHELLTRAPDIDNTWORK - BATTLESTRINGS_TABLE_START] = sText_AttackerShellTrapDidntWork, + [STRINGID_ATTACKERSETASHELLTRAP - BATTLESTRINGS_TABLE_START] = sText_AttackerSetAShellTrap, [STRINGID_ATTACKERSWITCHEDSTATWITHTARGET - BATTLESTRINGS_TABLE_START] = sText_AttackerSwitchedStatWithTarget, [STRINGID_TARGETTOUGHEDITOUT - BATTLESTRINGS_TABLE_START] = sText_TargetToughedItOut, [STRINGID_ATTACKERMELTEDTHEICE - BATTLESTRINGS_TABLE_START] = sText_AttackerMeltedTheIce, diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index 9c780c28e..3d85d1379 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -10031,7 +10031,7 @@ static void Cmd_various(void) gBattleMons[gActiveBattler].item = gLastUsedItem; break; case VARIOUS_SET_BEAK_BLAST: - gProtectStructs[gBattlerAttacker].beakBlastCharge = TRUE; + gProtectStructs[gActiveBattler].beakBlastCharge = TRUE; break; case VARIOUS_SWAP_SIDE_STATUSES: CourtChangeSwapSideStatuses(); @@ -11926,8 +11926,9 @@ static void Cmd_trysetencore(void) } if (gLastMoves[gBattlerTarget] == MOVE_STRUGGLE - || gLastMoves[gBattlerTarget] == MOVE_ENCORE - || gLastMoves[gBattlerTarget] == MOVE_MIRROR_MOVE) + || gLastMoves[gBattlerTarget] == MOVE_ENCORE + || gLastMoves[gBattlerTarget] == MOVE_MIRROR_MOVE + || gLastMoves[gBattlerTarget] == MOVE_SHELL_TRAP) { i = MAX_MON_MOVES; } diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 225da6ff7..6badf0ee5 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -11616,7 +11616,7 @@ const struct BattleMove gBattleMoves[MOVES_COUNT_Z] = [MOVE_SHELL_TRAP] = { - .effect = EFFECT_PLACEHOLDER, // EFFECT_SHELL_TRAP, + .effect = EFFECT_SHELL_TRAP, .power = 150, .type = TYPE_FIRE, .accuracy = 100,