Files
CalamityModPublic/Projectiles/Melee/CrescentMoonProj.cs
T

64 lines
2.1 KiB
C#

using Microsoft.Xna.Framework;
using CalamityMod.Buffs.DamageOverTime;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Melee
{
public class CrescentMoonProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override void SetStaticDefaults()
{
ProjectileID.Sets.TrailCacheLength[Projectile.type] = 6;
ProjectileID.Sets.TrailingMode[Projectile.type] = 0;
}
public override void SetDefaults()
{
Projectile.width = 50;
Projectile.height = 50;
Projectile.alpha = 100;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.MeleeNoSpeed;
Projectile.tileCollide = false;
Projectile.penetrate = 5;
Projectile.timeLeft = 180;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.extraUpdates = 1;
Projectile.aiStyle = ProjAIStyleID.Sickle;
AIType = ProjectileID.DeathSickle;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0f, 0f, 0.6f);
if (Projectile.soundDelay == 0)
{
Projectile.soundDelay = 30 + Main.rand.Next(50);
if (Main.rand.NextBool(10))
{
SoundEngine.PlaySound(SoundID.Item9, Projectile.position);
}
}
CalamityUtils.HomeInOnNPC(Projectile, true, 375f, 12f, 20f);
}
public override bool PreDraw(ref Color lightColor)
{
CalamityUtils.DrawAfterimagesCentered(Projectile, ProjectileID.Sets.TrailingMode[Projectile.type], lightColor, 1);
return false;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<Nightwither>(), 180);
}
}
}