-Fixed Custom Spark/Vel changing Spark/ Glow Spark Particles not fading out their glows properly. -Fixed Tracking Disk Stealth having tile collision -Fixed Septic Skewer pulling enemies multiple times during execution. -Added a gfb feature that makes all custom sparks, vel changing sparks, glow sparks and custom pulses use the mammoth particle visual if it's Tuesday. -Fixed some weird particle rotation on Vitriolic Viper -Exorcism GFB sound (Thanks Shayy) -The guaranteed crits on Hellkite and Compact Railgun now convert your crit chance into extra damage for the hit.
77 lines
3.0 KiB
C#
77 lines
3.0 KiB
C#
using System;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
using static CalamityMod.CalamityUtils;
|
|
|
|
namespace CalamityMod.Particles
|
|
{
|
|
public class CustomPulse : Particle
|
|
{
|
|
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
|
public bool UseAltVisual = true;
|
|
public override bool UseAdditiveBlend => UseAltVisual;
|
|
public override bool SetLifetime => true;
|
|
public override bool UseCustomDraw => true;
|
|
|
|
private string NewTexture;
|
|
private float OriginalScale;
|
|
private float FinalScale;
|
|
private float BaseOpacity;
|
|
private float opacity;
|
|
private bool FadeOut;
|
|
private Vector2 Squish;
|
|
private Color BaseColor;
|
|
|
|
public CustomPulse(Vector2 position, Vector2 velocity, Color color, string texture, Vector2 squish, float rotation, float originalScale, float finalScale, int lifeTime, bool UseAdditiveBlend = true, float baseOpacity = 1f, bool fade = true)
|
|
{
|
|
Position = position;
|
|
Velocity = velocity;
|
|
BaseColor = color;
|
|
NewTexture = texture;
|
|
OriginalScale = originalScale;
|
|
FinalScale = finalScale;
|
|
Scale = originalScale;
|
|
Lifetime = lifeTime;
|
|
BaseOpacity = baseOpacity;
|
|
FadeOut = fade;
|
|
Squish = squish;
|
|
Rotation = rotation;
|
|
UseAltVisual = UseAdditiveBlend;
|
|
}
|
|
|
|
public override void Update()
|
|
{
|
|
float pulseProgress = PiecewiseAnimation(LifetimeCompletion, new CurveSegment[] { new CurveSegment(EasingType.PolyOut, 0f, 0f, 1f, 4) });
|
|
Scale = MathHelper.Lerp(OriginalScale, FinalScale, pulseProgress);
|
|
|
|
opacity = (FadeOut ? (float)Math.Sin(MathHelper.PiOver2 + LifetimeCompletion * MathHelper.PiOver2) : 1f) * BaseOpacity;
|
|
|
|
Color = BaseColor * opacity;
|
|
Lighting.AddLight(Position, Color.R / 255f, Color.G / 255f, Color.B / 255f);
|
|
Velocity *= 0.95f;
|
|
}
|
|
|
|
public override void CustomDraw(SpriteBatch spriteBatch)
|
|
{
|
|
Texture2D tex = ModContent.Request<Texture2D>(NewTexture).Value;
|
|
float scaleMult = 1;
|
|
if (Main.zenithWorld)
|
|
{
|
|
DateTime day = DateTime.Now;
|
|
if (day.DayOfWeek == DayOfWeek.Tuesday)
|
|
{
|
|
Texture2D joke = ModContent.Request<Texture2D>("CalamityMod/Particles/MammothParticle").Value;
|
|
scaleMult = (MathHelper.Lerp(tex.Size().X / joke.Size().X, tex.Size().Y / joke.Size().Y, 0.5f));
|
|
Main.NewText(scaleMult);
|
|
tex = joke;
|
|
UseAltVisual = true;
|
|
}
|
|
}
|
|
spriteBatch.Draw(tex, Position - Main.screenPosition, null, Color * opacity, Rotation, tex.Size() / 2f, Scale * Squish * scaleMult, SpriteEffects.None, 0);
|
|
}
|
|
|
|
}
|
|
}
|