79 lines
4.0 KiB
C#
79 lines
4.0 KiB
C#
using System;
|
|
using CalamityMod.Dusts;
|
|
using CalamityMod.Particles;
|
|
using CalamityMod.Projectiles.Pets;
|
|
using Microsoft.Xna.Framework;
|
|
using Terraria;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Buffs.DamageOverTime
|
|
{
|
|
public class DemonicFlames : 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().demonicFlames = true;
|
|
}
|
|
|
|
public override void Update(NPC npc, ref int buffIndex)
|
|
{
|
|
if (npc.Calamity().demonicFlames < npc.buffTime[buffIndex])
|
|
npc.Calamity().demonicFlames = npc.buffTime[buffIndex];
|
|
npc.DelBuff(buffIndex);
|
|
buffIndex--;
|
|
}
|
|
|
|
internal static void DrawEffects(PlayerDrawSet drawInfo, bool hasDebuffResistance = false)
|
|
{
|
|
Player Player = drawInfo.drawPlayer;
|
|
|
|
if (Main.rand.NextBool())
|
|
{
|
|
Dust dust = Dust.NewDustDirect(Player.position, Player.width, Player.height, ModContent.DustType<LightDust>());
|
|
dust.noGravity = true;
|
|
dust.velocity = new Vector2(0, Main.rand.NextFloat(-4f, -8f)).RotatedByRandom(0.3f) + Player.velocity;
|
|
dust.scale = Main.rand.NextFloat(0.8f, 1.2f);
|
|
dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet;
|
|
dust.noLightEmittence = true;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
Vector2 sparkVel = new Vector2(Main.rand.NextFloat(-6f, 6f), Main.rand.NextFloat(-1f, -3f));
|
|
Particle sparks = new VelChangingSpark(Player.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), Player.height / 2), sparkVel + Player.velocity, new Vector2(-sparkVel.X * 0.5f, sparkVel.Y * 2) * 3.5f, "CalamityMod/Particles/SmallBloom", Main.rand.Next(13, 20 + 1), Main.rand.NextFloat(0.1f, 0.25f) * 0.5f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.75f, new Vector2(0.7f, 1), true, false, 0, false, 0.45f, 0.055f);
|
|
GeneralParticleHandler.SpawnParticle(sparks);
|
|
}
|
|
}
|
|
Lighting.AddLight(Player.Center, Color.MediumOrchid.ToVector3());
|
|
}
|
|
|
|
internal static void DrawEffects(NPC npc, ref Color drawColor)
|
|
{
|
|
if (Main.rand.NextBool(3))
|
|
{
|
|
Dust dust = Dust.NewDustDirect(npc.position, npc.width, npc.height, ModContent.DustType<LightDust>());
|
|
dust.noGravity = true;
|
|
dust.velocity = new Vector2(0, Main.rand.NextFloat(-4f, -8f)).RotatedByRandom(0.3f) + npc.velocity;
|
|
dust.scale = Main.rand.NextFloat(0.8f, 1.2f);
|
|
dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet;
|
|
dust.noLightEmittence = true;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
Vector2 sparkVel = new Vector2(Main.rand.NextFloat(-npc.width / 6, npc.width / 6), Main.rand.NextFloat(-npc.height / 20, -npc.height / 17));
|
|
Particle sparks = new VelChangingSpark(npc.Center + new Vector2(Main.rand.NextFloat(-10f, 10f), npc.height / 2) + sparkVel * 0.5f, sparkVel + npc.velocity, new Vector2(-sparkVel.X * 0.5f, sparkVel.Y * 2) * 3.5f, "CalamityMod/Particles/SmallBloom", Main.rand.Next(13, 20 + 1), Main.rand.NextFloat(0.1f, 0.25f) * MathHelper.Lerp(Math.Max(npc.height, npc.width) / 120, 0.5f, 0.7f), (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.75f, new Vector2(0.7f, 1), true, false, 0, false, 0.3f, 0.055f);
|
|
GeneralParticleHandler.SpawnParticle(sparks);
|
|
}
|
|
}
|
|
Lighting.AddLight(npc.Center, Color.MediumOrchid.ToVector3());
|
|
}
|
|
}
|
|
}
|