Files
CalamityModPublic/Buffs/DamageOverTime/Vaporfied.cs
T
Xyk b3b9d095f6 Fixed debuff visual on player shenanigans
Moved all drawInfo.shadow == 0f from the debuff file to the player draw effects and made it consistent because some debuffs were missing this line (they still scale with framerate now, I cant fix that)
2023-09-30 12:46:01 -07:00

92 lines
3.0 KiB
C#

using CalamityMod.NPCs;
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
namespace CalamityMod.Buffs.DamageOverTime
{
public class Vaporfied : ModBuff
{
public override void SetStaticDefaults()
{
Main.debuff[Type] = true;
Main.pvpBuff[Type] = true;
Main.buffNoSave[Type] = true;
BuffID.Sets.LongerExpertDebuff[Type] = true;
}
public override void Update(Player player, ref int buffIndex)
{
player.Calamity().vaporfied = true;
}
public override void Update(NPC npc, ref int buffIndex)
{
if (npc.Calamity().vaporfied < npc.buffTime[buffIndex])
npc.Calamity().vaporfied = npc.buffTime[buffIndex];
if ((CalamityLists.enemyImmunityList.Contains(npc.type) || npc.boss) && npc.Calamity().debuffResistanceTimer <= 0)
npc.Calamity().debuffResistanceTimer = CalamityGlobalNPC.slowingDebuffResistanceMin + npc.Calamity().vaporfied;
npc.DelBuff(buffIndex);
buffIndex--;
}
internal static void DrawEffects(PlayerDrawSet drawInfo)
{
Player Player = drawInfo.drawPlayer;
int dustType = Utils.SelectRandom(Main.rand, new int[]
{
246,
242,
229,
226,
247,
187,
234
});
if (Main.rand.NextBool(4))
{
int dust = Dust.NewDust(drawInfo.Position - new Vector2(2f), Player.width + 4, Player.height + 4, dustType, Player.velocity.X * 0.4f, Player.velocity.Y * 0.4f, 100, default, 3f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 1.8f;
Main.dust[dust].velocity.Y -= 0.5f;
if (Main.rand.NextBool(4))
{
Main.dust[dust].noGravity = false;
Main.dust[dust].scale *= 0.5f;
}
drawInfo.DustCache.Add(dust);
}
}
internal static void DrawEffects(NPC npc, ref Color drawColor)
{
int dustType = Utils.SelectRandom(Main.rand, new int[]
{
246,
242,
229,
226,
247,
187,
234
});
if (Main.rand.Next(5) < 4)
{
int dust = Dust.NewDust(npc.position - new Vector2(2f, 2f), npc.width + 4, npc.height + 4, dustType, npc.velocity.X * 0.4f, npc.velocity.Y * 0.4f, 100, default, 3f);
Main.dust[dust].noGravity = true;
Main.dust[dust].velocity *= 1.8f;
Main.dust[dust].velocity.Y -= 0.5f;
if (Main.rand.NextBool(4))
{
Main.dust[dust].noGravity = false;
Main.dust[dust].scale *= 0.5f;
}
}
}
}
}