33 lines
1.2 KiB
C#
33 lines
1.2 KiB
C#
using CalamityMod.NPCs;
|
|
using Terraria;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Buffs.DamageOverTime
|
|
{
|
|
public class VulnerabilityHex : ModBuff
|
|
{
|
|
public override void SetDefaults()
|
|
{
|
|
DisplayName.SetDefault("Vulnerability Hex");
|
|
Description.SetDefault("You are weak");
|
|
Main.debuff[Type] = true;
|
|
Main.pvpBuff[Type] = true;
|
|
Main.buffNoSave[Type] = true;
|
|
longerExpertDebuff = false;
|
|
canBeCleared = false;
|
|
}
|
|
|
|
public override void Update(Player player, ref int buffIndex) => player.Calamity().vHex = true;
|
|
|
|
public override void Update(NPC npc, ref int buffIndex)
|
|
{
|
|
if (npc.Calamity().vulnerabilityHex < npc.buffTime[buffIndex])
|
|
npc.Calamity().vulnerabilityHex = npc.buffTime[buffIndex];
|
|
if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0)
|
|
npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().vulnerabilityHex;
|
|
npc.DelBuff(buffIndex);
|
|
buffIndex--;
|
|
}
|
|
}
|
|
}
|