New Volt Switch Animation (#5729)

Co-authored-by: Hedara <hedara90@gmail.com>
This commit is contained in:
Alex 2024-12-07 15:52:13 +01:00 committed by GitHub
parent 775ea3b564
commit 3f3f4cfe1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 90 additions and 33 deletions

View file

@ -5561,44 +5561,40 @@ GrassPledgeMiddleFountain:
delay 4
return
@Credits to Skeli
gBattleAnimMove_VoltSwitch::
loadspritegfx ANIM_TAG_SPARK
loadspritegfx ANIM_TAG_SHADOW_BALL
loadspritegfx ANIM_TAG_IONS
loadspritegfx ANIM_TAG_SPARK_2
loadspritegfx ANIM_TAG_THIN_RING
monbg ANIM_ATTACKER
setalpha 12, 8
createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0, 0x3BDF, 8
playsewithpan SE_M_CHARGE, SOUND_PAN_ATTACKER
playsewithpan SE_M_THUNDERBOLT, SOUND_PAN_ATTACKER
createsprite gVoltSwitchSpriteTemplate, ANIM_TARGET, 3, 0, 0, 0, 0, 32, 20
delay 30
createvisualtask AnimTask_ShakeMon2 2, ANIM_TARGET, 3, 0, 8, 1
call VoltSwitchElectricFlashes
delay 2
playsewithpan SE_M_THUNDERBOLT, SOUND_PAN_ATTACKER
createsprite gVoltSwitchSpriteTemplate ANIM_TARGET, 3, 0, 0, 0, 0, 32, -20
delay 4
createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0, 0x3BDF, 8
delay 4
createvisualtask AnimTask_ShakeMon, 5, ANIM_TARGET, 0, 3, 45, 1
createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0, 0x3BDF, 8
delay 4
createsprite gUproarRingSpriteTemplate, ANIM_ATTACKER, 3, 0, 0, 0, 0, 0x3BDF, 8
delay 4
call ElectricityEffect
playsewithpan SE_M_THUNDERBOLT2, SOUND_PAN_ATTACKER
createvisualtask AnimTask_CanBattlerSwitch, 1, ANIM_ATTACKER
jumpretfalse VoltSwitchContinue
createvisualtask AnimTask_IsTargetSameSide 1
jumprettrue VoltSwitchAgainstPartner
createvisualtask AnimTask_SlideOffScreen, 5, ANIM_ATTACKER, -2
VoltSwitchContinue:
call VoltSwitchElectricFlashes
delay 18
createvisualtask AnimTask_ShakeMon2 2, ANIM_TARGET, 3, 0, 8, 1
call VoltSwitchElectricFlashes
delay 6
call VoltSwitchElectricFlashes
waitforvisualfinish
clearmonbg ANIM_ATTACKER
blendoff
createvisualtask AnimTask_CanBattlerSwitch, 1, ANIM_ATTACKER
jumpretfalse VoltSwitchLast
invisible ANIM_ATTACKER
VoltSwitchLast:
delay 8
end
@ Attacking the same side requires a change of direction
@ why would you attack your partner though?!
VoltSwitchAgainstPartner:
createvisualtask AnimTask_SlideOffScreen, 5, ANIM_ATTACKER, 2
goto VoltSwitchContinue
VoltSwitchElectricFlashes:
playsewithpan SE_M_CHARGE, SOUND_PAN_TARGET
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 5, 0, 5, 0
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -5, 10, 5, 1
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 15, 20, 5, 2
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -15, -10, 5, 0
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 25, 0, 5, 1
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -8, 8, 5, 2
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, 2, -8, 5, 0
createsprite gElectricitySpriteTemplate, ANIM_TARGET, 2, -20, 15, 5, 1
return
gBattleAnimMove_StruggleBug::
loadspritegfx ANIM_TAG_MOVEMENT_WAVES

View file

@ -464,6 +464,7 @@ void AnimElectricPuff(struct Sprite *sprite);
void AnimSparkElectricityFlashing(struct Sprite *sprite);
void AnimGrowingShockWaveOrb(struct Sprite *sprite);
void AnimElectricity(struct Sprite *);
void AnimTask_VoltSwitch(struct Sprite* sprite);
extern const union AffineAnimCmd *const gAffineAnims_GrowingElectricOrb[];
extern const union AffineAnimCmd *const gAffineAnims_FlashingSpark[];
extern const union AnimCmd *const gAnims_ThunderboltOrb[];

View file

@ -589,6 +589,17 @@ const struct SpriteTemplate gIonSpriteTemplate =
.callback = AnimIon,
};
const struct SpriteTemplate gVoltSwitchSpriteTemplate =
{
.tileTag = ANIM_TAG_SHADOW_BALL,
.paletteTag = ANIM_TAG_IONS,
.oam = &gOamData_AffineNormal_ObjNormal_32x32,
.anims = gDummySpriteAnimTable,
.images = NULL,
.affineAnims = gAffineAnims_ShadowBall,
.callback = AnimTask_VoltSwitch,
};
// functions
static void AnimLightning(struct Sprite *sprite)
{
@ -1523,3 +1534,52 @@ static void AnimIon_Step(struct Sprite *sprite)
if (sprite->animEnded)
DestroySprite(sprite);
}
//Volt Switch//
//Launches the projectiles for Volt Switch
//arg 0: initial x pixel offset
//arg 1: initial y pixel offset
//arg 2: target x pixel offset
//arg 3: target y pixel offset
//arg 4: duration
//arg 5: wave amplitude
static void VoltSwitch_Step(struct Sprite* sprite)
{
sprite->invisible = FALSE;
if (TranslateAnimHorizontalArc(sprite))
{
//Merge coords into one
sprite->x += sprite->x2;
sprite->y += sprite->y2;
sprite->x2 = 0;
sprite->y2 = 0;
//Come straight back to the attacker
sprite->data[0] = 0x14; //Duration
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_X_2);
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimAttacker, BATTLER_COORD_Y_PIC_OFFSET);
sprite->callback = StartAnimLinearTranslation;
StoreSpriteCallbackInData6(sprite, DestroyAnimSprite);
}
}
void AnimTask_VoltSwitch(struct Sprite* sprite)
{
InitSpritePosToAnimAttacker(sprite, 0);
if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_OPPONENT)
gBattleAnimArgs[2] = -gBattleAnimArgs[2];
else
sprite->y += 10; //Move slightly down
sprite->data[0] = gBattleAnimArgs[4];
sprite->data[2] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_X_2) + gBattleAnimArgs[2]; //Target X
sprite->data[4] = GetBattlerSpriteCoord(gBattleAnimTarget, BATTLER_COORD_Y_PIC_OFFSET) + gBattleAnimArgs[3]; //Target Y
sprite->data[5] = gBattleAnimArgs[5];
InitAnimArcTranslation(sprite);
sprite->callback = VoltSwitch_Step;
}