Files
CalamityModPublic/Projectiles/Magic/AstralachneaFang.cs
T

65 lines
2.6 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Dusts;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class AstralachneaFang : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public override void SetStaticDefaults()
{
ProjectileID.Sets.CultistIsResistantTo[Type] = true;
ProjectileID.Sets.TrailCacheLength[Type] = 5;
ProjectileID.Sets.TrailingMode[Type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 14;
Projectile.height = 14;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.DamageType = DamageClass.Magic;
Projectile.timeLeft = 240;
}
public override void AI()
{
int astral = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, ModContent.DustType<AstralOrange>(), 0f, 0f, 100, default, 1f);
Main.dust[astral].noGravity = true;
Projectile.rotation = Projectile.velocity.ToRotation();
CalamityUtils.HomeInOnNPC(Projectile, !Projectile.tileCollide, 150f, 12f, 25f);
}
public override void OnKill(int timeLeft)
{
SoundEngine.PlaySound(SoundID.Item10, Projectile.Center);
for (int k = 0; k < 3; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType<AstralOrange>(), 0f, 0f);
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, ModContent.DustType<AstralBlue>(), 0f, 0f);
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
//Doze - I gave this long debuff infliction times due to the lack of weapons that inflict debuffs for a decent time
//Most common vanilla debuffs have a way to inflict them for 15, 20, or even 30 seconds
//Poison and Venom staff in vanilla do 30 seconds, so this should too as it's a spiritual successor to them.
target.AddBuff(ModContent.BuffType<AstralInfectionDebuff>(), CalamityUtils.SecondsToFrames(30));
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Type], lightColor, 1);
return false;
}
}
}