Files
CalamityModPublic/Projectiles/Melee/StarnightBeam.cs
T
mountaindrew10 02ee97774c 1 - Fixed a lot of weird spear visual issues.
2 - Changed Elemental Lance a lot.
3 - Removed Iridescent Excalibur healing because it was buggy (I'll add it again later for the true melee projectile).
2024-03-22 02:53:53 -05:00

73 lines
2.7 KiB
C#

using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class StarnightBeam : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 4;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 16;
Projectile.height = 16;
Projectile.aiStyle = ProjAIStyleID.Beam;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Melee;
Projectile.penetrate = 3;
Projectile.timeLeft = 600;
AIType = ProjectileID.LightBeam;
Projectile.usesIDStaticNPCImmunity = true;
Projectile.idStaticNPCHitCooldown = 10;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0.4f, 0f, 0.4f);
}
public override Color? GetAlpha(Color lightColor)
{
return new Color(byte.MaxValue, 50, 128, Projectile.alpha);
}
public override bool PreDraw(ref Color lightColor)
{
if (Projectile.timeLeft > 595)
return false;
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item10, Projectile.position);
for (int i = 4; i < 31; i++)
{
float projOldX = Projectile.oldVelocity.X * (30f / (float)i);
float projOldY = Projectile.oldVelocity.Y * (30f / (float)i);
int starnight = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.8f);
Dust dust = Main.dust[starnight];
dust.noGravity = true;
dust.velocity *= 0.1f;
starnight = Dust.NewDust(new Vector2(Projectile.oldPosition.X - projOldX, Projectile.oldPosition.Y - projOldY), 8, 8, DustID.PinkFairy, Projectile.oldVelocity.X, Projectile.oldVelocity.Y, 100, default, 1.4f);
dust.velocity *= 0.01f;
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.Frostburn2, 120);
}
}
}