Files
CalamityModPublic/Projectiles/Melee/CrescentMoonProj.cs
T

67 lines
2.2 KiB
C#

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using CalamityMod.Buffs.DamageOverTime;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
using Terraria.Audio;
namespace CalamityMod.Projectiles.Melee
{
public class CrescentMoonProj : ModProjectile
{
public override string Texture => "CalamityMod/Projectiles/Magic/Crescent";
public override void SetStaticDefaults()
{
DisplayName.SetDefault("Crescent Moon");
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.Melee;
Projectile.tileCollide = false;
Projectile.penetrate = 5;
Projectile.timeLeft = 180;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
Projectile.extraUpdates = 1;
Projectile.aiStyle = 18;
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, (int)Projectile.position.X, (int)Projectile.position.Y);
}
}
CalamityGlobalProjectile.HomeInOnNPC(Projectile, true, 250f, 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, int damage, float knockback, bool crit)
{
target.AddBuff(ModContent.BuffType<Nightwither>(), 180);
}
}
}