Files
CalamityModPublic/Dusts/DiamondDust.cs
T
Xyk 86025c0712 Arsenal Improvements Part 1
Part of my attempt to create a visual identity for each arsenal energy type that can be consistently applied across all items once they are reworked

This commit changes:
Taser - New left click and previous function is on right click with arsenal cooldown, vfx overhaul
Scattershot Skewer - Completely re-coded the entire thing, now has right and left click separation and can perform a skewer dash, vfx overhaul
Pulse Pistol - Completely re-coded how the orb tracking and movement works, hits twice before splitting instead of once, vfx overhaul
Pulse Rifle - Same as Pulse Pistol, vfx overhaul

Added 4 more dust types

Changed the dusts and colors used by Effects.ArsenalEffects

Fixed Plama typo
2025-03-26 20:21:27 -07:00

64 lines
2.7 KiB
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Dusts
{
public class DiamondDust : ModDust
{
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void OnSpawn(Dust dust)
{
dust.scale *= Main.rand.NextFloat(0.8f, 1f);
}
public override bool Update(Dust dust)
{
dust.rotation = dust.velocity.ToRotation() + MathHelper.PiOver2;
dust.velocity *= 0.96f;
if (dust.noGravity)
dust.scale -= 0.045f;
else
{
dust.scale -= 0.03f;
dust.velocity.Y += Main.rand.NextFloat(0.1f, 0.35f);
}
float light = MathHelper.Clamp(dust.scale * 0.8f, 0f, 1f);
if (!dust.noLightEmittence)
Lighting.AddLight(dust.position, dust.color.ToVector3() * light);
if (dust.scale <= 0)
dust.active = false;
dust.position += dust.velocity;
dust.fadeIn++; // Fade in is used for the time strech instead
return false;
}
public override bool PreDraw(Dust dust)
{
Vector2 dustCenter = dust.position + new Vector2(0.25f, 0.25f);
Texture2D bloom = ModContent.Request<Texture2D>("CalamityMod/Particles/SquareRotated").Value;
// dust.fadeIn is used to determine how intense the squash is, 1 is no squash, 0 is normal squash
float squashLerp = Utils.GetLerpValue(10, 25, dust.fadeIn, true);
Vector2 squash = new Vector2(MathHelper.Lerp(1, 0.3f, squashLerp), MathHelper.Lerp(1, 7f, squashLerp));
// Glow Orb
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, dust.color with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.1f, SpriteEffects.None, 0);
if (dust.alpha < 1)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.2f) with { A = 0 } * 0.85f * Utils.GetLerpValue(255, 0, dust.alpha), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.09f, SpriteEffects.None, 0);
if (!dust.noLight)
{
for (int i = 0; i < 2; i++)
Main.EntitySpriteDraw(bloom, dustCenter - Main.screenPosition, null, Color.Lerp(dust.color, Color.White, 0.4f) with { A = 0 } * Utils.GetLerpValue(255, 0, dust.alpha) * (i == 0 ? 1f : 0.7f), dust.rotation, bloom.Size() * 0.5f, squash * dust.scale * 0.08f * (i == 0 ? 0.7f : 1), SpriteEffects.None, 0);
}
return false;
}
}
}