Files
CalamityModPublic/Buffs/DamageOverTime/VulnerabilityHex.cs
T
tomat 67bceff6e7 Initial dotnet format pass.
This commit formats the entire codebase according to `dotnet format` and its limited understanding of our provided `.editorconfig`.
2024-02-28 21:49:50 -08:00

51 lines
1.9 KiB
C#

using CalamityMod.NPCs;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.DamageOverTime
{
public class VulnerabilityHex : ModBuff
{
// This is the visual number displayed in ticks as the enemy takes damage from this debuff.
public const int TickNumber = 666;
// This is the exact DPS dealt by Vulnerability Hex to NPCs.
public const int DPS = TickNumber * 4; // 2664 DPS
public const int CalamityDuration = 24;
public const int AflameDuration = 120;
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
BuffID.Sets.NurseCannotRemoveDebuff[Type] = true;
BuffID.Sets.LongerExpertDebuff[Type] = true;
}
public override void Update(Player player, ref int buffIndex) => player.Calamity().vHex = true;
public override void Update(NPC npc, ref int buffIndex)
{
CalamityGlobalNPC cgn = npc.Calamity();
if (cgn.vulnerabilityHex < npc.buffTime[buffIndex])
{
cgn.vulnerabilityHex = npc.buffTime[buffIndex];
// Set the remaining time of the fire drawer to be exactly right.
if (cgn.VulnerabilityHexFireDrawer != null)
cgn.VulnerabilityHexFireDrawer.SetLifetime = cgn.VulnerabilityHexFireDrawer.LocalTimer + cgn.vulnerabilityHex;
}
// Apply immunity timer.
if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0)
cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + cgn.vulnerabilityHex;
// Destroy the vanilla buff, we don't use it.
npc.DelBuff(buffIndex);
buffIndex--;
}
}
}