Add Ion Deluge animation (#5467)

This commit is contained in:
kittenchilly 2024-10-10 15:37:57 -05:00 committed by GitHub
parent 5b4acea651
commit 130d6042e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 82 additions and 0 deletions

View file

@ -7710,6 +7710,17 @@ gBattleAnimMove_NobleRoar::
end
gBattleAnimMove_IonDeluge::
loadspritegfx ANIM_TAG_IONS
loopsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER, 10, 12
createvisualtask AnimTask_BlendBattleAnimPal, 10, (F_PAL_BG | F_PAL_BATTLERS_2), 2, 0, 4, RGB_YELLOW
waitforvisualfinish
createvisualtask AnimTask_CreateIons, 2, 0, 3, 120
createvisualtask AnimTask_CreateIons, 2, 0, 3, 120
delay 120
delay 30
waitforvisualfinish
createvisualtask AnimTask_BlendBattleAnimPal, 10, (F_PAL_BG | F_PAL_BATTLERS_2), 2, 4, 0, RGB_YELLOW
waitforvisualfinish
end
gBattleAnimMove_ParabolicCharge::

View file

@ -29,6 +29,8 @@ static bool8 CreateShockWaveBoltSprite(struct Task *task, u8 taskId);
static void AnimShockWaveProgressingBolt(struct Sprite *);
static bool8 CreateShockWaveLightningSprite(struct Task *task, u8 taskId);
static void AnimShockWaveLightning(struct Sprite *sprite);
static void AnimIon(struct Sprite *);
static void AnimIon_Step(struct Sprite *);
static const union AnimCmd sAnim_Lightning[] =
{
@ -559,6 +561,34 @@ const struct SpriteTemplate gSeedFlareGreenChargeTemplate =
.callback = AnimGrowingChargeOrb
};
static const union AnimCmd sAnim_Ion[] =
{
ANIMCMD_FRAME(0, 2),
ANIMCMD_FRAME(8, 2),
ANIMCMD_FRAME(16, 2),
ANIMCMD_FRAME(24, 6),
ANIMCMD_FRAME(32, 2),
ANIMCMD_FRAME(40, 2),
ANIMCMD_FRAME(48, 2),
ANIMCMD_END,
};
static const union AnimCmd *const sAnims_Ion[] =
{
sAnim_Ion,
};
const struct SpriteTemplate gIonSpriteTemplate =
{
.tileTag = ANIM_TAG_IONS,
.paletteTag = ANIM_TAG_IONS,
.oam = &gOamData_AffineOff_ObjNormal_16x32,
.anims = sAnims_Ion,
.images = NULL,
.affineAnims = gDummySpriteAffineAnimTable,
.callback = AnimIon,
};
// functions
static void AnimLightning(struct Sprite *sprite)
{
@ -1452,3 +1482,44 @@ static void AnimShockWaveLightning(struct Sprite *sprite)
DestroySprite(sprite);
}
}
// Copy of Rain Dance's function but displays the ion sprite instead
// arg 0: initial step
// arg 1: amount (?)
// arg 2: duration
void AnimTask_CreateIons(u8 taskId)
{
u8 x, y;
if (gTasks[taskId].data[0] == 0)
{
gTasks[taskId].data[1] = gBattleAnimArgs[0];
gTasks[taskId].data[2] = gBattleAnimArgs[1];
gTasks[taskId].data[3] = gBattleAnimArgs[2];
}
gTasks[taskId].data[0]++;
if (gTasks[taskId].data[0] % gTasks[taskId].data[2] == 1)
{
x = Random2() % DISPLAY_WIDTH;
y = Random2() % (DISPLAY_HEIGHT / 2);
CreateSprite(&gIonSpriteTemplate, x, y, 4);
}
if (gTasks[taskId].data[0] == gTasks[taskId].data[3])
DestroyAnimVisualTask(taskId);
}
static void AnimIon(struct Sprite *sprite)
{
sprite->callback = AnimIon_Step;
}
static void AnimIon_Step(struct Sprite *sprite)
{
if (++sprite->data[0] <= 13)
{
sprite->x2++;
sprite->y2 += 4;
}
if (sprite->animEnded)
DestroySprite(sprite);
}