Files
CalamityModPublic/Projectiles/Melee/StellarContemptBlast.cs
T
2025-03-04 10:13:35 -08:00

48 lines
2.0 KiB
C#

using CalamityMod.Buffs.DamageOverTime;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ModLoader;
namespace CalamityMod.Projectiles.Melee
{
public class StellarContemptBlast : ModProjectile, ILocalizedModType
{
public new string LocalizationCategory => "Projectiles.Melee";
public override string Texture => "CalamityMod/Projectiles/InvisibleProj";
public Player Owner => Main.player[Projectile.owner];
private static float ExplosionRadius = 336f;
public override void SetDefaults()
{
//These shouldn't matter because its circular
Projectile.width = 336;
Projectile.height = 336;
Projectile.friendly = true;
Projectile.DamageType = DamageClass.MeleeNoSpeed;
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)
{
target.AddBuff(ModContent.BuffType<Nightwither>(), 240);
float minMult = 0.15f;
int hitsToMinMult = 12;
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
modifiers.SourceDamage *= damageMult;
}
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
{
// If you are hitting an armored target or kill a target, don't reduce damage based on enemy hits
if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0)
{
Projectile.numHits -= 1;
}
}
public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => CalamityUtils.CircularHitboxCollision(Projectile.Center, ExplosionRadius, targetHitbox);
}
}