Merge pull request #1348 from CalamityTeam/DryadsTearsRework
Dryads Tear Rework
This commit is contained in:
9 files changed
+684
-199
No files matched your search
@@ -48,7 +48,13 @@ CinderArrow: {
|
||||
|
||||
DryadsTear: {
|
||||
DisplayName: Dryad's Tear
|
||||
Tooltip: Splits into homing shards on impact which ignore 10 points of enemy defense
|
||||
Tooltip:
|
||||
'''
|
||||
An extremely powerful magic bullet blessed with nature's essence that becomes unstable when multiple are nearby
|
||||
Carries a teardrop along with it which on impact will detach and crash down upon the hit enemy and burst
|
||||
All bullet and teardrop hits have 18 armor penetration
|
||||
[c/40E091:'Focus. Breathe. Just one more shot, and the violence will fade away...']
|
||||
'''
|
||||
}
|
||||
|
||||
ElysianArrow: {
|
||||
|
||||
@@ -67,7 +67,6 @@ DrizzlefishFire.DisplayName: Drizzlefish Flames
|
||||
DrizzlefishFireball.DisplayName: Drizzlefish Fireball
|
||||
DrizzlefishFireSplit.DisplayName: Drizzlefish Flames
|
||||
DryadsTearMain.DisplayName: Dryad's Tear
|
||||
DryadsTearSplit.DisplayName: Dryad's Tear
|
||||
ElysianArrowProj.DisplayName: Elysian Arrow
|
||||
ElysianArrowRain.DisplayName: Elysian Light
|
||||
EmesisGore.DisplayName: Rotten Gore
|
||||
|
||||
@@ -0,0 +1,141 @@
|
||||
using System;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Terraria;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Particles
|
||||
{
|
||||
public class CustomColorChangeSpark : Particle
|
||||
{
|
||||
public Color InitialColor;
|
||||
public Color EndColor;
|
||||
public bool AffectedByGravity;
|
||||
public bool FadeIn = false;
|
||||
public float FadeInScale = 0f;
|
||||
public bool GlowCenter = false;
|
||||
public float GlowCenterScale = 1;
|
||||
public float GlowOpacity = 1;
|
||||
public string NewTexture;
|
||||
public float ExtraRotation;
|
||||
public Vector2 Stretch = new Vector2(0.5f, 1.6f);
|
||||
public float ShrinkSpeed = 0;
|
||||
public bool FlipHorizontal = false;
|
||||
public bool NoShrink = false;
|
||||
public float Spin = 0;
|
||||
public float ColorFadeSpeed = 0;
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public bool AltVisual = true;
|
||||
public override bool UseAdditiveBlend => AltVisual;
|
||||
public override bool SetLifetime => true;
|
||||
public override bool UseCustomDraw => true;
|
||||
|
||||
public CustomColorChangeSpark(Vector2 relativePosition, Vector2 velocity, string texture, bool affectedByGravity, int lifetime, float scale, Color startColor, Color endColor, Vector2 stretch, bool useAddativeBlend = true, bool glowCenter = false, float extraRotation = 0, bool fadeIn = false, bool affectedByLight = false, float shrinkSpeed = 0, float glowCenterScale = 1, float glowOpacity = 1, bool flipHorizontal = false, bool noShrink = false, float spin = 0, float colorFadeSpeed = 3)
|
||||
{
|
||||
Position = relativePosition;
|
||||
Velocity = velocity;
|
||||
NewTexture = texture;
|
||||
ExtraRotation = extraRotation;
|
||||
AffectedByGravity = affectedByGravity;
|
||||
AffectedByLight = affectedByLight;
|
||||
Scale = scale;
|
||||
Stretch = stretch;
|
||||
FadeInScale = scale;
|
||||
Lifetime = lifetime;
|
||||
Color = InitialColor = startColor;
|
||||
EndColor = endColor;
|
||||
ShrinkSpeed = shrinkSpeed;
|
||||
|
||||
AltVisual = useAddativeBlend;
|
||||
GlowCenter = glowCenter;
|
||||
GlowCenterScale = glowCenterScale;
|
||||
GlowOpacity = glowOpacity;
|
||||
FlipHorizontal = flipHorizontal;
|
||||
NoShrink = noShrink;
|
||||
|
||||
FadeIn = fadeIn;
|
||||
|
||||
if (FadeIn)
|
||||
Scale = 0f;
|
||||
Spin = spin;
|
||||
ColorFadeSpeed = colorFadeSpeed;
|
||||
}
|
||||
|
||||
public override void Update()
|
||||
{
|
||||
if (!FadeIn)
|
||||
{
|
||||
if (!NoShrink)
|
||||
Scale *= 0.95f;
|
||||
Color = Color.Lerp(InitialColor, EndColor, LifetimeCompletion);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((float)Time / (float)Lifetime < 0.5f)
|
||||
{
|
||||
Scale = MathHelper.Lerp(Scale, FadeInScale, 0.2f);
|
||||
}
|
||||
else
|
||||
{
|
||||
Scale = MathHelper.Lerp(Scale, FadeInScale, -0.21f);
|
||||
}
|
||||
}
|
||||
Velocity *= 0.95f;
|
||||
if (Velocity.Length() < 12f && AffectedByGravity)
|
||||
{
|
||||
Velocity.X *= 0.94f;
|
||||
Velocity.Y += 0.25f;
|
||||
}
|
||||
ExtraRotation += Spin;
|
||||
Rotation = Velocity.ToRotation() + MathHelper.PiOver2 + ExtraRotation;
|
||||
|
||||
Stretch.X *= (1 - 0.2f * ShrinkSpeed);
|
||||
Stretch.Y *= (1 + 0.2f * ShrinkSpeed);
|
||||
}
|
||||
|
||||
public override void CustomDraw(SpriteBatch spriteBatch)
|
||||
{
|
||||
Vector2 scale = Stretch * Scale;
|
||||
Texture2D texture = 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(texture.Size().X / joke.Size().X, texture.Size().Y / joke.Size().Y, 0.5f));
|
||||
texture = joke;
|
||||
AltVisual = true;
|
||||
}
|
||||
}
|
||||
|
||||
Color col = Color;
|
||||
|
||||
if (AffectedByLight)
|
||||
{
|
||||
col = Lighting.GetColor((Position / 16).ToPoint()).MultiplyRGB(Color);
|
||||
}
|
||||
|
||||
if (Pixelate)
|
||||
{
|
||||
PixelationManager.AddPixelatedDrawer((_) =>
|
||||
{
|
||||
float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed));
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, col * fadeOut, Rotation, texture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
|
||||
if (GlowCenter)
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
}, Enums.GeneralDrawLayer.AfterProjectiles, UseAdditiveBlend ? BlendState.Additive : null);
|
||||
}
|
||||
else
|
||||
{
|
||||
float fadeOut = (1 - (float)Math.Pow(LifetimeCompletion, ColorFadeSpeed));
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, col * fadeOut, Rotation, texture.Size() * 0.5f, scale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0f);
|
||||
if (GlowCenter)
|
||||
spriteBatch.Draw(texture, Position - Main.screenPosition, null, Color.Lerp(col, Color.White, 0.8f) * fadeOut * GlowOpacity, Rotation, texture.Size() * 0.5f, scale * 0.8f * GlowCenterScale * scaleMult, FlipHorizontal ? SpriteEffects.FlipHorizontally : SpriteEffects.None, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4304,153 +4304,149 @@ namespace CalamityMod.Projectiles
|
||||
}
|
||||
}
|
||||
|
||||
if (brimstoneBullets)
|
||||
if (projectile.Opacity > 0 && projectile.scale > 0.01f) // Only apply bullet visuals if the bullet is visible
|
||||
{
|
||||
PointParticle spark = new PointParticle(projectile.Center + projectile.velocity * 3, projectile.velocity, false, 2, 0.9f, Color.Crimson * 0.7f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
if (brimstoneBullets)
|
||||
{
|
||||
PointParticle spark = new PointParticle(projectile.Center + projectile.velocity * 3, projectile.velocity, false, 2, 0.9f * projectile.scale, Color.Crimson * 0.7f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
Dust dust = Dust.NewDustPerfect(projectile.Center - projectile.velocity, Main.rand.NextBool(3) ? 90 : DustType<BrimstoneFlame>(), projectile.velocity * Main.rand.NextFloat(0.05f, 0.9f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.5f, 1f);
|
||||
}
|
||||
if (fireBullet)
|
||||
{
|
||||
if (projectile.timeLeft > 200)
|
||||
Dust dust = Dust.NewDustPerfect(projectile.Center - projectile.velocity, Main.rand.NextBool(3) ? 90 : DustType<BrimstoneFlame>(), projectile.velocity * Main.rand.NextFloat(0.05f, 0.9f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.5f, 1f) * projectile.scale;
|
||||
}
|
||||
if (fireBullet)
|
||||
{
|
||||
float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * 8f;
|
||||
Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation);
|
||||
Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation) * projectile.scale;
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, Main.rand.NextBool() ? 174 : 6, projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.4f, 0.8f);
|
||||
dust.scale = Main.rand.NextFloat(0.4f, 0.8f) * projectile.scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (iceBullet)
|
||||
{
|
||||
if (projectile.timeLeft > 200)
|
||||
if (iceBullet)
|
||||
{
|
||||
float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * -8f;
|
||||
Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation);
|
||||
Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation) * projectile.scale;
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, Main.rand.NextBool() ? 135 : 137, projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.4f, 0.8f);
|
||||
dust.scale = Main.rand.NextFloat(0.4f, 0.8f) * projectile.scale;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (shockBullet)
|
||||
{
|
||||
float targetDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
if (projectile.timeLeft > 200 && targetDist < 1400f)
|
||||
if (shockBullet)
|
||||
{
|
||||
SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, -projectile.velocity * 0.05f, false, 2, 1.1f, Color.Turquoise * 0.75f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
if (Main.rand.NextBool(3))
|
||||
float targetDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
if (targetDist < 1400f)
|
||||
{
|
||||
SparkParticle spark2 = new SparkParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6), -projectile.velocity * Main.rand.NextFloat(0.05f, 0.4f), false, 20, 0.4f, Color.Turquoise * 0.75f);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, -projectile.velocity * 0.05f, false, 2, 1.1f * projectile.scale, Color.Turquoise * 0.75f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
SparkParticle spark2 = new SparkParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6) * projectile.scale, -projectile.velocity * Main.rand.NextFloat(0.05f, 0.4f), false, 20, 0.4f * projectile.scale, Color.Turquoise * 0.75f);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((pearlBullet1 || pearlBullet2 || pearlBullet3))
|
||||
{
|
||||
float targetDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
if (projectile.timeLeft > 200 && targetDist < 1400f)
|
||||
if ((pearlBullet1 || pearlBullet2 || pearlBullet3))
|
||||
{
|
||||
Color color = pearlBullet1 ? Color.LightBlue : pearlBullet2 ? Color.LightPink : Color.Khaki;
|
||||
Particle spark = new GlowSparkParticle(projectile.Center + projectile.velocity * 1.5f, -projectile.velocity * 0.05f, false, 3, 0.0093f, color, new Vector2(0.6f, 1.8f), false, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
if (Main.rand.NextBool(5))
|
||||
float targetDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
if (targetDist < 1400f)
|
||||
{
|
||||
PearlParticle pearl1 = new PearlParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6), -projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f), false, Main.rand.Next(15, 20 + 1), Main.rand.NextFloat(0.4f, 0.55f), color, 0.9f, Main.rand.NextFloat(1, -1), true);
|
||||
GeneralParticleHandler.SpawnParticle(pearl1);
|
||||
Color color = pearlBullet1 ? Color.LightBlue : pearlBullet2 ? Color.LightPink : Color.Khaki;
|
||||
Particle spark = new GlowSparkParticle(projectile.Center + projectile.velocity * 1.5f, -projectile.velocity * 0.05f, false, 3, 0.0093f * projectile.scale, color, new Vector2(0.6f, 1.8f), false, false);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
if (Main.rand.NextBool(5))
|
||||
{
|
||||
PearlParticle pearl1 = new PearlParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6) * projectile.scale, -projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f), false, Main.rand.Next(15, 20 + 1), Main.rand.NextFloat(0.4f, 0.55f) * projectile.scale, color, 0.9f, Main.rand.NextFloat(1, -1), true);
|
||||
GeneralParticleHandler.SpawnParticle(pearl1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (lifeBullet)
|
||||
{
|
||||
float targetDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
if (projectile.timeLeft > 200 && targetDist < 1400f)
|
||||
if (lifeBullet)
|
||||
{
|
||||
SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, -projectile.velocity * 0.05f, false, 2, 0.85f, Color.White * 0.75f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
float targetDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
if (targetDist < 1400f)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(projectile.Center + projectile.velocity, DustID.AncientLight, -projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.65f, 0.9f);
|
||||
dust.alpha = 100;
|
||||
SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, -projectile.velocity * 0.05f, false, 2, 0.85f * projectile.scale, Color.White * 0.75f);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(projectile.Center + projectile.velocity, DustID.AncientLight, -projectile.velocity * Main.rand.NextFloat(0.1f, 0.9f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.65f, 0.9f) * projectile.scale;
|
||||
dust.alpha = 100;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#region betterLifeBullet
|
||||
if (betterLifeBullet1)
|
||||
{
|
||||
float targetDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
if (projectile.timeLeft > 200 && targetDist < 1400f)
|
||||
#region betterLifeBullet
|
||||
if (betterLifeBullet1)
|
||||
{
|
||||
int randomColor = Main.rand.Next(1, 3 + 1);
|
||||
Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki;
|
||||
|
||||
float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * -8f;
|
||||
Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation);
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
float targetDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
if (targetDist < 1400f)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, DustID.FireworksRGB, projectile.velocity * Main.rand.NextFloat(0.05f, 0.2f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.35f, 0.45f);
|
||||
dust.color = color;
|
||||
}
|
||||
int randomColor = Main.rand.Next(1, 3 + 1);
|
||||
Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki;
|
||||
|
||||
SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, projectile.velocity * 0.05f, false, 2, 0.85f, color);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * -8f;
|
||||
Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation);
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
SparkParticle spark3 = new SparkParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6), -projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f), false, 20, 0.55f, color * 0.5f);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, DustID.FireworksRGB, projectile.velocity * Main.rand.NextFloat(0.05f, 0.2f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.35f, 0.45f) * projectile.scale;
|
||||
dust.color = color;
|
||||
}
|
||||
|
||||
SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, projectile.velocity * 0.05f, false, 2, 0.85f * projectile.scale, color);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
SparkParticle spark3 = new SparkParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6) * projectile.scale, -projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f), false, 20, 0.55f * projectile.scale, color * 0.5f);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (betterLifeBullet2)
|
||||
{
|
||||
float targetDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
if (projectile.timeLeft > 200 && targetDist < 1400f)
|
||||
if (betterLifeBullet2)
|
||||
{
|
||||
int randomColor = Main.rand.Next(1, 3 + 1);
|
||||
Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki;
|
||||
|
||||
float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * 8f;
|
||||
Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation);
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
float targetDist = Vector2.Distance(player.Center, projectile.Center);
|
||||
if (targetDist < 1400f)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, DustID.FireworksRGB, projectile.velocity * Main.rand.NextFloat(0.05f, 0.2f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.35f, 0.45f);
|
||||
dust.color = color;
|
||||
}
|
||||
int randomColor = Main.rand.Next(1, 3 + 1);
|
||||
Color color = randomColor == 1 ? Color.LightBlue : randomColor == 2 ? Color.LightPink : Color.Khaki;
|
||||
|
||||
SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, projectile.velocity * 0.05f, false, 2, 0.85f, color);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
float helixOffset = (float)Math.Sin(projectile.timeLeft / 25f * MathHelper.TwoPi) * 8f;
|
||||
Vector2 spawnOffset = new Vector2(helixOffset, 10f).RotatedBy(projectile.rotation) * projectile.scale;
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
SparkParticle spark3 = new SparkParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6), -projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f), false, 20, 0.55f, color * 0.5f);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(projectile.Center + spawnOffset, DustID.FireworksRGB, projectile.velocity * Main.rand.NextFloat(0.05f, 0.2f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.35f, 0.45f) * projectile.scale;
|
||||
dust.color = color;
|
||||
}
|
||||
|
||||
SparkParticle spark = new SparkParticle(projectile.Center + projectile.velocity, projectile.velocity * 0.05f, false, 2, 0.85f * projectile.scale, color);
|
||||
GeneralParticleHandler.SpawnParticle(spark);
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
SparkParticle spark3 = new SparkParticle(projectile.Center + Main.rand.NextVector2Circular(6, 6) * projectile.scale, -projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f), false, 20, 0.55f * projectile.scale, color * 0.5f);
|
||||
GeneralParticleHandler.SpawnParticle(spark3);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -1,74 +1,470 @@
|
||||
using CalamityMod.Particles;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.Marshalling;
|
||||
using CalamityMod.Buffs.StatDebuffs;
|
||||
using CalamityMod.Dusts;
|
||||
using CalamityMod.Enums;
|
||||
using CalamityMod.Graphics.Primitives;
|
||||
using CalamityMod.Particles;
|
||||
using CalamityMod.Projectiles.Magic;
|
||||
using CalamityMod.Projectiles.Typeless;
|
||||
using CalamityMod.Systems.Graphic.PixelationSystem;
|
||||
using Microsoft.Build.Construction;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using ReLogic.Content;
|
||||
using Terraria;
|
||||
using Terraria.Audio;
|
||||
using Terraria.Graphics.Shaders;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class DryadsTearMain : ModProjectile, ILocalizedModType
|
||||
public class DryadsTearMain : ModProjectile, ILocalizedModType, IPixelatedPrimitiveRenderer
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
|
||||
public ref float time => ref Projectile.localAI[1];
|
||||
public int turnDirection = 0; // Direction it will rotate
|
||||
public int turnChange = 0; // Adds variance to multiple aspects of the bullet, including when it will change its turn direction
|
||||
public float turnIntensity = 0; // Adds a bit more variance, this time to velocity
|
||||
public float damageMult = 1; // Multiplier that updates instantly, used for most of the gameplay effects
|
||||
public float visualMult = 0.75f;// Multiplier that updates over time, used for most of the visual effects
|
||||
public Vector2 dropletPosition; // The position of the orbiting teardrop
|
||||
public Vector2 lastDropletPosition; // The previous position of the orbiting teardroplet
|
||||
public Vector2 dropletVel; // The velocity of the teardrop
|
||||
public float orbitSine = 0; // A sine wave multiplier for the orbiting arc
|
||||
public static int startingUpdates = 5; // The number of extra updates the projectile starts with
|
||||
public bool dropletAttack = false; // If the bullet has begun sending it's droplet to attack
|
||||
public float dropletAttackLerp = 1; // A lerp variable used for timing the droplet's attack
|
||||
public int frameDelay = 0; // A few frames of delay after landing on the enemy before explosing, which improves the visuals
|
||||
public bool detachEffects = true; // Used for the moment when the droplet detatched from the main bullet
|
||||
public bool isMaxPower => damageMult >= 1; // If the bullet is at maximum power
|
||||
public float finalEffectMult => Projectile.scale * visualMult; // Used for many but not all visual scaling effects
|
||||
public NPC targeted; // The target being attacked by the droplet
|
||||
public ref float trueLifetime => ref Projectile.ai[2]; // The lifetime of the projectile, used over vanilla lifetime because it can increment by decimals
|
||||
|
||||
public int effectSpeedMod = 0; // Used to add variance to effects when firing rapidly
|
||||
public int fadeLifetime => (int)(35 + effectSpeedMod * Math.Max(1 - damageMult, 0)); // The time in which the projectile fades out and can no longer hit anything
|
||||
public int extendedLifetime => (int)(85 * Math.Min(damageMult, 1) + effectSpeedMod * Math.Max(1 - damageMult, 0)); // The time after lifetime reaches zero where the droplet does its attack
|
||||
public bool fading => trueLifetime <= fadeLifetime; // If the projectile is fading away
|
||||
|
||||
public float explosionDamageMult = 1.4f;
|
||||
public float maxDamageMult = 1.65f;
|
||||
public static Asset<Texture2D> ShineTexture { get; private set; }
|
||||
public static Asset<Texture2D> BloomTexture { get; private set; }
|
||||
public override void Load()
|
||||
{
|
||||
if (Main.dedServ)
|
||||
return;
|
||||
|
||||
ShineTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/GlowSpark");
|
||||
BloomTexture = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomCircle");
|
||||
}
|
||||
public Player Owner => Main.player[Projectile.owner];
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 8;
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 35;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 2;
|
||||
ProjectileID.Sets.DrawScreenCheckFluff[Type] = 10000;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 4;
|
||||
Projectile.height = 4;
|
||||
Projectile.width = 20;
|
||||
Projectile.height = 20;
|
||||
Projectile.aiStyle = ProjAIStyleID.Arrow;
|
||||
AIType = ProjectileID.Bullet;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 600;
|
||||
Projectile.extraUpdates = 5;
|
||||
Projectile.penetrate = -1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ignoreWater = true;
|
||||
Projectile.usesLocalNPCImmunity = true;
|
||||
Projectile.localNPCHitCooldown = -1;
|
||||
Projectile.timeLeft = 300;
|
||||
Projectile.ArmorPenetration = 18;
|
||||
Projectile.extraUpdates = startingUpdates;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Lighting.AddLight(Projectile.Center, Color.LimeGreen.ToVector3() * 0.25f);
|
||||
|
||||
Projectile.localAI[0] += 1f;
|
||||
if (Projectile.localAI[0] > 4f)
|
||||
if (dropletAttack && targeted != null && (targeted.life <= 0 || !targeted.active || !targeted.CanBeChasedBy(Projectile))) // If the chosen target becomes invalid, target a near enemy instead
|
||||
targeted = dropletPosition.ClosestNPCAt(1200); if (targeted == null) dropletAttack = false; // If that fails, cancel the teardrop effect
|
||||
Projectile.timeLeft++; // Keep regular lifetime from going down, since it uses it's own lifetime timer
|
||||
float mainBulletFadeTime = -extendedLifetime * 0.3f;
|
||||
Projectile.scale = 1 - MathF.Pow(Utils.GetLerpValue(fadeLifetime, mainBulletFadeTime, trueLifetime, true), 1.3f); // fade out the bullet scale when lifetime is at its end
|
||||
|
||||
if (turnDirection == 0)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, Main.rand.NextBool(5) ? 131 : 294, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.3f));
|
||||
trueLifetime = fadeLifetime * 1.5f;
|
||||
turnDirection = Main.rand.NextBool() ? -1 : 1;
|
||||
turnChange = Main.rand.Next(30, 190 + 1);
|
||||
turnIntensity = Main.rand.NextFloat(0.2f, 1.6f);
|
||||
effectSpeedMod = Main.rand.Next(5, 35);
|
||||
}
|
||||
if (time % turnChange == 0 && !fading)
|
||||
turnDirection *= -1;
|
||||
|
||||
visualMult = MathHelper.Lerp(visualMult, damageMult, 0.1f / Projectile.MaxUpdates);
|
||||
|
||||
float speed = 8 * MathF.Pow(visualMult, 0.3f) * Math.Max(MathF.Pow(Utils.GetLerpValue(0, fadeLifetime, trueLifetime, true), 2), 0.15f);
|
||||
bool chanceForDust = Main.rand.NextBool((int)Math.Clamp((fading ? 8 : 5) / finalEffectMult, 3, 60));
|
||||
if (time > 12 && chanceForDust && finalEffectMult > 0.1f) // Some dust effects
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * 5 + Main.rand.NextVector2CircularEdge(9, 9) * finalEffectMult, ModContent.DustType<SquashDustHollowPixelated>(), -Projectile.velocity * Main.rand.NextFloat(0.1f, 0.4f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.45f, 0.65f);
|
||||
if (dust.type == 131)
|
||||
dust.scale = Main.rand.NextFloat(0.35f, 0.55f);
|
||||
dust.scale = Main.rand.NextFloat(0.85f, 1.0f) * finalEffectMult;
|
||||
dust.color = Color.Aquamarine;
|
||||
dust.noLight = true;
|
||||
dust.noLightEmittence = true;
|
||||
dust.fadeIn = 1;
|
||||
}
|
||||
|
||||
if (time > 0) // Reduce damage and visual intensity for every projectile of this type from the same player that are relativley close to each other
|
||||
{
|
||||
float damageReduction = 1;
|
||||
int ownedProj = Owner.ownedProjectileCounts[Projectile.type];
|
||||
for (int x = 0; x < Main.maxProjectiles; x++)
|
||||
{
|
||||
Projectile projectile = Main.projectile[x];
|
||||
if (projectile.owner == Projectile.owner && projectile.active && projectile.type == Projectile.type && projectile != Projectile)
|
||||
damageReduction++;
|
||||
}
|
||||
float newDamageMult = MathF.Pow(1 / damageReduction, 0.25f);
|
||||
if (newDamageMult < damageMult && !fading)
|
||||
damageMult = newDamageMult;
|
||||
}
|
||||
|
||||
if (isMaxPower)
|
||||
damageMult = maxDamageMult;
|
||||
|
||||
|
||||
float movement = Main.rand.NextFloat(0.009f, 0.0115f) * speed;
|
||||
if (damageMult < 1)
|
||||
Projectile.velocity += Vector2.Lerp(Projectile.velocity.RotatedBy(MathHelper.PiOver2 * turnDirection).SafeNormalize(Vector2.UnitX) * movement * turnIntensity, Projectile.velocity, MathF.Pow(Math.Min(damageMult + 0.15f, 1), 3.3f));
|
||||
Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * speed;
|
||||
|
||||
float startDropAttackTime = 0;
|
||||
if (dropletAttack && trueLifetime <= startDropAttackTime)
|
||||
{
|
||||
if (detachEffects)
|
||||
{
|
||||
Projectile.Opacity = 0;
|
||||
float scale = 0.7f * damageMult;
|
||||
SoundEngine.PlaySound(SoundID.DD2_WitherBeastCrystalImpact with { Volume = 0.9f * damageMult, Pitch = 0.3f }, Projectile.Center);
|
||||
for (int i = 0; i <= 2; i++)
|
||||
{
|
||||
CustomColorChangeSpark detach = new CustomColorChangeSpark(dropletPosition, Vector2.UnitY * 0.1f, "CalamityMod/Particles/BloomCircle", false, 15, 0.45f * scale, Color.Lime, Color.Turquoise, new Vector2(1f, 1f), true, true, colorFadeSpeed: 5, shrinkSpeed: -0.25f, extraRotation: MathHelper.PiOver2);
|
||||
GeneralParticleHandler.SpawnParticle(detach, true);
|
||||
}
|
||||
for (int i = -1; i <= 1; i += 2)
|
||||
{
|
||||
CustomColorChangeSpark detachWave = new CustomColorChangeSpark(dropletPosition, Vector2.UnitX * 1.5f * i * scale, "CalamityMod/Particles/ArchSmear", false, 15, 0.35f * scale, Color.Turquoise, Color.Lime, new Vector2(0.8f, 1.1f), colorFadeSpeed: 5, shrinkSpeed: 0.45f);
|
||||
GeneralParticleHandler.SpawnParticle(detachWave, true);
|
||||
}
|
||||
for (int i = -2; i <= 2; i += 1) // 4
|
||||
{
|
||||
float angle = MathHelper.PiOver4 / 2;
|
||||
Vector2 vel = Vector2.UnitX.RotatedBy(Math.Abs(i) == 1 ? angle : -angle) * 2.2f * Math.Sign(i) * scale;
|
||||
for (int t = -1; t <= 1; t++) // 3
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(dropletPosition, ModContent.DustType<SquashDustPixelated>(), vel.RotatedBy(0.25f * t) * (2.5f - Math.Abs(t)));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(1.45f, 1.55f) * scale;
|
||||
dust.color = t == 0 ? Color.Aquamarine : Color.Lime;
|
||||
dust.noLight = true;
|
||||
dust.noLightEmittence = true;
|
||||
dust.fadeIn = 1 * scale;
|
||||
dust.customData = new Vector2(0.6f, 3.5f);
|
||||
}
|
||||
if (i == -1)
|
||||
i++;
|
||||
}
|
||||
detachEffects = false;
|
||||
}
|
||||
dropletAttackLerp = (1 - MathF.Pow(Utils.GetLerpValue(startDropAttackTime, -extendedLifetime, trueLifetime, true), 4)) * damageMult;
|
||||
float cappedReverseDamageMult = Math.Max(1 - damageMult, 0);
|
||||
Vector2 Xoffset = Vector2.UnitX * (targeted.width * 0.5f * turnIntensity) * cappedReverseDamageMult * turnDirection;
|
||||
Vector2 goalPosition = targeted.Center + Xoffset - (Vector2.UnitY * (targeted.height / 2 + (220 + turnChange * (0.25f + cappedReverseDamageMult)))) * dropletAttackLerp;
|
||||
Vector2 goalVel = (goalPosition - dropletPosition) / ((1 + 6 * dropletAttackLerp) * Projectile.MaxUpdates);
|
||||
dropletVel = goalVel;
|
||||
lastDropletPosition = dropletPosition;
|
||||
dropletPosition += dropletVel;
|
||||
}
|
||||
else
|
||||
{
|
||||
float sineTimer = time + turnChange;
|
||||
float sine = MathF.Sin((sineTimer / 0.5f) / MathHelper.Pi / startingUpdates);
|
||||
float sine2 = MathF.Sin((sineTimer / 1f) / MathHelper.Pi / startingUpdates);
|
||||
orbitSine = MathHelper.Lerp(Math.Abs(sine2), 0.1f, 1 - Math.Abs(sine2));
|
||||
float xOrbit = 35f * finalEffectMult;
|
||||
float yOrbit = 25f * finalEffectMult;
|
||||
if (finalEffectMult > 0.35f)
|
||||
dropletPosition = Projectile.Center + Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(MathHelper.PiOver2) * xOrbit * sine + Projectile.velocity.SafeNormalize(Vector2.UnitX) * yOrbit * orbitSine;
|
||||
else
|
||||
dust.fadeIn = 0.5f;
|
||||
dropletPosition += (dropletVel * 3f + (Projectile.velocity.SafeNormalize(Vector2.UnitX) + dropletPosition.DirectionFrom(Projectile.Center)) * 0.75f) * finalEffectMult;
|
||||
|
||||
}
|
||||
|
||||
if (lastDropletPosition == Vector2.Zero) lastDropletPosition = dropletPosition;
|
||||
bool lowLifetime = trueLifetime <= mainBulletFadeTime;
|
||||
float dropletScaling = (dropletAttack ? (1 + (1 - dropletAttackLerp)) * damageMult : finalEffectMult);
|
||||
if (time > 1 * Projectile.MaxUpdates && (!lowLifetime || dropletAttack))
|
||||
{
|
||||
if (!lowLifetime)
|
||||
{
|
||||
CustomColorChangeSpark trail = new CustomColorChangeSpark(Projectile.Center - Projectile.velocity.SafeNormalize(Vector2.UnitX) * (20 - Math.Min(9f / finalEffectMult, 20)), -Projectile.velocity.SafeNormalize(Vector2.UnitX) * 0.1f, "CalamityMod/Particles/BloomCircle", false,
|
||||
(int)(18 * finalEffectMult), 0.2f * finalEffectMult, Color.Turquoise, Color.Lime, new Vector2(0.25f, 2.25f * Utils.Remap(speed, 7, 0.5f, 1, 0.1f)), noShrink: true, colorFadeSpeed: 5);
|
||||
GeneralParticleHandler.SpawnParticle(trail, true);
|
||||
}
|
||||
|
||||
bool falling = trueLifetime < -extendedLifetime * 0.65f;
|
||||
if (frameDelay < 2)
|
||||
{
|
||||
float dropLerp = MathF.Pow(Utils.GetLerpValue(startDropAttackTime, -extendedLifetime, trueLifetime, true), 2.5f);
|
||||
if (lastDropletPosition != dropletPosition)
|
||||
dropletVel = lastDropletPosition.DirectionTo(dropletPosition);
|
||||
float speedMult = falling ? dropLerp * 0.5f : Utils.Remap(speed, 7, 0.5f, 1, 0.1f);
|
||||
float colorMult = falling ? 1 - dropLerp * 0.35f : 1;
|
||||
CustomColorChangeSpark dropTrail = new CustomColorChangeSpark(dropletPosition - dropletVel * 16.5f * speedMult * dropletScaling, falling ? dropletVel * 3 : dropletVel * 0.1f, "CalamityMod/Particles/BloomCircle", false,
|
||||
falling ? (int)(10 * (1 - dropLerp * 0.6f)) : (int)(6 + 2 * dropletScaling), 0.135f * dropletScaling * (1 + dropLerp * 0.3f), Color.Turquoise * colorMult, falling ? Color.Lime * colorMult : Color.Teal * colorMult, new Vector2(0.15f * (falling ? 0.5f + dropLerp * 3 : 1) * damageMult, (Math.Max(0.15f * lastDropletPosition.Distance(dropletPosition), 0.25f) * (1 - dropLerp * 0.2f))), noShrink: true, colorFadeSpeed: 5, glowOpacity: colorMult, shrinkSpeed: falling ? 1.5f - dropLerp : 0);
|
||||
GeneralParticleHandler.SpawnParticle(dropTrail, true);
|
||||
|
||||
if (Main.rand.NextBool(3))
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(dropletPosition + Main.rand.NextVector2Circular(5 + 20 * (1 - dropletAttackLerp), 5 + 20 * (1 - dropletAttackLerp)), ModContent.DustType<SquashDustPixelated>());
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(1.15f, 1.55f) * 0.5f * visualMult;
|
||||
dust.velocity = dropletVel.RotatedByRandom(0.2f) * Main.rand.NextFloat(0.3f, 0.9f);
|
||||
dust.color = Main.rand.NextBool() ? Color.Aquamarine : Color.Teal;
|
||||
dust.noLight = true;
|
||||
dust.noLightEmittence = true;
|
||||
dust.fadeIn = Math.Max((Main.rand.NextFloat(-0.2f, -0.4f) - (Main.rand.NextBool(5) ? 0.4f : 0)) * visualMult, -0.85f);
|
||||
dust.customData = new Vector2(1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Lighting.AddLight(Projectile.Center, Color.LimeGreen.ToVector3() * 0.4f * finalEffectMult);
|
||||
Lighting.AddLight(dropletPosition, Color.Turquoise.ToVector3() * 0.25f * dropletScaling);
|
||||
|
||||
lastDropletPosition = dropletPosition;
|
||||
if (trueLifetime <= 0 && (!dropletAttack || (frameDelay > 3 && trueLifetime <= -extendedLifetime)))
|
||||
{
|
||||
Splash();
|
||||
Projectile.Kill();
|
||||
return;
|
||||
}
|
||||
if (Projectile.FinalExtraUpdate())
|
||||
trueLifetime -= 1 / MathF.Pow(damageMult, 0.3f);
|
||||
if (trueLifetime <= -extendedLifetime && Projectile.FinalExtraUpdate())
|
||||
frameDelay++;
|
||||
time++;
|
||||
}
|
||||
public void Splash()
|
||||
{
|
||||
if (dropletAttack)
|
||||
{
|
||||
SoundStyle drop1 = new("CalamityMod/Sounds/Item/MittHit");
|
||||
SoundEngine.PlaySound(drop1 with { Volume = 0.8f * damageMult, Pitch = Main.rand.NextFloat(0.6f, 0.7f) }, dropletPosition);
|
||||
SoundStyle drop2 = new("CalamityMod/Sounds/Item/WaterSplash", 2);
|
||||
SoundEngine.PlaySound(drop2 with { Volume = 0.7f * damageMult, Pitch = Main.rand.NextFloat(1.4f, 1.5f) }, dropletPosition);
|
||||
if (isMaxPower)
|
||||
{
|
||||
SoundStyle drop3 = new("CalamityMod/Sounds/Item/HolyFireBulletExplosion");
|
||||
SoundEngine.PlaySound(drop3 with { Volume = 0.8f, Pitch = Main.rand.NextFloat(-0.5f, -0.6f) }, dropletPosition);
|
||||
}
|
||||
|
||||
float scale = (isMaxPower ? 2f : 1.5f) * damageMult;
|
||||
bool reduceVisuals = damageMult < 0.5f;
|
||||
for (int i = 0; i <= (reduceVisuals ? 1 : 2); i++)
|
||||
{
|
||||
CustomColorChangeSpark bloomHit = new CustomColorChangeSpark(dropletPosition, Vector2.UnitY * 0.1f, "CalamityMod/Particles/BloomCircle", false, 10, 0.45f * scale, Color.Lime, Color.Turquoise, new Vector2(1f, 2f), true, true, colorFadeSpeed: 5, shrinkSpeed: 0.45f, extraRotation: MathHelper.PiOver2);
|
||||
GeneralParticleHandler.SpawnParticle(bloomHit, true);
|
||||
}
|
||||
for (int i = -1; i <= 1; i += 2)
|
||||
{
|
||||
CustomColorChangeSpark wave = new CustomColorChangeSpark(dropletPosition, Vector2.UnitX * 7.5f * i * scale, "CalamityMod/Particles/ArchSmear", false, 12, 0.35f * scale, Color.Turquoise, Color.Lime, new Vector2(1f, 1.1f), colorFadeSpeed: 5, shrinkSpeed: 0.45f);
|
||||
GeneralParticleHandler.SpawnParticle(wave, true);
|
||||
CustomColorChangeSpark wave2 = new CustomColorChangeSpark(dropletPosition, Vector2.UnitX * 10.5f * i * scale, "CalamityMod/Particles/ArchSmear", false, 8, 0.35f * scale, Color.Lime, Color.Turquoise, new Vector2(0.8f, 1.1f), colorFadeSpeed: 5, shrinkSpeed: 0.55f);
|
||||
GeneralParticleHandler.SpawnParticle(wave2, true);
|
||||
}
|
||||
for (int i = -2; i <= 2; i += 1) // 4
|
||||
{
|
||||
float angle = MathHelper.PiOver4 / 2.5f;
|
||||
Vector2 vel = Vector2.UnitX.RotatedBy(Math.Abs(i) == 1 ? angle : -angle) * 2.2f * Math.Sign(i) * scale;
|
||||
for (int t = (reduceVisuals ? 0 : -1); t <= (reduceVisuals ? 0 : 1); t++) // 3
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(dropletPosition, ModContent.DustType<SquashDustPixelated>(), vel.RotatedBy(0.25f * t) * (2.5f - Math.Abs(t)) * scale);
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(1.25f, 1.35f) * scale;
|
||||
dust.color = t == 0 ? Color.Aquamarine : Color.Lime;
|
||||
dust.noLight = true;
|
||||
dust.noLightEmittence = true;
|
||||
dust.fadeIn = 1.4f * scale;
|
||||
dust.customData = new Vector2(0.6f, 3.5f);
|
||||
}
|
||||
if (i == -1)
|
||||
i++;
|
||||
}
|
||||
int dusts = reduceVisuals ? 4 : 10;
|
||||
for (int i = -dusts; i <= dusts; i++)
|
||||
{
|
||||
Dust dust = Dust.NewDustPerfect(dropletPosition + Main.rand.NextVector2CircularEdge(10 - Math.Abs(i), 10 - Math.Abs(i)), ModContent.DustType<SquashDustPixelated>(), Vector2.UnitX * 2f * i * scale);
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.85f, 0.95f) * scale;
|
||||
dust.color = Main.rand.NextBool() ? Color.Aquamarine : Color.Lime;
|
||||
dust.noLight = true;
|
||||
dust.noLightEmittence = true;
|
||||
dust.fadeIn = 0.45f * scale;
|
||||
dust.customData = new Vector2(0.8f, 1.3f);
|
||||
if (i == -1)
|
||||
i++;
|
||||
}
|
||||
if (targeted != null)
|
||||
{
|
||||
float blastSize = 75 * scale;
|
||||
float minMultiplier = 0.15f;
|
||||
int hitsToMinMult = (int)(3 + 5 * damageMult);
|
||||
int knockback = (int)(7 * damageMult * (isMaxPower ? -1 : 1)); // Give heavy knockback at full power
|
||||
int damage = (int)(Projectile.damage * explosionDamageMult * damageMult);
|
||||
Projectile blast = Projectile.NewProjectileDirect(Owner.GetSource_FromThis(), targeted.Center, Vector2.Zero, ModContent.ProjectileType<BasicBurst>(), damage, knockback, Owner.whoAmI, blastSize, minMultiplier, hitsToMinMult);
|
||||
blast.timeLeft = 8;
|
||||
blast.DamageType = DamageClass.Ranged;
|
||||
blast.ArmorPenetration = Projectile.ArmorPenetration;
|
||||
}
|
||||
if (damageMult >= 0.75f)
|
||||
Owner.SetScreenshake(6f * damageMult);
|
||||
}
|
||||
}
|
||||
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
||||
{
|
||||
Projectile.extraUpdates = 2;
|
||||
int chanceReduction = (int)(2 / damageMult);
|
||||
if (isMaxPower)
|
||||
{
|
||||
SoundStyle perfectHit = new("CalamityMod/Sounds/Item/LightMetal");
|
||||
for (int i = 0; i < 3; i++)
|
||||
SoundEngine.PlaySound(perfectHit with { Volume = 0.85f, Pitch = Main.rand.NextFloat(-1.2f, -1.3f) + 0.6f * i, MaxInstances = 3 }, dropletPosition);
|
||||
}
|
||||
if (damageMult >= 0.75f)
|
||||
{
|
||||
Owner.SetScreenshake(4f * damageMult);
|
||||
float angle = Main.rand.NextFloat(0, MathHelper.TwoPi);
|
||||
for (int i = -6; i <= 6; i++) // 12
|
||||
{
|
||||
float variance = Main.rand.NextFloat(-0.5f, 0.5f);
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType<SquashDustPixelated>(), Projectile.velocity.SafeNormalize(Vector2.UnitX).RotatedBy(variance * 0.3f).RotatedByRandom(0.1f) * (Main.rand.NextFloat(5, 6) - Math.Abs(variance * 9)) * 5 * damageMult);
|
||||
dust.noGravity = true;
|
||||
dust.scale = (Main.rand.NextFloat(2.5f, 2.75f) - Math.Abs(variance)) * damageMult;
|
||||
dust.color = Main.rand.NextBool() ? Color.Aquamarine : Color.Lime;
|
||||
dust.noLight = true;
|
||||
dust.noLightEmittence = true;
|
||||
dust.fadeIn = 1.25f * damageMult;
|
||||
dust.customData = new Vector2(0.3f, 1.7f);
|
||||
if (i == -1)
|
||||
i++;
|
||||
}
|
||||
float spining = Main.rand.NextFloat(-0.15f, 0.15f);
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
CustomColorChangeSpark hit = new CustomColorChangeSpark(Projectile.Center, Vector2.UnitX.RotatedBy(angle + MathHelper.PiOver2 * i) * 0.01f, "CalamityMod/Particles/FullStar", false, 9, 3.55f * damageMult, Color.Lime, Color.Turquoise, new Vector2(1f, 1f), true, true, colorFadeSpeed: 5, shrinkSpeed: 1f, extraRotation: MathHelper.PiOver2, spin: spining);
|
||||
GeneralParticleHandler.SpawnParticle(hit, true);
|
||||
}
|
||||
}
|
||||
dropletAttack = true;
|
||||
targeted = target;
|
||||
trueLifetime = fadeLifetime;
|
||||
|
||||
modifiers.SourceDamage *= damageMult;
|
||||
}
|
||||
public override bool? CanHitNPC(NPC target) => time > 1 && Projectile.numHits == 0;
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
float hitboxSize = 20 * Projectile.scale * damageMult;
|
||||
return CalamityUtils.CircularHitboxCollision(Projectile.Center, hitboxSize, targetHitbox);
|
||||
}
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor);
|
||||
Vector2 drawPosition = dropletPosition - Main.screenPosition;
|
||||
|
||||
float dropletScaling = (dropletAttack ? (1 + (1 - dropletAttackLerp) * 0.7f) * damageMult : finalEffectMult);
|
||||
PixelationManager.AddPixelatedDrawer((_) =>
|
||||
{
|
||||
float dropLerp = MathF.Pow(Utils.GetLerpValue(0, -extendedLifetime, trueLifetime, true), 2.5f); ;
|
||||
int draws = 3;
|
||||
for (int i = 0; i < draws; i++)
|
||||
{
|
||||
float circlingScale = ((i == 0 ? 0.15f : 0.3f) - orbitSine * 0.1f);
|
||||
Main.EntitySpriteDraw(BloomTexture.Value, drawPosition, null, i == 0 ? Color.White * 0.8f : Color.Turquoise, 0, BloomTexture.Value.Size() * 0.5f, dropletScaling * (circlingScale) * (0.8f + dropLerp * 0.2f), SpriteEffects.None);
|
||||
}
|
||||
|
||||
float fallTime = -extendedLifetime * 0.65f;
|
||||
float shineMult = damageMult * MathF.Pow((trueLifetime > fallTime ? Utils.GetLerpValue(0, fallTime, trueLifetime, true) : Utils.GetLerpValue(-extendedLifetime, fallTime, trueLifetime, true)), 2);
|
||||
for (int i = -1; i <= 1; i++)
|
||||
{
|
||||
if (i == 0) i++;
|
||||
float rot = MathHelper.PiOver2 * (i > 0 ? -1 : 1);
|
||||
for (int t = 0; t < 2; t++)
|
||||
Main.EntitySpriteDraw(ShineTexture.Value, drawPosition, null, t == 0 ? Color.Teal : Color.White * 0.65f, rot, ShineTexture.Value.Size() * 0.5f, new Vector2((t == 0 ? 3 : 1) * 0.02f, (t == 0 ? 0.6f : 1) * (0.2f + shineMult * 0.4f)) * shineMult * 0.2f, SpriteEffects.None);
|
||||
}
|
||||
|
||||
}, ((orbitSine > 0.5f || trueLifetime <= 0) ? Enums.GeneralDrawLayer.AfterProjectiles : Enums.GeneralDrawLayer.BeforeProjectiles), BlendState.Additive);
|
||||
return false;
|
||||
}
|
||||
|
||||
public float WidthFunction(float completion, Vector2 _)
|
||||
{
|
||||
float width;
|
||||
float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 9 - completion * 6);
|
||||
float newSine = 0.7f - sine * 0.1f;
|
||||
width = finalEffectMult * 25 * newSine * (completion < 0.4f ? 1 - MathF.Pow(Utils.GetLerpValue(0.4f, 0f, completion, true), 3) : Utils.GetLerpValue(1f, 0.4f, completion, true)) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completion, true)));
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
public Color ColorFunction(float completion, Vector2 _)
|
||||
{
|
||||
Color clr = Color.Lerp(Color.Lime, Color.Turquoise, completion + 0.3f);
|
||||
Color tipColor = Color.Lerp(clr, Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
|
||||
return Color.Lerp(clr, tipColor, completion);
|
||||
}
|
||||
|
||||
public float CoreWidthFunction(float completion, Vector2 _)
|
||||
{
|
||||
float width;
|
||||
|
||||
float sine = MathF.Sin(Main.GlobalTimeWrappedHourly * 9 - completion * 6);
|
||||
float newSine = 0.7f - sine * 0.2f;
|
||||
width = finalEffectMult * 20 * newSine * (completion < 0.4f ? 1 - MathF.Pow(Utils.GetLerpValue(0.4f, 0f, completion, true), 3) : Utils.GetLerpValue(1f, 0.4f, completion, true)) * (float)Math.Sin(Math.Acos(1 - Utils.GetLerpValue(0f, 0.08f, completion, true)));
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
public Color CoreColorFunction(float completion, Vector2 _)
|
||||
{
|
||||
Color tipColor = Color.Lerp(Color.Lerp(Color.White, Color.Turquoise, completion + 0.65f), Color.Transparent, Utils.GetLerpValue(0.8f, 1f, completion, true));
|
||||
return Color.Lerp(Color.White, tipColor, completion);
|
||||
}
|
||||
|
||||
public void RenderPixelatedPrimitives(SpriteBatch spriteBatch, GeneralDrawLayer layer)
|
||||
{
|
||||
// Render the main trail
|
||||
string shader = "CalamityMod:TrailStreak";
|
||||
Vector2[] length = Projectile.oldPos.Take((int)(Math.Max(40 * visualMult, 14))).ToArray();
|
||||
GameShaders.Misc[shader].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/Particles/BloomRing"));
|
||||
PrimitiveRenderer.RenderTrail(length, new(WidthFunction, ColorFunction, (_, _) => Projectile.Size * 0.5f, true, true, GameShaders.Misc[shader]), length.Length * 2);
|
||||
|
||||
// Render a smaller, pure white trail in the same position
|
||||
Vector2[] length2 = Projectile.oldPos.Take((int)(Math.Max(18 * visualMult, 6))).ToArray();
|
||||
GameShaders.Misc[shader].SetShaderTexture(ModContent.Request<Texture2D>("CalamityMod/ExtraTextures/Trails/SylvestaffStreak"));
|
||||
PrimitiveRenderer.RenderTrail(length2, new(CoreWidthFunction, CoreColorFunction, (_, _) => Projectile.Size * 0.5f, true, true, GameShaders.Misc[shader]), length2.Length * 2);
|
||||
}
|
||||
public override void OnKill(int timeLeft)
|
||||
{
|
||||
if (Projectile.owner == Main.myPlayer)
|
||||
{
|
||||
for (int b = 0; b < 2; b++)
|
||||
{
|
||||
Vector2 velocity = CalamityUtils.RandomVelocity(100f, 70f, 100f);
|
||||
Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, velocity, ModContent.ProjectileType<DryadsTearSplit>(), (int)(Projectile.damage * 0.1), 0f, Projectile.owner, 0f, 0f);
|
||||
}
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
Vector2 velocity = new Vector2(4, 4).RotatedByRandom(100);
|
||||
LineParticle spark2 = new LineParticle(Projectile.Center + velocity, velocity * Main.rand.NextFloat(0.5f, 1f), false, 11, 0.65f, Main.rand.NextBool(3) ? Color.MediumAquamarine : Color.Lime);
|
||||
GeneralParticleHandler.SpawnParticle(spark2);
|
||||
}
|
||||
}
|
||||
SoundEngine.PlaySound(SoundID.Item118 with { Pitch = 0.5f }, Projectile.Center);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 135 B |
@@ -1,61 +0,0 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Terraria;
|
||||
using Terraria.ID;
|
||||
using Terraria.ModLoader;
|
||||
|
||||
namespace CalamityMod.Projectiles.Ranged
|
||||
{
|
||||
public class DryadsTearSplit : ModProjectile, ILocalizedModType
|
||||
{
|
||||
public new string LocalizationCategory => "Projectiles.Ranged";
|
||||
private float speed = 0f;
|
||||
public override void SetStaticDefaults()
|
||||
{
|
||||
ProjectileID.Sets.CultistIsResistantTo[Type] = true;
|
||||
ProjectileID.Sets.TrailCacheLength[Type] = 3;
|
||||
ProjectileID.Sets.TrailingMode[Type] = 0;
|
||||
}
|
||||
|
||||
public override void SetDefaults()
|
||||
{
|
||||
Projectile.width = 4;
|
||||
Projectile.height = 4;
|
||||
Projectile.aiStyle = ProjAIStyleID.Arrow;
|
||||
Projectile.friendly = true;
|
||||
Projectile.DamageType = DamageClass.Ranged;
|
||||
Projectile.penetrate = 1;
|
||||
Projectile.timeLeft = 210;
|
||||
Projectile.extraUpdates = 1;
|
||||
Projectile.tileCollide = false;
|
||||
Projectile.ArmorPenetration = 10;
|
||||
AIType = ProjectileID.Bullet;
|
||||
}
|
||||
|
||||
public override bool? CanHitNPC(NPC target) => Projectile.ai[2] >= 30 && target.CanBeChasedBy(Projectile);
|
||||
|
||||
public override bool PreDraw(ref Color lightColor)
|
||||
{
|
||||
CalamityUtils.DrawAfterimagesFromEdge(Projectile, 0, lightColor);
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void AI()
|
||||
{
|
||||
Projectile.ai[2]++;
|
||||
Projectile.rotation = Projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
||||
|
||||
Dust dust = Dust.NewDustPerfect(Projectile.Center, DustID.PortalBoltTrail, -Projectile.velocity * Main.rand.NextFloat(0.05f, 0.6f));
|
||||
dust.noGravity = true;
|
||||
dust.scale = Main.rand.NextFloat(0.5f, 0.8f);
|
||||
dust.color = Main.rand.NextBool(3) ? Color.MediumAquamarine : Color.Lime;
|
||||
|
||||
if (speed == 0f)
|
||||
speed = Projectile.velocity.Length();
|
||||
|
||||
if (Projectile.ai[2] >= 30)
|
||||
{
|
||||
CalamityUtils.HomeInOnNPC(Projectile, true, 500f, speed, 12f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 115 B |
@@ -72,6 +72,14 @@ namespace CalamityMod.Projectiles.Typeless
|
||||
|
||||
if (customKnockback != 0)
|
||||
target.MoveNPC(pushVelocity, customKnockback, hasStongDisplacement, Main.player[Projectile.owner]);
|
||||
|
||||
if (Projectile.owner != -1)
|
||||
{
|
||||
Player Owner = Main.player[Projectile.owner];
|
||||
bool crit = Main.rand.Next(0, 100 + 1) < Owner.GetTotalCritChance(Projectile.DamageType);
|
||||
if (crit)
|
||||
modifiers.SetCrit();
|
||||
}
|
||||
}
|
||||
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user