Files
CalamityModPublic/Projectiles/Melee/CrescentMoonProj.cs
T
CongratsIsTrash e0e167346e Added ProjectileID.Sets.CultistIsResistantTo on every homing projectile in Calamity
This does nothing for Calamity since we disable Cultist's homing resist.
However, since this is effectively used as a homing projectile set, this will help with crossmod compatibility.
I ask that everyone else who changes homing projectiles in any way to help maintain this.
2024-09-09 23:52:07 -04:00

65 lines
2.1 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class CrescentMoonProj : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override void SetStaticDefaults()
{
ProjectileID.Sets.CultistIsResistantTo[Type] = true;
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 = -1;
Projectile.timeLeft = 140;
Projectile.ignoreWater = true;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 20;
Projectile.extraUpdates = 2;
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<Voidfrost>(), 180);
}
}
}