63 lines
2.3 KiB
C#
63 lines
2.3 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Melee
|
|
{
|
|
public class EntropicFlechette : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Melee";
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 1;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 12;
|
|
Projectile.height = 12;
|
|
Projectile.friendly = true;
|
|
Projectile.penetrate = 1;
|
|
Projectile.DamageType = DamageClass.Melee;
|
|
Projectile.timeLeft = 600;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Projectile.rotation = Projectile.velocity.ToRotation();
|
|
Vector2 value7 = new Vector2(6f, 12f);
|
|
Projectile.localAI[0] += 1f;
|
|
if (Projectile.localAI[0] == 48f)
|
|
{
|
|
Projectile.localAI[0] = 0f;
|
|
}
|
|
else
|
|
{
|
|
for (int num41 = 0; num41 < 2; num41++)
|
|
{
|
|
Vector2 value8 = -Vector2.UnitY.RotatedBy((double)(Projectile.localAI[0] * 0.1308997f + (float)num41 * 3.14159274f), default) * value7;
|
|
int num42 = Dust.NewDust(Projectile.Center, 0, 0, 27, 0f, 0f, 160, default, 1f);
|
|
Main.dust[num42].scale = 1f;
|
|
Main.dust[num42].noGravity = true;
|
|
Main.dust[num42].position = Projectile.Center + value8;
|
|
Main.dust[num42].velocity = Projectile.velocity;
|
|
}
|
|
}
|
|
|
|
int num458 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 27, 0f, 0f, 100, default, 0.8f);
|
|
Main.dust[num458].noGravity = true;
|
|
Main.dust[num458].velocity *= 0f;
|
|
|
|
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 200f, 12f, 20f);
|
|
}
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 2);
|
|
return false;
|
|
}
|
|
}
|
|
}
|