Implemented differences in Ball Burst animations for sending out a Pokémon

This commit is contained in:
Maruno17
2022-04-10 21:38:06 +01:00
parent 4a478ab6d0
commit 0d4c27d413

View File

@@ -272,6 +272,98 @@ module Battle::Scene::Animation::BallAnimationMixin
battler.setVisible(delay + 5, false)
end
# NOTE: This array makes the Ball Burst animation differ between types of Poké
# Ball in certain simple ways. The HGSS animations occasionally have
# additional differences, which haven't been coded yet in Essentials as
# they're more complex and I couldn't be bothered.
BALL_BURST_VARIANCES = {
# [ray start tone, ray end tone,
# top particle filename, top particle start tone, top particle end tone,
# bottom particle filename, bottom particle start tone, bottom particle end tone,
# top glare filename, top glare start tone, top glare end tone,
# bottom glare filename, bottom glare start tone, bottom glare end tone]
:POKEBALL => [Tone.new(0, 0, 0, 0), Tone.new(0, 0, -192, -64), # White, yellow
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, -96, -64), Tone.new(0, -128, -248, -224), # Yellow, dark orange
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, -96, -32), Tone.new(0, 0, -192, -64)], # Light yellow, yellow
:GREATBALL => [Tone.new(0, 0, 0, 0), Tone.new(-128, -64, 0, 0), # White, blue
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(-128, 0, 0, 0), Tone.new(-248, -64, 0, 0), # Cyan, dark cyan
"particle", Tone.new(0, 0, 0, 0), Tone.new(-96, -48, 0, 0), # White, light blue
"particle", Tone.new(-96, -48, 0, 0), Tone.new(-192, -96, 0, 0)], # Blue, dark blue
:SAFARIBALL => [Tone.new(0, 0, -32, 0), Tone.new(-128, 0, -128, 0), # Pale yellow, green
"particle", Tone.new(0, 0, -64, 0), Tone.new(-160, 0, -160, 0), # Beige, darker green
"particle", Tone.new(0, 0, -64, 0), Tone.new(-160, 0, -160, 0), # Beige, darker green
"particle", Tone.new(0, 0, 0, 0), Tone.new(-80, 0, -80, 0), # White, light green
"particle", Tone.new(-32, 0, -96, 0), Tone.new(-160, 0, -160, 0)], # Pale green, darker green
:ULTRABALL => [Tone.new(0, 0, 0, 0), Tone.new(0, 0, -192, -64), # White, yellow
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, -64, 0), Tone.new(0, 0, -224, 0), # Pale yellow, yellow
"dazzle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, -128, 0), # White, light yellow
"particle", Tone.new(0, 0, -64, 0), Tone.new(0, 0, -224, 0)], # Pale yellow, yellow
:MASTERBALL => [Tone.new(0, 0, 0, 0), Tone.new(-48, -200, -56, 0), # White, magenta
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, 0, 0), Tone.new(-48, -200, -56, 0), # White, magenta
"dazzle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"dazzle", Tone.new(-48, -200, -56, 0), Tone.new(-48, -200, -56, 0)], # Magenta, magenta
:NETBALL => [Tone.new(0, 0, 0, 0), Tone.new(0, -64, 0, 0), # White, lilac
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, -64, 0, 0), # White, lilac
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, -64, 0, 0), # White, lilac
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, -64, 0, 0), # White, lilac
"web", Tone.new(-32, -64, -32, 0), Tone.new(-64, -128, -64, 0)], # Light purple, purple
:DIVEBALL => [Tone.new(0, 0, 0, 0), Tone.new(-192, -128, -32, 0), # White, dark blue
"bubble", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(-184, -40, 0, 0), Tone.new(-184, -40, 0, 0), # Cyan, cyan
"dazzle", Tone.new(-184, -40, 0, 0), Tone.new(-184, -40, 0, 0), # Cyan, cyan
"particle", Tone.new(0, 0, 0, 0), Tone.new(-184, -40, 0, 0)], # White, cyan
:NESTBALL => [Tone.new(0, 0, 0, 0), Tone.new(0, 0, -192, -64), # White, yellow
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, -96, -64), Tone.new(0, -128, -248, -224), # Light yellow, dark orange
"dazzle", Tone.new(0, 0, 0, 0), Tone.new(-96, 0, -96, 0), # White, green
"particle", Tone.new(-96, 0, -96, 0), Tone.new(-192, 0, -192, 0)], # Green, dark green
:REPEATBALL => [Tone.new(0, 0, 0, 0), Tone.new(0, 0, -192, -64), # White, yellow
"ring3", Tone.new(-16, -16, -88, 0), Tone.new(-32, -32, -176, 0), # Yellow, yellow
"particle", Tone.new(-144, -144, -144, 0), Tone.new(-160, -160, -160, 0), # Grey, grey
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, -128, -248, -224), Tone.new(0, -128, -248, -224)], # Dark orange, dark orange
:TIMERBALL => [Tone.new(0, 0, 0, 0), Tone.new(0, 0, -192, -64), # White, yellow
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, -96, -64), Tone.new(0, -128, -248, -224), # Yellow, dark orange
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, -96, -32), Tone.new(0, 0, -192, -64)], # Light yellow, yellow
:LUXURYBALL => [Tone.new(0, 0, 0, 0), Tone.new(0, -128, -160, 0), # White, orange
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, -96, -64), Tone.new(0, -128, -248, -224), # Yellow, dark orange
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, -64, -144, 0), Tone.new(0, -192, -248, 0)], # Light orange, red
:PREMIERBALL => [Tone.new(0, -160, -148, 0), Tone.new(0, 0, 0, 0), # Red, white
"particle", Tone.new(0, -192, -152, 0), Tone.new(0, -192, -152, 0), # Red, red
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, -192, -152, 0), # White, red
"dazzle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0)], # White, white
:DUSKBALL => [Tone.new(-48, -200, -56, 0), Tone.new(-160, -224, -160, 0), # Magenta, dark purple
"particle", Tone.new(-248, -248, -248, 0), Tone.new(-248, -248, -248, 0), # Black, black
"particle", Tone.new(-24, -96, -32, 0), Tone.new(-24, -96, -32, 0), # Light magenta, light magenta
"particle", Tone.new(-248, -248, -248, 0), Tone.new(-248, -248, -248, 0), # Black, black
"whirl", Tone.new(-160, -224, -160, 0), Tone.new(-160, -224, -160, 0)], # Dark purple, dark purple
:HEALBALL => [Tone.new(-8, -48, -8, 0), Tone.new(-16, -128, -112, 0), # Pink, dark pink
"diamond", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"diamond", Tone.new(0, -96, -104), Tone.new(-160, -64, 0, 0), # Pink/orange, cyan
"dazzle", Tone.new(0, 0, 0, 0), Tone.new(-32, -112, -80, 0), # White, magenta
"particle", Tone.new(-8, -48, -8, 0), Tone.new(-64, -224, -160, 0)], # Pink, dark magenta
:QUICKBALL => [Tone.new(-64, 0, 0, 0), Tone.new(-192, -96, 0, 0), # Light cyan, dark blue
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, -96, -64), Tone.new(0, -128, -248, -224), # Yellow, dark orange
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(-96, 0, 0, 0), Tone.new(-192, -96, 0, 0)], # Cyan, dark blue
:CHERISHBALL => [Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white (unused; see below)
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, -192, -64), # White ,yellow
"particle", Tone.new(0, 0, 0, 0), Tone.new(0, 0, 0, 0), # White, white
"particle", Tone.new(0, 0, -96, -32), Tone.new(0, 0, -192, -64)] # Light yellow, yellow
}
# The regular Poké Ball burst animation.
def ballBurst(delay, ball, ballX, ballY, poke_ball)
num_particles = 15
@@ -282,21 +374,44 @@ module Battle::Scene::Animation::BallAnimationMixin
ray_lifetime = 13
ray_fade_duration = 5
ray_min_radius = 24 # How far out from the center a ray starts
cherish_ball_ray_tones = [Tone.new(-104, -144, -8, 0), # Indigo
Tone.new(-64, -144, -24, 0), # Purple
Tone.new(-8, -144, -64, 0), # Pink
Tone.new(-8, -48, -152, 0), # Orange
Tone.new(-8, -32, -160, 0)] # Yellow
# Get array of things that vary for each kind of Poké Ball
variances = BALL_BURST_VARIANCES[poke_ball] || BALL_BURST_VARIANCES[:POKEBALL]
# Set up glare particles
glare1 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_particle", PictureOrigin::CENTER)
glare2 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_particle", PictureOrigin::CENTER)
glare1 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[11]}", PictureOrigin::CENTER)
glare2 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[8]}", PictureOrigin::CENTER)
[glare1, glare2].each_with_index do |particle, num|
particle.setZ(0, 105 + num)
particle.setZoom(0, 0)
particle.setTone(0, variances[12 - (3 * num)])
particle.setVisible(0, false)
end
glare1.setTone(0, Tone.new(0, 0, -96, -32)) # Light yellow
glare1.moveTone(delay + glare_fade_duration + 3, glare_fade_duration / 2, Tone.new(0, 0, -192, -64)) # Yellow
[glare1, glare2].each_with_index do |particle, num|
particle.moveTone(delay + glare_fade_duration + 3, glare_fade_duration / 2, variances[13 - (3 * num)])
end
# Animate glare particles
[glare1, glare2].each { |p| p.setVisible(delay, true) }
glare1.moveZoom(delay, glare_fade_duration, 250)
if poke_ball == :MASTERBALL
glare1.moveAngle(delay, 19, -135)
glare1.moveZoom(delay, glare_fade_duration, 250)
elsif poke_ball == :DUSKBALL
glare1.moveAngle(delay, 19, -270)
elsif ["whirl"].include?(variances[11])
glare1.moveZoom(delay, glare_fade_duration, 200)
else
glare1.moveZoom(delay, glare_fade_duration, (["dazzle", "ring3", "web"].include?(variances[11])) ? 100 : 250)
end
glare1.moveOpacity(delay + glare_fade_duration + 3, glare_fade_duration, 0)
glare2.moveZoom(delay, glare_fade_duration, 200)
if poke_ball == :MASTERBALL
glare2.moveAngle(delay, 19, -135)
glare2.moveZoom(delay, glare_fade_duration, 200)
else
glare2.moveZoom(delay, glare_fade_duration, (["dazzle", "ring3", "web"].include?(variances[8])) ? 125 : 200)
end
glare2.moveOpacity(delay + glare_fade_duration + 3, glare_fade_duration - 2, 0)
[glare1, glare2].each { |p| p.setVisible(delay + 19, false) }
# Rays
@@ -310,6 +425,7 @@ module Battle::Scene::Animation::BallAnimationMixin
"Graphics/Battle animations/ballBurst_ray", PictureOrigin::BOTTOM)
ray.setZ(0, 100)
ray.setZoomXY(0, 200, start_zoom)
ray.setTone(0, variances[0]) if poke_ball != :CHERISHBALL
ray.setOpacity(0, 0)
ray.setVisible(0, false)
ray.setAngle(0, angle)
@@ -319,18 +435,24 @@ module Battle::Scene::Animation::BallAnimationMixin
ray.moveZoomXY(start, ray_lifetime, 200, start_zoom * 6)
ray.moveOpacity(start, 2, 255) # Quickly fade in
ray.moveOpacity(start + ray_lifetime - ray_fade_duration, ray_fade_duration, 0) # Fade out
ray.moveTone(start + ray_lifetime - ray_fade_duration, ray_fade_duration, Tone.new(0, 0, -192, -64)) # Yellow
if poke_ball == :CHERISHBALL
ray_lifetime.times do |frame|
ray.setTone(start + frame, cherish_ball_ray_tones[frame % cherish_ball_ray_tones.length])
end
else
ray.moveTone(start + ray_lifetime - ray_fade_duration, ray_fade_duration, variances[1])
end
ray.setVisible(start + ray_lifetime, false)
end
# Particles
num_particles.times do |i|
# Set up particles
particle1 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_particle", PictureOrigin::CENTER)
particle2 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_particle", PictureOrigin::CENTER)
particle1.setTone(0, Tone.new(0, 0, -192, -64)) # Yellow
particle1 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[5]}", PictureOrigin::CENTER)
particle2 = addNewSprite(ballX, ballY, "Graphics/Battle animations/ballBurst_#{variances[2]}", PictureOrigin::CENTER)
[particle1, particle2].each_with_index do |particle, num|
particle.setZ(0, 110 + num)
particle.setZoom(0, 80)
particle.setZoom(0, (80 - (num * 20)) / (["ring2"].include?(variances[5 - (3 * num)]) ? 2 : 1))
particle.setTone(0, variances[6 - (3 * num)])
particle.setVisible(0, false)
end
# Animate particles
@@ -338,13 +460,12 @@ module Battle::Scene::Animation::BallAnimationMixin
max_radius = rand(256...384)
angle = rand(360)
radian = angle * Math::PI / 180
particle1.moveTone(start + particle_lifetime - particle_fade_duration,
particle_fade_duration / 2,
Tone.new(0, -128, -248, -224)) # Dark orange
[particle1, particle2].each do |particle|
[particle1, particle2].each_with_index do |particle, num|
particle.setVisible(start, true)
particle.moveDelta(start, particle_lifetime, max_radius * Math.cos(radian), max_radius * Math.sin(radian))
particle.moveZoom(start, particle_lifetime, 10)
particle.moveTone(start + particle_lifetime - particle_fade_duration,
particle_fade_duration / 2, variances[7 - (3 * num)])
particle.moveOpacity(start + particle_lifetime - particle_fade_duration,
particle_fade_duration,
0) # Fade out at end