* Focusing the cursor on an enemy for 2.5 seconds curses them, upgrading VHex to a new debuff, True VHex * When inflicted on an enemy, True VHex deals 1998 damage per second and causes them to take 1.15x damage from all sources, 2.5x from Calamity itself * When inflicted on a player, True VHex deals 25 damage per second and causes them to take 1.15x damage from all sources, before defense and DR * VHex was given back its old sprite, the resprite is now used by True VHex * Also increased Miracle Blight's damage to enemies because it was smaller than VHex for whatever reason
80 lines
3.5 KiB
C#
80 lines
3.5 KiB
C#
using CalamityMod.Dusts;
|
|
using CalamityMod.NPCs;
|
|
using CalamityMod.Particles;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Buffs.DamageOverTime
|
|
{
|
|
public class TrueVulnerabilityHex : ModBuff
|
|
{
|
|
// The visual number displayed in ticks as the enemy takes damage.
|
|
public const int TickNumber = 666;
|
|
|
|
// The exact amount True Vulnerability Hex reduces NPC life regen by.
|
|
public const int DPS = TickNumber * 6; // -3996 life regen, 1998 DPS
|
|
|
|
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().trueVHex = true;
|
|
|
|
public override void Update(NPC npc, ref int buffIndex)
|
|
{
|
|
CalamityGlobalNPC cgn = npc.Calamity();
|
|
if (cgn.trueVulnerabilityHex < npc.buffTime[buffIndex])
|
|
{
|
|
cgn.trueVulnerabilityHex = 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.trueVulnerabilityHex;
|
|
}
|
|
|
|
// Apply immunity timer.
|
|
if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && cgn.debuffResistanceTimer <= 0)
|
|
cgn.debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + cgn.trueVulnerabilityHex;
|
|
|
|
// Destroy the vanilla buff, we don't use it.
|
|
npc.DelBuff(buffIndex);
|
|
buffIndex--;
|
|
}
|
|
|
|
internal static void DrawEffects(NPC npc, ref Color drawColor)
|
|
{
|
|
if (Main.rand.NextBool())
|
|
{
|
|
Vector2 position = new(npc.position.X + Main.rand.NextFloat(npc.width), npc.position.Y + Main.rand.NextFloat(npc.height));
|
|
VoidSparkParticle voidSpark = new(position, -Vector2.UnitY.RotatedByRandom(MathHelper.Pi / 10f) * Main.rand.NextFloat(10f, 18f), false, 20, Main.rand.NextFloat(0.02f, 0.05f), Main.rand.NextBool() ? Color.Black : Color.Lerp(Color.Red, Color.Magenta, 0.35f));
|
|
GeneralParticleHandler.SpawnParticle(voidSpark);
|
|
}
|
|
}
|
|
|
|
internal static void DrawEffects(PlayerDrawSet drawInfo)
|
|
{
|
|
Player Player = drawInfo.drawPlayer;
|
|
|
|
if (Main.rand.NextBool())
|
|
{
|
|
VoidSparkParticle spark2 = new VoidSparkParticle(Player.Calamity().RandomDebuffVisualSpot, -Vector2.UnitY * Main.rand.NextFloat(6f, 10f), false, Main.rand.Next(18, 27), Main.rand.NextFloat(0.015f, 0.045f), Main.rand.NextBool() ? Color.Black : Color.Lerp(Color.Red, Color.Magenta, 0.65f));
|
|
GeneralParticleHandler.SpawnParticle(spark2);
|
|
}
|
|
|
|
Dust dust = Dust.NewDustPerfect(Player.Calamity().RandomDebuffVisualSpot, Main.rand.NextBool() ? 261 : (int)CalamityDusts.Brimstone);
|
|
dust.scale = Main.rand.NextFloat(0.6f, 0.7f);
|
|
dust.velocity = -Vector2.UnitY.RotatedByRandom(MathHelper.PiOver4) * Main.rand.NextFloat(0.5f, 2.5f);
|
|
if (dust.type == 261)
|
|
dust.color = Color.Lerp(Color.Orange, Color.White, Main.rand.NextFloat());
|
|
|
|
}
|
|
}
|
|
}
|