Files
CalamityModPublic/Graphics/Metaballs/SignusMetaball.cs
T
Xyk 38bf9f0273 The Dash Changes
Changed:
Tabi, Master Ninja Gear, Statis Ninja Belt, Statis Void Sash, Leviathan Ambergris, and Slagsplitter Pauldron

- The Tabi line of dashes are now significantly faster on inital dash, but decelerate quickly. They also have a lower dash cooldown than normal. This allows for quick and fast dodge movements without a long lasting dash/dash cooldown

- Statis dashes no longer use Magilum, but increase acceleration on their own by 1.6x/1.85x and also increase move speed by 10%/20%

- Redid dash visuals for Slagsplitter Pauldron, Statis Ninja Belt, Statis Void Sash, and Leviathan Ambergris.

- Added visibility toggle for Slagsplitter Pauldron, Statis Void Sash, and Leviathan Ambergris.

- Leviathan Ambergris now increases initial dash velocity by 200% and makes you decelerate while dashing, allowing for quicker dashes that don't aren't longer than before and don't increase the time between dashing. Also significantly buffed it's damage because of changes described below.

- Redid how Slagsplitter Pauldron and Leviathan Ambergris do their hits. It is now a single projectile that sticks to the player spawned on dash start that disappears on dash end and deals damage. Also reduced explosion damage on Pauldron but increased direct damage.
2025-03-31 19:37:23 -07:00

145 lines
5.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Graphics.Metaballs
{
public class SignusMetaball : Metaball
{
public Color borderColor = Color.Purple;
public Vector2 goalDir = Vector2.Zero;
public Vector2 scrollDir = Vector2.Zero;
public class CosmicParticle
{
public float Size;
public Vector2 Velocity;
public Vector2 Center;
public Vector2 BaseSquash = Vector2.One;
public float Rotation;
public float ShrinkSpeed = 0;
public int Lifetime;
public float SquashPower = 0;
public int time = 0;
public CosmicParticle(Vector2 center, Vector2 velocity, float size, int lifetime, Vector2 squash, float shrinkSpeed = 0, float velocitySquash = 0)
{
Center = center;
Velocity = velocity;
Size = size;
Rotation = Velocity.ToRotation() + MathHelper.PiOver2;
BaseSquash = squash;
Lifetime = lifetime;
ShrinkSpeed = shrinkSpeed;
SquashPower = velocitySquash;
}
public void Update()
{
Center += Velocity;
Velocity *= 0.95f;
if ((float)time / (float)Lifetime > 0.5f)
{
Size *= 0.94f;
}
BaseSquash.X *= (1 - 0.2f * ShrinkSpeed);
BaseSquash.Y *= (1 + 0.2f * ShrinkSpeed);
Rotation = Velocity.ToRotation() + MathHelper.PiOver2;
time++;
}
}
public static Asset<Texture2D> LayerAsset
{
get;
private set;
}
public static List<CosmicParticle> Particles
{
get;
private set;
} = new();
public override bool AnythingToDraw => Particles.Any();
public override IEnumerable<Texture2D> Layers
{
get
{
yield return LayerAsset.Value;
}
}
public override MetaballDrawLayer DrawContext => MetaballDrawLayer.BeforeNPCs;
public override void Load()
{
if (Main.dedServ)
return;
// Load the layer asset wrapper.
LayerAsset = ModContent.Request<Texture2D>($"CalamityMod/Graphics/Metaballs/SignusLayer", AssetRequestMode.ImmediateLoad);
}
public override void Update()
{
if (goalDir == Vector2.Zero)
goalDir = Vector2.One.RotatedByRandom(Math.PI);
if ((int)(Main.GlobalTimeWrappedHourly * 50) % 5 == 0)
{
goalDir = goalDir.RotatedByRandom(0.13f);
}
scrollDir = Vector2.Lerp(scrollDir, goalDir, 0.01f);
float rate = Main.GlobalTimeWrappedHourly * 19;
List<Color> colors = new List<Color>()
{
Color.Purple,
Color.BlueViolet,
Color.DarkViolet
};
int colorIndex = (int)(rate / 2 % colors.Count);
Color currentColor = colors[colorIndex];
Color nextColor = colors[(colorIndex + 1) % colors.Count];
borderColor = Color.Lerp(currentColor, nextColor, rate % 2f > 1f ? 1f : rate % 1f);
// Update all particle instances.
// Once sufficiently small, they vanish.
for (int i = 0; i < Particles.Count; i++)
Particles[i].Update();
Particles.RemoveAll(p => p.Size <= 2f);
}
public override Color EdgeColor => borderColor with { A = 0 };
public static void SpawnParticle(Vector2 position, Vector2 velocity, float size, int lifetime, Vector2 squash, float shrinkSpeed = 0, float velocitySquash = 0) =>
Particles.Add(new(position, velocity, size, lifetime, squash, shrinkSpeed, velocitySquash));
// Make the texture scroll.
public override Vector2 CalculateManualOffsetForLayer(int layerIndex)
{
return scrollDir * 0.5f;
}
public override void DrawInstances()
{
Texture2D tex = ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/BasicMess").Value;
foreach (CosmicParticle particle in Particles)
{
Vector2 squash = Vector2.Lerp(particle.BaseSquash, new Vector2(Utils.Remap(particle.Velocity.Length(), 2, 7, 1, 0.5f), Utils.Remap(particle.Velocity.Length(), 2, 7, 1, 2.5f)), particle.SquashPower);
Vector2 drawPosition = particle.Center - Main.screenPosition;
Vector2 origin = tex.Size() * 0.5f;
Vector2 scale = Vector2.One * particle.Size / tex.Size();
Main.spriteBatch.Draw(tex, drawPosition, null, Color.White, particle.Rotation, origin, squash * scale, SpriteEffects.None, 0f);
}
}
}
}