96 lines
3.6 KiB
C#
96 lines
3.6 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
namespace CalamityMod.Projectiles.Rogue
|
|
{
|
|
public class GodsParanoiaDart : ModProjectile, ILocalizedModType
|
|
{
|
|
public new string LocalizationCategory => "Projectiles.Rogue";
|
|
public override void SetStaticDefaults()
|
|
{
|
|
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6;
|
|
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
Projectile.width = 10;
|
|
Projectile.height = 10;
|
|
Projectile.ignoreWater = true;
|
|
Projectile.friendly = true;
|
|
Projectile.DamageType = RogueDamageClass.Instance;
|
|
Projectile.penetrate = 1;
|
|
Projectile.tileCollide = false;
|
|
Projectile.timeLeft = 600;
|
|
Projectile.aiStyle = ProjAIStyleID.Beam;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
Projectile.spriteDirection = Projectile.direction = (Projectile.velocity.X > 0).ToDirectionInt();
|
|
Projectile.rotation = Projectile.velocity.ToRotation() + (MathHelper.Pi / 2);
|
|
|
|
Projectile.velocity.X *= 1.025f;
|
|
Projectile.velocity.Y *= 1.025f;
|
|
if (Projectile.velocity.X > 12f)
|
|
{
|
|
Projectile.velocity.X = 12f;
|
|
}
|
|
if (Projectile.velocity.Y > 12f)
|
|
{
|
|
Projectile.velocity.Y = 12f;
|
|
}
|
|
|
|
if (Main.rand.NextBool(3))
|
|
{
|
|
Dust flame = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 0, default, 1f);
|
|
flame.velocity *= 0.1f;
|
|
flame.scale = 1.3f;
|
|
flame.noGravity = true;
|
|
}
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
Projectile.position = Projectile.Center;
|
|
Projectile.width = Projectile.height = 192;
|
|
Projectile.position.X = Projectile.position.X - (float)(Projectile.width / 2);
|
|
Projectile.position.Y = Projectile.position.Y - (float)(Projectile.height / 2);
|
|
Projectile.maxPenetrate = -1;
|
|
Projectile.penetrate = -1;
|
|
Projectile.usesLocalNPCImmunity = true;
|
|
Projectile.localNPCHitCooldown = -1;
|
|
Projectile.damage /= 2;
|
|
Projectile.Damage();
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
Dust flame = Dust.NewDustDirect(Projectile.position, Projectile.width, Projectile.height, Main.rand.NextBool(3) ? 56 : 242, 0f, 0f, 100, default, 2f);
|
|
flame.velocity *= 3f;
|
|
if (Main.rand.NextBool(2))
|
|
flame.scale = 0.5f;
|
|
|
|
if (Main.rand.NextBool(2))
|
|
{
|
|
flame.scale *= 0.5f;
|
|
flame.fadeIn = Main.rand.NextFloat(1f, 2f);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) => target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 120);
|
|
|
|
public override void OnHitPlayer(Player target, Player.HurtInfo info) => target.AddBuff(ModContent.BuffType<GodSlayerInferno>(), 120);
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|