From c2bd046ea670c7abf4b5fd827887bbdf6495060a Mon Sep 17 00:00:00 2001 From: Xhyzi Date: Tue, 15 Jun 2021 20:22:50 +0200 Subject: [PATCH] Shell Trap --- asm/macros/battle_script.inc | 13 +++++++ data/battle_anim_scripts.s | 5 +-- data/battle_scripts_1.s | 41 ++++++++++++++++++++++ include/battle.h | 1 + include/battle_scripts.h | 3 ++ include/constants/battle_anim.h | 1 + include/constants/battle_move_effects.h | 3 +- include/constants/battle_script_commands.h | 3 ++ include/constants/battle_string_ids.h | 3 +- src/battle_main.c | 3 ++ src/battle_message.c | 2 ++ src/data/battle_moves.h | 4 +-- 12 files changed, 76 insertions(+), 6 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 5cef3c769..6ae9fce29 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1782,6 +1782,19 @@ various BS_ATTACKER, VARIOUS_SWAP_SIDE_STATUSES .endm + .macro setshelltrap battler:req + various \battler, VARIOUS_SET_SHELL_TRAP + .endm + + .macro clearshelltrap battler:req + various \battler, VARIOUS_CLEAR_SHELL_TRAP + .endm + + .macro checkshelltrap battler:req, ptr:req + various \battler, VARIOUS_CHECK_SHELL_TRAP + .4byte \ptr + .endm + @ helpful macros .macro setstatchanger stat:req, stages:req, down:req setbyte sSTATCHANGER \stat | \stages << 3 | \down << 7 diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index ee401010a..96dae719f 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -823,6 +823,7 @@ gBattleAnims_General:: .4byte General_RestoreBg @ B_ANIM_RESTORE_BG .4byte General_TotemFlare @ B_ANIM_TOTEM_FLARE .4byte General_BeakBlastSetUp @ B_ANIM_BEAK_BLAST_SETUP + .4byte General_ShellTrapSetUp @ B_ANIM_SHELL_TRAP_SETUP .align 2 gBattleAnims_Special:: @@ -11831,8 +11832,7 @@ Move_AURORA_VEIL:: blendoff end -Move_SHELL_TRAP:: -ShellTrapChargeUp: +General_ShellTrapSetUp: loadspritegfx ANIM_TAG_SMALL_EMBER loadspritegfx ANIM_TAG_IMPACT monbg ANIM_TARGET @@ -11849,6 +11849,7 @@ ShellTrapChargeUp: clearmonbg ANIM_TARGET blendoff end +Move_SHELL_TRAP:: ShellTrapUnleash: loadspritegfx ANIM_TAG_IMPACT @pound loadspritegfx ANIM_TAG_SMALL_RED_EYE @red diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index bf501678c..f64b42e51 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -377,6 +377,47 @@ gBattleScriptsForMoveEffects:: @ 82D86A8 .4byte BattleScript_EffectBeakBlast .4byte BattleScript_EffectTerrainPulse .4byte BattleScript_EffectCourtChange + .4byte BattleScript_EffectShellTrap + +BattleScript_EffectShellTrap:: + checkshelltrap BS_ATTACKER, BattleScript_MoveEnd + clearshelltrap BS_ATTACKER + attackcanceler + attackstring + goto BattleScript_ButItFailed + +BattleScript_ShellTrapSetUp:: + setshelltrap BS_ATTACKER + printstring STRINGID_EMPTYSTRING3 + waitmessage 0x1 + playanimation BS_ATTACKER B_ANIM_SHELL_TRAP_SETUP, NULL + printstring STRINGID_PREPARESHELLTRAP + waitmessage 0x40 + end2 + +BattleScript_ShellTrapExplode:: + clearshelltrap BS_ATTACKER + attackcanceler + attackstring + ppreduce + critcalc + damagecalc + adjustdamage + attackanimation + waitanimation + effectivenesssound + hitanimation BS_TARGET + waitstate + healthbarupdate BS_TARGET + datahpupdate BS_TARGET + critmessage + waitmessage 0x40 + resultmessage + waitmessage 0x40 + seteffectwithchance + tryfaintmon BS_TARGET, FALSE, NULL + moveendall + end BattleScript_EffectCourtChange:: attackcanceler diff --git a/include/battle.h b/include/battle.h index a86c6d34e..18e12fc18 100644 --- a/include/battle.h +++ b/include/battle.h @@ -145,6 +145,7 @@ struct ProtectStruct u32 micle:1; u32 custap:1; // also quick claw u32 beakBlastCharge:1; + u32 shellTrap:1; u32 physicalDmg; u32 specialDmg; u8 physicalBattlerId; diff --git a/include/battle_scripts.h b/include/battle_scripts.h index ffb824f0b..71a8a50a4 100644 --- a/include/battle_scripts.h +++ b/include/battle_scripts.h @@ -372,5 +372,8 @@ extern const u8 BattleScript_BattlerGotOverItsInfatuation[]; extern const u8 BattleScript_MeltedItem[]; extern const u8 BattleScript_BeakBlastSetUp[]; extern const u8 BattleScript_BeakBlastBurn[]; +extern const u8 BattleScript_ShellTrapSetUp[]; +extern const u8 BattleScript_ShellTrapExplode[]; +extern const u8 BattleScript_EffectShellTrap[]; #endif // GUARD_BATTLE_SCRIPTS_H diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index cfccef926..c98007127 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -524,6 +524,7 @@ #define B_ANIM_RESTORE_BG 27 // for Terrain Endings #define B_ANIM_TOTEM_FLARE 28 // Totem boosts aura flare #define B_ANIM_BEAK_BLAST_SETUP 29 +#define B_ANIM_SHELL_TRAP_SETUP 30 // special animations table (gBattleAnims_Special) #define B_ANIM_LVL_UP 0 diff --git a/include/constants/battle_move_effects.h b/include/constants/battle_move_effects.h index b6ad6e487..cc5e94acd 100644 --- a/include/constants/battle_move_effects.h +++ b/include/constants/battle_move_effects.h @@ -361,7 +361,8 @@ #define EFFECT_BEAK_BLAST 355 #define EFFECT_TERRAIN_PULSE 356 #define EFFECT_COURT_CHANGE 357 +#define EFFECT_SHELL_TRAP 358 -#define NUM_BATTLE_MOVE_EFFECTS 358 +#define NUM_BATTLE_MOVE_EFFECTS 359 #endif // GUARD_CONSTANTS_BATTLE_MOVE_EFFECTS_H diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index 8ae661af3..6e67bd954 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -176,6 +176,9 @@ #define VARIOUS_TRY_SET_CORROSIVE_GAS 105 #define VARIOUS_SET_BEAK_BLAST 106 #define VARIOUS_SWAP_SIDE_STATUSES 107 +#define VARIOUS_SET_SHELL_TRAP 108 +#define VARIOUS_CLEAR_SHELL_TRAP 109 +#define VARIOUS_CHECK_SHELL_TRAP 110 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index cfe25be1b..823164717 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -575,8 +575,9 @@ #define STRINGID_ITEMMELTED 571 #define STRINGID_HEATUPBEAK 572 #define STRINGID_COURTCHANGE 573 +#define STRINGID_PREPARESHELLTRAP 574 -#define BATTLESTRINGS_COUNT 574 +#define BATTLESTRINGS_COUNT 575 // The below IDs are all indexes into battle message tables, // used to determine which of a set of messages to print. diff --git a/src/battle_main.c b/src/battle_main.c index 9f5105151..223188652 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -4610,6 +4610,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 2a9d80424..6d39cf84c 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -701,9 +701,11 @@ static const u8 sText_MeteorBeamCharging[] = _("{B_ATK_NAME_WITH_PREFIX} is over static const u8 sText_PkmnItemMelted[] = _("{B_ATK_NAME_WITH_PREFIX} corroded\n{B_DEF_NAME_WITH_PREFIX}'s {B_LAST_ITEM}!"); static const u8 sText_HeatingUpBeak[] = _("{B_ATK_NAME_WITH_PREFIX} started\nheating up its beak!"); static const u8 sText_CourtChange[] = _("{B_ATK_NAME_WITH_PREFIX} swapped the battle\neffects affecting each side!"); +static const u8 sText_PrepareShellTrap[] = _("{B_ATK_NAME_WITH_PREFIX} set\n a shell trap!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { + [STRINGID_PREPARESHELLTRAP - 12] = sText_PrepareShellTrap, [STRINGID_COURTCHANGE - 12] = sText_CourtChange, [STRINGID_HEATUPBEAK - 12] = sText_HeatingUpBeak, [STRINGID_ITEMMELTED - 12] = sText_PkmnItemMelted, diff --git a/src/data/battle_moves.h b/src/data/battle_moves.h index 6c8bdd7b7..abcd8a100 100644 --- a/src/data/battle_moves.h +++ b/src/data/battle_moves.h @@ -10197,13 +10197,13 @@ const struct BattleMove gBattleMoves[MOVES_COUNT] = [MOVE_SHELL_TRAP] = { - .effect = EFFECT_PLACEHOLDER, + .effect = EFFECT_SHELL_TRAP, .power = 150, .type = TYPE_FIRE, .accuracy = 100, .pp = 5, .secondaryEffectChance = 0, - .target = MOVE_TARGET_SELECTED, + .target = MOVE_TARGET_OPPONENTS_FIELD, .priority = -3, .flags = FLAG_PROTECT_AFFECTED | FLAG_KINGS_ROCK_AFFECTED, .split = SPLIT_SPECIAL,