Files
CalamityModPublic/Projectiles/Magic/PrimordialEarthExplosion.cs
T
2024-05-08 15:39:32 -07:00

43 lines
1.7 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using CalamityMod.Buffs.StatDebuffs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Magic
{
public class PrimordialEarthExplosion : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Magic";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public Player Owner => Main.player[Projectile.owner];
private float ExplosionRadius = 200f;
public override void SetDefaults()
{
//These shouldn't matter because its circular
Projectile.width = 200;
Projectile.height = 200;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.Magic;
Projectile.ignoreWater = true;
Projectile.tileCollide = false;
Projectile.penetrate = -1;
Projectile.timeLeft = 2;
Projectile.usesLocalNPCImmunity = true;
Projectile.localNPCHitCooldown = 10;
}
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
{
if (Projectile.numHits > 0)
Projectile.damage = (int)(Projectile.damage * 0.9f);
if (Projectile.damage < 1)
Projectile.damage = 1;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
target.AddBuff(ModContent.BuffType<ArmorCrunch>(), 180);
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox);
}
}