Also I forgot to push my reality rupture and ichor spear minor tweaks before hand so they're in here too. Reality rupture stealth hit sound is louder. Reality rupture stealth visual always has at least one big crack, cracks fade out. There's more consistency in the spark particles on realty rupture stealth and ichor spear on hit sparks. Reality Rupture stealth produces light.
139 lines
6.0 KiB
C#
139 lines
6.0 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Dusts;
|
|
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.Magic
|
|
{
|
|
public class AstralStarMagic : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Magic";
|
|
public override string Texture => "CalamityMod/Projectiles/Typeless/AstralStar";
|
|
|
|
private int noTileHitCounter = 120;
|
|
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 24;
|
|
Projectile.height = 24;
|
|
Projectile.friendly = true;
|
|
Projectile.DamageType = DamageClass.Magic;
|
|
Projectile.alpha = 50;
|
|
Projectile.penetrate = 1;
|
|
Projectile.tileCollide = false;
|
|
Projectile.ignoreWater = true;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
int randomToSubtract = Main.rand.Next(1, 3);
|
|
noTileHitCounter -= randomToSubtract;
|
|
if (noTileHitCounter == 0)
|
|
{
|
|
Projectile.tileCollide = true;
|
|
}
|
|
if (Projectile.soundDelay == 0)
|
|
{
|
|
Projectile.soundDelay = 20 + Main.rand.Next(40);
|
|
if (Main.rand.NextBool(5))
|
|
{
|
|
SoundEngine.PlaySound(SoundID.Item9, Projectile.position);
|
|
}
|
|
}
|
|
Projectile.alpha -= 15;
|
|
int opacity = 150;
|
|
if (Projectile.Center.Y >= Projectile.ai[1])
|
|
{
|
|
opacity = 0;
|
|
}
|
|
if (Projectile.alpha < opacity)
|
|
{
|
|
Projectile.alpha = opacity;
|
|
}
|
|
Projectile.rotation += (Math.Abs(Projectile.velocity.X) + Math.Abs(Projectile.velocity.Y)) * 0.01f * (float)Projectile.direction;
|
|
if (Main.rand.NextBool(16))
|
|
{
|
|
Vector2 velocity = Vector2.UnitX.RotatedByRandom(Math.PI / 2D).RotatedBy((double)Projectile.velocity.ToRotation(), default);
|
|
int idx = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<AstralOrange>(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
|
|
Main.dust[idx].velocity = velocity * 0.66f;
|
|
Main.dust[idx].position = Projectile.Center + velocity * 12f;
|
|
}
|
|
if (Main.rand.NextBool(48) && Main.netMode != NetmodeID.Server)
|
|
{
|
|
int idx = Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.Center, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), 16, 1f);
|
|
Main.gore[idx].velocity *= 0.66f;
|
|
Main.gore[idx].velocity += Projectile.velocity * 0.3f;
|
|
}
|
|
if (Projectile.ai[1] == 1f)
|
|
{
|
|
Projectile.light = 0.9f;
|
|
if (Main.rand.NextBool(10))
|
|
{
|
|
Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<AstralOrange>(), Projectile.velocity.X * 0.5f, Projectile.velocity.Y * 0.5f, 150, default, 1.2f);
|
|
}
|
|
if (Main.rand.NextBool(20) && Main.netMode != NetmodeID.Server)
|
|
{
|
|
Gore.NewGore(Projectile.GetSource_FromAI(), Projectile.position, new Vector2(Projectile.velocity.X * 0.2f, Projectile.velocity.Y * 0.2f), Main.rand.Next(16, 18), 1f);
|
|
}
|
|
}
|
|
if (Projectile.ai[0] == 1f)
|
|
CalamityUtils.HomeInOnNPC(Projectile, Projectile.tileCollide, 500f, 15f, 20f);
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), 180);
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor) => new Color(200, 100, 250, Projectile.alpha);
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
Projectile.DrawStarTrail(Color.Coral, Color.White);
|
|
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
Projectile.ExpandHitboxBy(50);
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1.2f);
|
|
Main.dust[idx].velocity *= 3f;
|
|
if (Main.rand.NextBool())
|
|
{
|
|
Main.dust[idx].scale = 0.5f;
|
|
Main.dust[idx].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
|
}
|
|
}
|
|
for (int i = 0; i < 5; i++)
|
|
{
|
|
int idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1.7f);
|
|
Main.dust[idx].noGravity = true;
|
|
Main.dust[idx].velocity *= 5f;
|
|
idx = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1f);
|
|
Main.dust[idx].velocity *= 2f;
|
|
}
|
|
if (Main.netMode != NetmodeID.Server)
|
|
{
|
|
for (int i = 0; i < 3; i++)
|
|
{
|
|
Gore.NewGore(Projectile.GetSource_Death(), Projectile.position, new Vector2(Projectile.velocity.X * 0.05f, Projectile.velocity.Y * 0.05f), Main.rand.Next(16, 18), 1f);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|