88 lines
3.6 KiB
C#
88 lines
3.6 KiB
C#
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Rogue
|
|
{
|
|
public class MalachiteProj : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Rogue";
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 10;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 12;
|
|
Projectile.height = 12;
|
|
Projectile.alpha = 255;
|
|
Projectile.friendly = true;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.penetrate = 3;
|
|
Projectile.alpha = 255;
|
|
Projectile.extraUpdates = 3;
|
|
Projectile.aiStyle = ProjAIStyleID.Nail;
|
|
AIType = ProjectileID.NailFriendly;
|
|
Projectile.usesLocalNPCImmunity = true;
|
|
Projectile.localNPCHitCooldown = 1;
|
|
Projectile.DamageType = RogueDamageClass.Instance;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Projectile.alpha -= 3;
|
|
if (Projectile.alpha < 30)
|
|
{
|
|
Projectile.alpha = 30;
|
|
}
|
|
Projectile.localAI[1] += 1f;
|
|
if (Projectile.localAI[1] > 4f)
|
|
{
|
|
for (int num468 = 0; num468 < 3; num468++)
|
|
{
|
|
int num469 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 0.75f);
|
|
Main.dust[num469].noGravity = true;
|
|
Main.dust[num469].velocity *= 0f;
|
|
}
|
|
}
|
|
}
|
|
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
|
|
public override Color? GetAlpha(Color lightColor) => new Color(Main.DiscoR, 203, 103, Projectile.alpha);
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
Projectile.position = Projectile.Center;
|
|
Projectile.width = Projectile.height = 48;
|
|
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
|
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
|
for (int num621 = 0; num621 < 7; num621++)
|
|
{
|
|
int num622 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.2f);
|
|
Main.dust[num622].velocity *= 3f;
|
|
if (Main.rand.NextBool(2))
|
|
{
|
|
Main.dust[num622].scale = 0.5f;
|
|
Main.dust[num622].fadeIn = 1f + (float)Main.rand.Next(10) * 0.1f;
|
|
}
|
|
}
|
|
for (int num623 = 0; num623 < 15; num623++)
|
|
{
|
|
int num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1.7f);
|
|
Main.dust[num624].noGravity = true;
|
|
Main.dust[num624].velocity *= 5f;
|
|
num624 = Dust.NewDust(new Vector2(Projectile.position.X, Projectile.position.Y), Projectile.width, Projectile.height, 107, 0f, 0f, 100, new Color(Main.DiscoR, 203, 103), 1f);
|
|
Main.dust[num624].velocity *= 2f;
|
|
}
|
|
}
|
|
}
|
|
}
|