diff --git a/data/battle_anim_scripts.s b/data/battle_anim_scripts.s index dac93b4675..912676a1aa 100644 --- a/data/battle_anim_scripts.s +++ b/data/battle_anim_scripts.s @@ -1464,6 +1464,23 @@ Move_DARK_PULSE: end Move_NIGHT_SLASH: + loadspritegfx ANIM_TAG_SLASH + createvisualtask AnimTask_BlendNightSlash, 2, ANIM_TARGET, 2, 0, 8, 1 + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 3, 0, 12, RGB_BLACK + waitforvisualfinish + createsprite gNightSlashLeftSpriteTemplate, ANIM_TARGET, 2, 1, -8, 0 + playsewithpan SE_W013, SOUND_PAN_TARGET + delay 4 + createsprite gNightSlashLeftSpriteTemplate, ANIM_TARGET, 2, 1, 8, 0 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 2, 0, 8, 1 + delay 40 + createsprite gNightSlashRightSpriteTemplate, ANIM_TARGET, 2, 1, -8, 0 + createsprite gNightSlashRightSpriteTemplate, ANIM_TARGET, 2, 1, 8, 0 + createvisualtask AnimTask_ShakeMon2, 2, ANIM_TARGET, 4, 0, 18, 1 + playsewithpan SE_W013, SOUND_PAN_TARGET + waitforvisualfinish + createsprite gSimplePaletteBlendSpriteTemplate, ANIM_ATTACKER, 0, 1, 3, 12, 0, RGB_BLACK + waitforvisualfinish end Move_AQUA_TAIL: diff --git a/src/effects_1.c b/src/effects_1.c index fc29fe6a28..0cabed63e0 100644 --- a/src/effects_1.c +++ b/src/effects_1.c @@ -2104,10 +2104,12 @@ const struct SpriteTemplate gPowerOrbs_Float = }; #include "random.h" +#include "util.h" void AnimRockPolishStreak(struct Sprite *); void AnimRockPolishSparkle(struct Sprite *); void AnimPoisonJabProjectile(struct Sprite *); +void AnimNightSlash(struct Sprite *); const union AnimCmd gRockPolishStreak_AnimCmd[] = { @@ -2333,3 +2335,80 @@ void AnimPoisonJabProjectile(struct Sprite *sprite) sprite->callback = StartAnimLinearTranslation; StoreSpriteCallbackInData6(sprite, DestroyAnimSprite); } + +const union AnimCmd gNightSlashLeftAnimCmd0[] = +{ + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(16, 4), + ANIMCMD_FRAME(32, 4), + ANIMCMD_FRAME(48, 4), + ANIMCMD_END, +}; + +const union AnimCmd gNightSlashLeftAnimCmd1[] = +{ + ANIMCMD_FRAME(48, 4), + ANIMCMD_END, +}; + +const union AnimCmd *const gNightSlashLeftAnimTable[] = +{ + gNightSlashLeftAnimCmd0, + gNightSlashLeftAnimCmd1, +}; + +const struct SpriteTemplate gNightSlashLeftSpriteTemplate = +{ + .tileTag = ANIM_TAG_SLASH, + .paletteTag = ANIM_TAG_SLASH, + .oam = &gUnknown_08524914, + .anims = gNightSlashLeftAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimNightSlash, +}; + +const union AnimCmd gNightSlashRightAnimCmd0[] = +{ + ANIMCMD_FRAME(0, 4, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(16, 4, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(32, 4, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_FRAME(48, 4, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd gNightSlashRightAnimCmd1[] = +{ + ANIMCMD_FRAME(48, 4, .vFlip = TRUE, .hFlip = TRUE), + ANIMCMD_END, +}; + +const union AnimCmd *const gNightSlashRightAnimTable[] = +{ + gNightSlashRightAnimCmd0, + gNightSlashRightAnimCmd1, +}; + +const struct SpriteTemplate gNightSlashRightSpriteTemplate = +{ + .tileTag = ANIM_TAG_SLASH, + .paletteTag = ANIM_TAG_SLASH, + .oam = &gUnknown_08524914, + .anims = gNightSlashRightAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = AnimNightSlash, +}; + +void AnimTask_BlendNightSlash(u8 taskId) +{ + int paletteOffset = IndexOfSpritePaletteTag(ANIM_TAG_SLASH) * 16 + 256; + BlendPalette(paletteOffset, 16, 6, RGB_RED); + DestroyAnimVisualTask(taskId); +} + +void AnimNightSlash(struct Sprite *sprite) +{ + sprite->callback = sub_8101F40; + sprite->callback(sprite); +}