Files
CalamityModPublic/Projectiles/Melee/SandFire.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

59 lines
2.0 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class SandFire : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetStaticDefaults() => ProjectileID.Sets.CultistIsResistantTo[Type] = true;
public override void SetDefaults()
{
Projectile.width = 6;
Projectile.height = 6;
Projectile.friendly = true;
Projectile.penetrate = 1;
Projectile.extraUpdates = 2;
Projectile.tileCollide = false;
Projectile.DamageType = DamageClass.Melee;
Projectile.timeLeft = 200;
}
public override void AI()
{
Lighting.AddLight(Projectile.Center, 0.25f, 0.25f, 0f);
Projectile.localAI[0] += 1f;
if (Projectile.localAI[0] > 4f)
{
for (int i = 0; i < 5; i++)
{
int shiny = Dust.NewDust(Projectile.position, Projectile.width, Projectile.height, DustID.Teleporter, 0f, 0f, 100, default, 0.5f);
Main.dust[shiny].noGravity = true;
Main.dust[shiny].velocity *= 0f;
}
}
CalamityUtils.HomeInOnNPC(Projectile, true, 2000f, 10f, 20f);
}
public override void OnKill(int timeLeft)
{
for (int k = 0; k < 5; k++)
{
Dust.NewDust(Projectile.position + Projectile.velocity, Projectile.width, Projectile.height, DustID.Teleporter, Projectile.oldVelocity.X * 0.5f, Projectile.oldVelocity.Y * 0.5f);
}
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(BuffID.Daybreak, 120);
}
}
}