1. Reverted Sand Cloak cooldown to 30 seconds 2. Changed Ink Bomb cooldown to 20 seconds 3. Nerfed Dark God's Sheath and Eclipse Mirror stealth acceleration bonuses 4. Nerfed Dragon Scales tornado damage 5. Nerfed Abyssal Mirror stealth regen 6. Buffed Eclipse mirror standing still regen 7. Nerfed Mirage Mirror stealth regen 8. Nerfed Spectral veil stealth regen while moving, now increases stealth regen while standing still 9. Nerfed max stealth of aerospec, statigel, sulphurous, victide, and gladiator armors 10. Buffed Magic Missile damage 11. Nerfed Scuttler's Jewel 12. Made Vigilance projectiles less opaque 13. Reduced the amount of laughs from Vigilance seekers 14. Increased the speed of Perdition's projectiles
112 lines
4.6 KiB
C#
112 lines
4.6 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using System;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
using Terraria.Audio;
|
|
|
|
namespace CalamityMod.Projectiles.Summon
|
|
{
|
|
public class LostSoulGiant : ModProjectile
|
|
{
|
|
public ref float Time => ref Projectile.ai[0];
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Soul");
|
|
Main.projFrames[Projectile.type] = 4;
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 2;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.scale = 0.8f;
|
|
Projectile.width = Projectile.height = 52;
|
|
Projectile.friendly = true;
|
|
Projectile.penetrate = 1;
|
|
Projectile.tileCollide = false;
|
|
Projectile.DamageType = DamageClass.Magic;
|
|
Projectile.ignoreWater = true;
|
|
}
|
|
|
|
public override void AI() => DoSoulAI(Projectile, ref Time);
|
|
|
|
public static void DoSoulAI(Projectile projectile, ref float time)
|
|
{
|
|
if (time >= 15f)
|
|
{
|
|
NPC potentialTarget = projectile.Center.MinionHoming(1800f, Main.player[projectile.owner], false);
|
|
if (potentialTarget != null)
|
|
HomeInOnTarget(projectile, potentialTarget);
|
|
}
|
|
|
|
projectile.Opacity = Utils.GetLerpValue(0f, 15f, time, true);
|
|
projectile.frameCounter++;
|
|
if (projectile.frameCounter % 5f == 4f)
|
|
projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type];
|
|
|
|
projectile.rotation = projectile.velocity.ToRotation();
|
|
projectile.spriteDirection = (projectile.velocity.X > 0f).ToDirectionInt();
|
|
if (projectile.spriteDirection == -1)
|
|
projectile.rotation += MathHelper.Pi;
|
|
|
|
time++;
|
|
}
|
|
|
|
public static void HomeInOnTarget(Projectile projectile, NPC target)
|
|
{
|
|
float speed = MathHelper.Lerp(21f, 31f, (float)Math.Sin(projectile.identity % 7f / 7f * MathHelper.TwoPi) * 0.5f + 0.5f);
|
|
projectile.velocity = Vector2.Lerp(projectile.velocity, projectile.SafeDirectionTo(target.Center) * speed, 0.075f);
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor)
|
|
{
|
|
Color baseColor = Color.Lerp(Color.IndianRed, Color.DarkViolet, Projectile.identity % 5f / 5f * 0.5f);
|
|
Color color = Color.Lerp(baseColor * 1.5f, baseColor, (float)Math.Cos(Main.GlobalTimeWrappedHourly * 2.7f) * 0.04f + 0.45f);
|
|
color.A = 0;
|
|
return color * Projectile.Opacity;
|
|
}
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
SpriteEffects direction = Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
|
Texture2D texture = ModContent.Request<Texture2D>(Texture).Value;
|
|
Rectangle frame = texture.Frame(1, Main.projFrames[Projectile.type], 0, Projectile.frame);
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
for (int j = 0; j < Projectile.oldPos.Length / 2; j++)
|
|
{
|
|
float fade = (float)Math.Pow(1f - Utils.GetLerpValue(0f, Projectile.oldPos.Length / 2, j, true), 2D);
|
|
Color drawColor = Color.Lerp(Projectile.GetAlpha(lightColor), Color.White * Projectile.Opacity, j / Projectile.oldPos.Length) * fade;
|
|
Vector2 drawPosition = Projectile.oldPos[j] + Projectile.Size * 0.5f + (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 1.5f - Main.screenPosition;
|
|
float rotation = Projectile.oldRot[j];
|
|
|
|
Main.EntitySpriteDraw(texture, drawPosition, frame, drawColor, rotation, frame.Size() * 0.5f, Projectile.scale, direction, 0);
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
// Play a wraith death sound.
|
|
SoundEngine.PlaySound(SoundID.NPCDeath52, Projectile.Center);
|
|
|
|
if (Main.dedServ)
|
|
return;
|
|
|
|
for (int i = 0; i < 45; i++)
|
|
{
|
|
Dust ectoplasm = Dust.NewDustPerfect(Projectile.Center + Main.rand.NextVector2Circular(60f, 60f), 264);
|
|
ectoplasm.velocity = Main.rand.NextVector2Circular(2f, 2f);
|
|
ectoplasm.color = Projectile.GetAlpha(Color.White);
|
|
ectoplasm.scale = 1.45f;
|
|
ectoplasm.noGravity = true;
|
|
ectoplasm.noLight = true;
|
|
}
|
|
}
|
|
}
|
|
}
|