81 lines
2.7 KiB
C#
81 lines
2.7 KiB
C#
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Dusts;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using Terraria;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Summon
|
|
{
|
|
public class BrimstoneDartSummon : ModProjectile
|
|
{
|
|
public override string Texture => "CalamityMod/Projectiles/Boss/BrimstoneBarrage";
|
|
public override void SetStaticDefaults()
|
|
{
|
|
DisplayName.SetDefault("Brimstone Dart");
|
|
Main.projFrames[projectile.type] = 4;
|
|
ProjectileID.Sets.MinionShot[projectile.type] = true;
|
|
ProjectileID.Sets.TrailCacheLength[projectile.type] = 2;
|
|
ProjectileID.Sets.TrailingMode[projectile.type] = 0;
|
|
}
|
|
|
|
public override void SetDefaults()
|
|
{
|
|
projectile.width = projectile.height = 24;
|
|
projectile.friendly = true;
|
|
projectile.ignoreWater = true;
|
|
projectile.tileCollide = false;
|
|
projectile.minion = true;
|
|
projectile.minionSlots = 0f;
|
|
projectile.penetrate = 1;
|
|
projectile.timeLeft = 120;
|
|
projectile.usesLocalNPCImmunity = true;
|
|
projectile.localNPCHitCooldown = 8;
|
|
}
|
|
|
|
public override void AI()
|
|
{
|
|
if (projectile.velocity.Length() < 21f)
|
|
projectile.velocity *= 1.02f;
|
|
|
|
projectile.rotation = projectile.velocity.ToRotation() + MathHelper.PiOver2;
|
|
|
|
projectile.frameCounter++;
|
|
if (projectile.frameCounter % 5 == 4)
|
|
projectile.frame = (projectile.frame + 1) % Main.projFrames[projectile.type];
|
|
|
|
projectile.Opacity = Utils.InverseLerp(0f, 40f, projectile.timeLeft, true);
|
|
|
|
Lighting.AddLight(projectile.Center, 0.75f, 0f, 0f);
|
|
}
|
|
|
|
public override void OnHitNPC(NPC target, int damage, float knockback, bool crit)
|
|
{
|
|
target.AddBuff(ModContent.BuffType<BrimstoneFlames>(), 180);
|
|
}
|
|
|
|
public override void Kill(int timeLeft)
|
|
{
|
|
if (Main.dedServ)
|
|
return;
|
|
|
|
for (int i = 0; i < 15; i++)
|
|
{
|
|
Dust brimstone = Dust.NewDustPerfect(projectile.Center, 267);
|
|
brimstone.velocity = projectile.velocity.RotatedByRandom(0.26f) * Main.rand.NextFloat(0.3f, 0.8f);
|
|
brimstone.scale = Main.rand.NextFloat(1.5f, 1.85f);
|
|
brimstone.color = Color.DarkRed;
|
|
brimstone.noGravity = true;
|
|
}
|
|
}
|
|
|
|
public override bool PreDraw(SpriteBatch spriteBatch, Color lightColor)
|
|
{
|
|
lightColor.R = (byte)(255 * projectile.Opacity);
|
|
CalamityUtils.DrawAfterimagesCentered(projectile, ProjectileID.Sets.TrailingMode[projectile.type], lightColor, 1);
|
|
return false;
|
|
}
|
|
}
|
|
}
|