56 lines
1.8 KiB
C#
56 lines
1.8 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace ForgottenWawiTech.Content.Projectiles.FragmentedPrism
|
|
{
|
|
public class FragmentedPrismBeam : ModProjectile
|
|
{
|
|
public override string Texture => "Terraria/Images/Projectile_440";
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 18;
|
|
Projectile.height = 18;
|
|
Projectile.friendly = true;
|
|
Projectile.DamageType = DamageClass.Magic;
|
|
Projectile.penetrate = -1;
|
|
Projectile.tileCollide = false;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.extraUpdates = 12;
|
|
Projectile.timeLeft = 26;
|
|
Projectile.usesLocalNPCImmunity = true;
|
|
Projectile.localNPCHitCooldown = 8;
|
|
Projectile.light = 0.55f;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (Projectile.velocity.LengthSquared() < 0.001f)
|
|
{
|
|
Projectile.Kill();
|
|
return;
|
|
}
|
|
|
|
Projectile.rotation = Projectile.velocity.ToRotation();
|
|
|
|
float progress = 1f - Projectile.timeLeft / 26f;
|
|
Projectile.scale = MathHelper.Lerp(0.85f, 1.35f, progress);
|
|
Lighting.AddLight(Projectile.Center, 0.2f, 0.35f, 0.55f);
|
|
|
|
if (Main.rand.NextBool(3))
|
|
{
|
|
Vector2 dustPos = Projectile.Center - Projectile.velocity * Main.rand.NextFloat(0.2f, 0.6f);
|
|
Dust dust = Dust.NewDustPerfect(dustPos, DustID.DungeonSpirit, Projectile.velocity * -0.15f, 150, default, 1.05f);
|
|
dust.noGravity = true;
|
|
}
|
|
}
|
|
|
|
public override bool? CanHitNPC(NPC target)
|
|
{
|
|
return base.CanHitNPC(target);
|
|
}
|
|
}
|
|
}
|