From 4060b09bd656ff2a6f31ec1b996a5196b3a5421d Mon Sep 17 00:00:00 2001 From: Evan Date: Fri, 27 Nov 2020 17:06:36 -0500 Subject: [PATCH] expand top left move window. add z move init anim --- asm/macros/battle_script.inc | 4 + data/battle_anim_scripts.s | 113 ++++++++++++++++++++- data/battle_scripts_1.s | 15 +++ include/battle.h | 6 +- include/constants/battle_anim.h | 1 + include/constants/battle_script_commands.h | 1 + include/constants/battle_string_ids.h | 4 +- src/battle_anim_new.c | 41 ++++++++ src/battle_bg.c | 8 +- src/battle_controller_player.c | 10 +- src/battle_message.c | 4 + src/battle_z_move.c | 3 +- 12 files changed, 193 insertions(+), 17 deletions(-) diff --git a/asm/macros/battle_script.inc b/asm/macros/battle_script.inc index 41a51efeb..42aa49173 100644 --- a/asm/macros/battle_script.inc +++ b/asm/macros/battle_script.inc @@ -1756,6 +1756,10 @@ .4byte \ptr .endm + .macro setzeffect + various BS_ATTACKER, VARIOUS_SET_Z_EFFECT + .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 70ed22c9e..281e88dda 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -767,7 +767,44 @@ gBattleAnims_Moves:: .4byte Move_JUNGLE_HEALING .4byte Move_WICKED_BLOW .4byte Move_SURGING_STRIKES - .4byte Move_COUNT @ cannot be reached, because last move is Surging Strikes +@@@@ Z MOVES + .4byte Move_BREAKNECK_BLITZ + .4byte Move_ALL_OUT_PUMMELING + .4byte Move_SUPERSONIC_SKYSTRIKE + .4byte Move_ACID_DOWNPOUR + .4byte Move_TECTONIC_RAGE + .4byte Move_CONTINENTAL_CRUSH + .4byte Move_SAVAGE_SPIN_OUT + .4byte Move_NEVER_ENDING_NIGHTMARE + .4byte Move_CORKSCREW_CRASH + .4byte Move_INFERNO_OVERDRIVE + .4byte Move_HYDRO_VORTEX + .4byte Move_BLOOM_DOOM + .4byte Move_GIGAVOLT_HAVOC + .4byte Move_SHATTERED_PSYCHE + .4byte Move_SUBZERO_SLAMMER + .4byte Move_DEVASTATING_DRAKE + .4byte Move_BLACK_HOLE_ECLIPSE + .4byte Move_TWINKLE_TACKLE + .4byte Move_CATASTROPIKA + .4byte Move_10000000_VOLT_THUNDERBOLT + .4byte Move_STOKED_SPARKSURFER + .4byte Move_EXTREME_EVOBOOST + .4byte Move_PULVERIZING_PANCAKE + .4byte Move_GENESIS_SUPERNOVA + .4byte Move_SINISTER_ARROW_RAID + .4byte Move_MALICIOUS_MOONSAULT + .4byte Move_OCEANIC_OPERETTA + .4byte Move_SPLINTERED_STORMSHARDS + .4byte Move_LETS_SNUGGLE_FOREVER + .4byte Move_CLANGOROUS_SOULBLAZE + .4byte Move_GUARDIAN_OF_ALOLA + .4byte Move_SEARING_SUNRAZE_SMASH + .4byte Move_MENACING_MOONRAZE_MAELSTROM + .4byte Move_LIGHT_THAT_BURNS_THE_SKY + .4byte Move_SOUL_STEALING_7_STAR_STRIKE +@@@ Last Move - cannot be reached + .4byte Move_COUNT .align 2 gBattleAnims_StatusConditions:: @@ -815,6 +852,7 @@ gBattleAnims_General:: .4byte General_IllusionOff .4byte General_FormChange .4byte General_SlideOffScreen + .4byte General_ZMoveActivate .align 2 gBattleAnims_Special:: @@ -24320,6 +24358,41 @@ General_TerrainElectric: General_TerrainPsychic: end +General_ZMoveActivate: + loadspritegfx ANIM_TAG_FOCUS_ENERGY @focus energy + loadspritegfx ANIM_TAG_Z_MOVE_SYMBOL @Z-Move Symbol + loadspritegfx ANIM_TAG_WHIP_HIT @green color + loadspritegfx ANIM_TAG_SWEAT_BEAD @blue color + loadspritegfx ANIM_TAG_PAW_PRINT @yellow color + monbg ANIM_ATTACKER + setblends 0x80c + fadetobg BG_ZMOVE_ACTIVATE + waitbgfadein + launchtask AnimTask_StartSlidingBg 0x5 0x4 0x0 0x0 0x0 0xFFFF + playsewithpan SE_M_SOLAR_BEAM, SOUND_PAN_ATTACKER + launchtask AnimTask_BlendColorCycle, 0x2, 0x6, ANIM_PAL_ATK, 0x0, 0x6, 0x0, 0xb, 0x76BC + call ZMoveBuffEffect + call ZMoveBuffEffect + call ZMoveBuffEffect + launchtemplate gZMoveSymbolSpriteTemplate 0x29 0x4 0x0 0x0 0x0 0x0 + call ZMoveBuffEffect + call ZMoveBuffEffect + waitforvisualfinish + call UnsetPsychicBg + blendoff + clearmonbg ANIM_ATTACKER + end +ZMoveBuffEffect: + launchtemplate gBlueZMoveEnergySpriteTemplate 0x2 0x4 0x0 0xffe8 0x1a 0x2 + delay 0x3 + launchtemplate gEndureEnergySpriteTemplate 0x2 0x4 0x0 0xe 0x1c 0x1 @Red Buff + delay 0x3 + launchtemplate gGreenZMoveEnergySpriteTemplate 0x2 0x4 0x0 0xfffb 0xa 0x2 + delay 0x3 + launchtemplate gYellowZMoveEnergySpriteTemplate 0x2 0x4 0x0 0x1c 0x1a 0x3 + delay 0x3 + return + SnatchMoveTrySwapFromSubstitute: createvisualtask AnimTask_IsAttackerBehindSubstitute, 2 jumprettrue SnatchMoveSwapSubstituteForMon @@ -24413,3 +24486,41 @@ Special_CriticalCaptureBallThrow: jumpreteq -1, BallThrowTrainerBlock goto BallThrowEnd +@@@@@@@@@@ Z MOVES @@@@@@@@@@ +Move_BREAKNECK_BLITZ:: +Move_ALL_OUT_PUMMELING: +Move_SUPERSONIC_SKYSTRIKE: +Move_ACID_DOWNPOUR: +Move_TECTONIC_RAGE: +Move_CONTINENTAL_CRUSH:: +Move_SAVAGE_SPIN_OUT:: +Move_NEVER_ENDING_NIGHTMARE:: +Move_CORKSCREW_CRASH:: +Move_INFERNO_OVERDRIVE:: +Move_HYDRO_VORTEX:: +Move_BLOOM_DOOM:: +Move_GIGAVOLT_HAVOC:: +Move_SHATTERED_PSYCHE:: +Move_SUBZERO_SLAMMER:: +Move_DEVASTATING_DRAKE:: +Move_BLACK_HOLE_ECLIPSE:: +Move_TWINKLE_TACKLE:: +Move_CATASTROPIKA:: +Move_10000000_VOLT_THUNDERBOLT:: +Move_STOKED_SPARKSURFER:: +Move_EXTREME_EVOBOOST:: +Move_PULVERIZING_PANCAKE:: +Move_GENESIS_SUPERNOVA:: +Move_SINISTER_ARROW_RAID:: +Move_MALICIOUS_MOONSAULT:: +Move_OCEANIC_OPERETTA:: +Move_SPLINTERED_STORMSHARDS:: +Move_LETS_SNUGGLE_FOREVER:: +Move_CLANGOROUS_SOULBLAZE:: +Move_GUARDIAN_OF_ALOLA:: +Move_SEARING_SUNRAZE_SMASH:: +Move_MENACING_MOONRAZE_MAELSTROM:: +Move_LIGHT_THAT_BURNS_THE_SKY:: +Move_SOUL_STEALING_7_STAR_STRIKE:: + goto Move_TACKLE + diff --git a/data/battle_scripts_1.s b/data/battle_scripts_1.s index f99f0089b..b595ca5d1 100644 --- a/data/battle_scripts_1.s +++ b/data/battle_scripts_1.s @@ -7686,3 +7686,18 @@ BattleScript_PrintPlayerForfeitedLinkBattle:: atk57 waitmessage 0x40 end2 + +BattleScript_ZMoveActivateStatus:: + printstring STRINGID_ZPOWERSURROUNDS + playanimation BS_ATTACKER, B_ANIM_ZMOVE_ACTIVATE, NULL + setzeffect + printstring STRINGID_ZMOVEUNLEASHED + waitmessage 0x40 + return + +BattleScript_ZMoveActivateDamaging:: + printstring STRINGID_ZPOWERSURROUNDS + playanimation BS_ATTACKER, B_ANIM_ZMOVE_ACTIVATE, NULL + printstring STRINGID_ZMOVEUNLEASHED + waitmessage 0x40 + return diff --git a/include/battle.h b/include/battle.h index 0e484746e..06b2a942c 100644 --- a/include/battle.h +++ b/include/battle.h @@ -429,10 +429,10 @@ struct Illusion struct ZMoveData { - /*0x00*/ u8 battlerId; - /*0x01*/ u8 viable:1; // current move can become a z move - u8 viewingZMove:1; //if player is viewing the z move name instead of regular moves + /*0x00*/ u8 viable:1; // current move can become a z move + u8 viewing:1; //if player is viewing the z move name instead of regular moves u8 split:2; + u8 active:1; //is z move being used this turn u8 zUnused:4; /*0x02*/ u16 currZMove; //z move of cursor / selected z move /*0x04*/ u16 baseMove; //move turned into z move diff --git a/include/constants/battle_anim.h b/include/constants/battle_anim.h index 871aa1e35..4d4e8f745 100644 --- a/include/constants/battle_anim.h +++ b/include/constants/battle_anim.h @@ -525,6 +525,7 @@ #define B_ANIM_ILLUSION_OFF 0x1C #define B_ANIM_FORM_CHANGE 0x1D #define B_ANIM_SLIDE_OFFSCREEN 0x1E // for Emergency Exit +#define B_ANIM_ZMOVE_ACTIVATE 0x1F // special animations table #define B_ANIM_LVL_UP 0x0 diff --git a/include/constants/battle_script_commands.h b/include/constants/battle_script_commands.h index b081907ec..8df5a0518 100644 --- a/include/constants/battle_script_commands.h +++ b/include/constants/battle_script_commands.h @@ -165,6 +165,7 @@ #define VARIOUS_SET_LAST_USED_ITEM 99 #define VARIOUS_PARALYZE_TYPE_IMMUNITY 100 #define VARIOUS_JUMP_IF_ABSENT 101 +#define VARIOUS_SET_Z_EFFECT 102 // Cmd_manipulatedamage #define DMG_CHANGE_SIGN 0 diff --git a/include/constants/battle_string_ids.h b/include/constants/battle_string_ids.h index 3c6d74b48..12b193f2d 100644 --- a/include/constants/battle_string_ids.h +++ b/include/constants/battle_string_ids.h @@ -551,7 +551,9 @@ #define STRINGID_CLOAKEDINAFREEZINGLIGHT 547 #define STRINGID_STATWASNOTLOWERED 548 #define STRINGID_FERVENTWISHREACHED 549 +#define STRINGID_ZPOWERSURROUNDS 550 +#define STRINGID_ZMOVEUNLEASHED 551 -#define BATTLESTRINGS_COUNT 550 +#define BATTLESTRINGS_COUNT 552 #endif // GUARD_CONSTANTS_BATTLE_STRING_IDS_H diff --git a/src/battle_anim_new.c b/src/battle_anim_new.c index 9d1b48453..741eeb295 100644 --- a/src/battle_anim_new.c +++ b/src/battle_anim_new.c @@ -4050,6 +4050,47 @@ const struct SpriteTemplate gSteelBeamSpikeShardTemplate = }; //// Z MOVES +//activate +const struct SpriteTemplate gZMoveSymbolSpriteTemplate = +{ + .tileTag = ANIM_TAG_Z_MOVE_SYMBOL, + .paletteTag = ANIM_TAG_Z_MOVE_SYMBOL, + .oam = &gOamData_AffineDouble_ObjBlend_64x64, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gAffineAnims_LusterPurgeCircle, + .callback = AnimSpriteOnMonPos +}; +const struct SpriteTemplate gBlueZMoveEnergySpriteTemplate = +{ + .tileTag = ANIM_TAG_FOCUS_ENERGY, + .paletteTag = ANIM_TAG_SWEAT_BEAD, + .oam = &gOamData_AffineOff_ObjNormal_16x32, + .anims = gEndureEnergyAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimEndureEnergy, +}; +const struct SpriteTemplate gGreenZMoveEnergySpriteTemplate = +{ + .tileTag = ANIM_TAG_FOCUS_ENERGY, + .paletteTag = ANIM_TAG_WHIP_HIT, + .oam = &gOamData_AffineOff_ObjNormal_16x32, + .anims = gEndureEnergyAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimEndureEnergy, +}; +const struct SpriteTemplate gYellowZMoveEnergySpriteTemplate = +{ + .tileTag = ANIM_TAG_FOCUS_ENERGY, + .paletteTag = ANIM_TAG_PAW_PRINT, + .oam = &gOamData_AffineOff_ObjNormal_16x32, + .anims = gEndureEnergyAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimEndureEnergy, +}; /* // breakneck blitz const struct SpriteTemplate gBreakneckBlitzDanceSpriteTemplate = diff --git a/src/battle_bg.c b/src/battle_bg.c index d9d6bf87c..d64dd1a0b 100644 --- a/src/battle_bg.c +++ b/src/battle_bg.c @@ -192,7 +192,7 @@ static const struct WindowTemplate gStandardBattleWindowTemplates[] = .bg = 0, .tilemapLeft = 2, .tilemapTop = 55, - .width = 8, + .width = 12, //for z move names .height = 2, .paletteNum = 5, .baseBlock = 0x0300, @@ -204,7 +204,7 @@ static const struct WindowTemplate gStandardBattleWindowTemplates[] = .width = 8, .height = 2, .paletteNum = 5, - .baseBlock = 0x0310, + .baseBlock = 0x0318, }, { // 5 Bottom left move .bg = 0, @@ -213,7 +213,7 @@ static const struct WindowTemplate gStandardBattleWindowTemplates[] = .width = 8, .height = 2, .paletteNum = 5, - .baseBlock = 0x0320, + .baseBlock = 0x0328, }, { // 6 Bottom right move .bg = 0, @@ -222,7 +222,7 @@ static const struct WindowTemplate gStandardBattleWindowTemplates[] = .width = 8, .height = 2, .paletteNum = 5, - .baseBlock = 0x0330, + .baseBlock = 0x0338, }, { .bg = 0, diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index fb1f844a7..d69d1a948 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -630,7 +630,7 @@ static void HandleInputChooseMove(void) else if (JOY_NEW(B_BUTTON) || gPlayerDpadHoldFrames > 59) { PlaySE(SE_SELECT); - if (gBattleStruct->zmove.viewingZMove) + if (gBattleStruct->zmove.viewing) { ReloadMoveNames(); } @@ -697,7 +697,7 @@ static void HandleInputChooseMove(void) TryChangeZIndicator(gActiveBattler, moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]); } } - else if (JOY_NEW(SELECT_BUTTON)) + else if (JOY_NEW(SELECT_BUTTON) && !gBattleStruct->zmove.viewing) { if (gNumberOfMovesToChoose > 1 && !(gBattleTypeFlags & BATTLE_TYPE_LINK)) { @@ -725,10 +725,8 @@ static void HandleInputChooseMove(void) { // show z move name / info //TODO: brighten z move symbol - //ChangeMegaTriggerSprite(gBattleStruct->zmove.triggerSpriteId, gBattleStruct->zmove.viable); PlaySE(SE_SELECT); - - if (!gBattleStruct->zmove.viewingZMove) + if (!gBattleStruct->zmove.viewing) MoveSelectionDisplayZMove(gBattleStruct->zmove.currZMove); else ReloadMoveNames(); @@ -739,7 +737,7 @@ static void HandleInputChooseMove(void) static void ReloadMoveNames(void) { gBattleStruct->mega.playerSelect = FALSE; - gBattleStruct->zmove.viewingZMove = FALSE; + gBattleStruct->zmove.viewing = FALSE; MoveSelectionDestroyCursorAt(0); MoveSelectionDisplayMoveNames(); MoveSelectionCreateCursorAt(gMoveSelectionCursor[gActiveBattler], 0); diff --git a/src/battle_message.c b/src/battle_message.c index 04a939ad6..b8503e67a 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -677,6 +677,8 @@ static const u8 sText_NoOneWillBeAbleToRun[] = _("No one will be able to run awa static const u8 sText_DestinyKnotActivates[] = _("{B_SCR_ACTIVE_NAME_WITH_PREFIX} fell in love\nfrom the {B_LAST_ITEM}!"); static const u8 sText_CloakedInAFreezingLight[] = _("{B_ATK_NAME_WITH_PREFIX} became cloaked\nin a freezing light!"); static const u8 sText_StatWasNotLowered[] = _("{B_DEF_NAME_WITH_PREFIX}'s {B_BUFF1}\nwas not lowered!"); +static const u8 sText_ZPowerSurrounds[] = _("{B_ATK_NAME_WITH_PREFIX} surrounds\nitself with its Z-Power!"); +static const u8 sText_ZPowerUnleashed[] = _("{B_ATK_NAME_WITH_PREFIX} unleashes\nits full-force Z-Move!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = { @@ -1218,6 +1220,8 @@ const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = [STRINGID_GRASSYTERRAINHEALS - 12] = sText_GrassyTerrainHeals, [STRINGID_ELECTRICTERRAINPREVENTS - 12] = sText_ElectricTerrainPreventsSleep, [STRINGID_PSYCHICTERRAINPREVENTS - 12] = sText_PsychicTerrainPreventsPriority, + [STRINGID_ZPOWERSURROUNDS - 12] = sText_ZPowerSurrounds, + [STRINGID_ZMOVEUNLEASHED - 12] = sText_ZPowerUnleashed, }; const u16 gTerrainStringIds[] = diff --git a/src/battle_z_move.c b/src/battle_z_move.c index 446a1d790..b250a06be 100644 --- a/src/battle_z_move.c +++ b/src/battle_z_move.c @@ -316,7 +316,6 @@ bool32 IsZMoveTriggerSpriteActive(void) void HideZMoveTriggerSprite(void) { struct Sprite *sprite = &gSprites[gBattleStruct->zmove.triggerSpriteId]; - ChangeMegaTriggerSprite(gBattleStruct->zmove.triggerSpriteId, 0); sprite->tHide = TRUE; gBattleStruct->zmove.viable = FALSE; } @@ -375,7 +374,7 @@ bool32 MoveSelectionDisplayZMove(u16 zmove) u16 move = moveInfo->moves[gMoveSelectionCursor[gActiveBattler]]; PlaySE(SE_SELECT); - gBattleStruct->zmove.viewingZMove = TRUE; + gBattleStruct->zmove.viewing = TRUE; if (zmove != MOVE_NONE) { // clear move slots