Files
CalamityModPublic/Projectiles/Ranged/NorfleetExplosion.cs
T
2024-05-11 02:09:28 -07:00

59 lines
2.0 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.Audio;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Ranged
{
public class NorfleetExplosion : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Ranged";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public override void SetDefaults()
{
Projectile.width = 500;
Projectile.height = 500;
Projectile.friendly = true;
Projectile.ignoreWater = false;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 2;
Projectile.DamageType = DamageClass.Ranged;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = -1;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.ai[1] == 0)
target.AddBuff(BuffID.Daybreak, 300);
if (Projectile.ai[1] == 1)
target.AddBuff(BuffID.Electrified, 300);
if (Projectile.ai[1] == 2)
target.AddBuff(ModContent.BuffType<Plague>(), 300);
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.8f);
if (Projectile.damage < 1)
Projectile.damage = 1;
}
public override void AI()
{
if (Projectile.ai[2] == 1)
{
Projectile.friendly = false;
Projectile.hostile = true;
}
}
public override bool PreDraw(ref Color lightColor)
{
return false;
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, 400, targetHitbox);
}
}