443 lines
25 KiB
C#
443 lines
25 KiB
C#
using System;
|
|
using CalamityMod.Buffs.DamageOverTime;
|
|
using CalamityMod.Cooldowns;
|
|
using CalamityMod.Dusts;
|
|
using CalamityMod.Items.Weapons.Melee;
|
|
using CalamityMod.NPCs;
|
|
using CalamityMod.Packets.Entities;
|
|
using CalamityMod.Particles;
|
|
using CalamityMod.Projectiles.BaseProjectiles;
|
|
using CalamityMod.Projectiles.Typeless;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
using ReLogic.Content;
|
|
using ReLogic.Utilities;
|
|
using Terraria;
|
|
using Terraria.Audio;
|
|
using Terraria.DataStructures;
|
|
using Terraria.ID;
|
|
using Terraria.Localization;
|
|
using Terraria.ModLoader;
|
|
|
|
namespace CalamityMod.Projectiles.Melee
|
|
{
|
|
[PierceResistException]
|
|
public class DevilsDevastationHoldout : BaseCustomUseStyleProjectile, ILocalizedModType
|
|
{
|
|
public override int AssignedItemID => ModContent.ItemType<DevilsDevastation>();
|
|
|
|
public override LocalizedText DisplayName => CalamityUtils.GetItemName<DevilsDevastation>();
|
|
public override string Texture => "CalamityMod/Items/Weapons/Melee/DevilsDevastation";
|
|
public float hitboxMult = 1.3f;
|
|
public Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.5f);
|
|
public SlotId SoundSlot;
|
|
public override float HitboxOutset => 335;
|
|
|
|
public override Vector2 HitboxSize => new Vector2(395, 395) * hitboxMult;
|
|
public override float HitboxRotationOffset => MathHelper.ToRadians(-45);
|
|
|
|
public override Vector2 SpriteOrigin => new(-3, 118);
|
|
public Vector2 mousePos;
|
|
public Vector2 aimVel;
|
|
public bool doSwing = true;
|
|
public bool postSwing = false;
|
|
public float fadeIn = 0;
|
|
public int useAnim;
|
|
public int swingCount;
|
|
public bool finalFlip = false;
|
|
public bool playSwingSound = true;
|
|
public bool holding = true;
|
|
public int postSwingCooldown = 0;
|
|
public bool willDie = false;
|
|
public bool hasLaunchedBlades = false;
|
|
public bool swooshFade = false;
|
|
|
|
public NPC lastHitTarget = null;
|
|
public int postSwingCooldownMax => (int)(useAnim * 0.65f);
|
|
public override void SetDefaults()
|
|
{
|
|
base.SetDefaults();
|
|
Projectile.usesLocalNPCImmunity = true;
|
|
Projectile.localNPCHitCooldown = -1;
|
|
Projectile.DamageType = TrueMeleeDamageClass.Instance;
|
|
}
|
|
public override void OnSpawn(IEntitySource source)
|
|
{
|
|
base.OnSpawn(source);
|
|
// This is needed because EntitySource_ItemUse always sets Projectile.originalDamage to the item's damage,
|
|
// regardless of the value passed into the damage argument of NewProjectile.
|
|
// This results in continuous updating damage resetting the damage.
|
|
Projectile.originalDamage *= 15;
|
|
}
|
|
public override void WhenSpawned()
|
|
{
|
|
IgnoreActiveAnimation = true;
|
|
DrawUnconditionally = true;
|
|
CanHit = false;
|
|
Projectile.knockBack = 0;
|
|
Projectile.scale = 1.15f;
|
|
Projectile.ai[1] = -1;
|
|
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
|
|
mousePos = Owner.Calamity().mouseWorld;
|
|
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
|
|
useAnim = (int)(Owner.HeldItem.useAnimation / Owner.GetTotalAttackSpeed<MeleeDamageClass>());
|
|
postSwingCooldown = postSwingCooldownMax / 2;
|
|
|
|
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
|
|
else Owner.direction = 1;
|
|
|
|
FlipAsSword = Owner.direction == -1 ? true : false;
|
|
}
|
|
public override void OnKill(int timeLeft)
|
|
{
|
|
Owner.Calamity().demonSwordKillMode = false;
|
|
if (lastHitTarget != null && lastHitTarget.life > 0 && lastHitTarget.active && Owner.HeldItem.type == AssignedItemID && Main.myPlayer == Projectile.owner)
|
|
{
|
|
Owner.SetScreenshake(12.5f);
|
|
Particle blastRing = new CustomPulse(lastHitTarget.Center, Vector2.Zero, clr, "CalamityMod/Particles/HighResHollowCircleHardEdge", Vector2.One, Main.rand.NextFloat(-10, 10), 0.05f, 0.6f, 20, true);
|
|
GeneralParticleHandler.SpawnParticle(blastRing);
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
Vector2 vel = (MathHelper.TwoPi * i / 4f).ToRotationVector2() * 2;
|
|
Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, vel.RotatedBy(MathHelper.ToRadians(45)), ModContent.ProjectileType<DevilsStrike>(), 0, 0f, Owner.whoAmI, 1, 0);
|
|
}
|
|
Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, Vector2.Zero, ModContent.ProjectileType<DirectStrike>(), (int)(Projectile.damage * 1.5f), 0f, Owner.whoAmI, lastHitTarget.whoAmI, 0);
|
|
strike.DamageType = DamageClass.Melee;
|
|
SoundStyle dieSound = new("CalamityMod/Sounds/Item/LanceofDestinyStrong");
|
|
SoundEngine.PlaySound(dieSound with { Volume = 0.9f, Pitch = 0.3f }, lastHitTarget.Center);
|
|
|
|
int bonusDamage = 4000;
|
|
if (lastHitTarget.Calamity().demonicFlamesBonusDamage <= bonusDamage)
|
|
{
|
|
lastHitTarget.Calamity().demonicFlamesBonusDamage = bonusDamage;
|
|
lastHitTarget.AddBuff(ModContent.BuffType<DemonicFlames>(), 210);
|
|
// I'm like 95% confident this shouldn't need a sync since OnKill is called on all clients
|
|
}
|
|
}
|
|
}
|
|
public override void UseStyle()
|
|
{
|
|
bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD);
|
|
|
|
if (SoundEngine.TryGetActiveSound(SoundSlot, out var Sound) && Sound.IsPlaying && lastHitTarget != null)
|
|
Sound.Position = lastHitTarget.Center;
|
|
|
|
if ((Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0)
|
|
{
|
|
Animation = (int)(useAnim * 0.7f);
|
|
holding = false;
|
|
killModeCD.timeLeft = KillMode.cooldownMax;
|
|
Owner.Calamity().killModeCooldown = KillMode.cooldownMax - 1;
|
|
swingCount++;
|
|
}
|
|
if (postSwingCooldown > 0)
|
|
postSwingCooldown--;
|
|
else if (willDie)
|
|
{
|
|
if (hasKillMode)
|
|
killModeCD.timeLeft = KillMode.cooldownMax;
|
|
Owner.Calamity().killModeCooldown = KillMode.cooldownMax;
|
|
DrawUnconditionally = false;
|
|
Projectile.Kill();
|
|
Owner.Calamity().demonSwordKillMode = false;
|
|
return;
|
|
}
|
|
if (killModeCD.timeLeft < KillMode.cooldownMax)
|
|
{
|
|
killModeCD.timeLeft = KillMode.cooldownMax;
|
|
Owner.Calamity().killModeCooldown = KillMode.cooldownMax;
|
|
}
|
|
|
|
if (holding)
|
|
{
|
|
Animation--;
|
|
}
|
|
|
|
AnimationProgress = Animation % useAnim;
|
|
|
|
if (CanHit || postSwing)
|
|
mousePos = Owner.Center - aimVel;
|
|
else
|
|
{
|
|
mousePos = Owner.Calamity().mouseWorld;
|
|
}
|
|
|
|
if (CanHit && !swooshFade)
|
|
fadeIn = MathHelper.Lerp(fadeIn, 1, 0.5f);
|
|
else
|
|
fadeIn = MathHelper.Lerp(fadeIn, 0, 0.2f);
|
|
|
|
if (!doSwing)
|
|
{
|
|
Projectile.ai[1] = -Projectile.ai[1];
|
|
holding = true;
|
|
|
|
for (int i = 0; i < Main.maxNPCs; i++)
|
|
Projectile.localNPCImmunity[i] = 0;
|
|
|
|
Projectile.numHits = 0;
|
|
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
|
|
mousePos = Owner.Calamity().mouseWorld;
|
|
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
|
|
CanHit = false;
|
|
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
|
|
else Owner.direction = 1;
|
|
FlipAsSword = Owner.direction == -1 ? true : false;
|
|
doSwing = true;
|
|
finalFlip = false;
|
|
playSwingSound = true;
|
|
hasLaunchedBlades = false;
|
|
if (!Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0)
|
|
{
|
|
willDie = true;
|
|
if (lastHitTarget != null)
|
|
{
|
|
useAnim = 115;
|
|
SoundStyle dieSound = new("CalamityMod/Sounds/Item/DemonSwordFinalStrike");
|
|
SoundSlot = SoundEngine.PlaySound(dieSound with { Volume = 1f, Pitch = 0 }, lastHitTarget.Center);
|
|
}
|
|
}
|
|
|
|
postSwingCooldown = postSwingCooldownMax;
|
|
}
|
|
else
|
|
{
|
|
if (!CanHit && !postSwing)
|
|
{
|
|
if (mousePos.X < Owner.Center.X) Owner.direction = -1;
|
|
else Owner.direction = 1;
|
|
}
|
|
else
|
|
{
|
|
if ((Owner.Center - aimVel).X < Owner.Center.X) Owner.direction = -1;
|
|
else Owner.direction = 1;
|
|
}
|
|
|
|
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f);
|
|
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
float deathFade = willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1;
|
|
float randRot = Main.rand.NextFloat(-30, 30);
|
|
Vector2 dustVel = -Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90)).RotatedByRandom(0.3f) * Main.rand.NextFloat(7, 17) - Owner.velocity * 0.8f;
|
|
Vector2 placement = Owner.Center + (new Vector2(Main.rand.NextFloat(70, 500) * deathFade, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)));
|
|
GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/BloomCircle", false, 13, Main.rand.NextFloat(0.04f, 0.06f) * 10, (Main.rand.NextBool() ? Color.MediumOrchid : clr) * deathFade, new Vector2(0.9f, 1), shrinkSpeed: 0.95f));
|
|
}
|
|
if (lastHitTarget != null && lastHitTarget.life > 0 && lastHitTarget.active)
|
|
{
|
|
float growth = (1 - (willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1)) * 15;
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
GeneralParticleHandler.SpawnParticle(new CustomSpark(lastHitTarget.Center, Vector2.One.RotatedBy(i == 0 ? MathHelper.ToRadians(90) : 0) * Main.rand.NextFloat(-3 - growth, 3 + growth), "CalamityMod/Particles/BloomCircle", false, 13, Main.rand.NextFloat(0.04f, 0.06f) * (10 + growth), Main.rand.NextBool() ? Color.MediumOrchid : clr, new Vector2(0.7f, 1), shrinkSpeed: 0.8f));
|
|
}
|
|
}
|
|
if (holding)
|
|
{
|
|
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
|
|
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
|
|
CanHit = false;
|
|
postSwing = false;
|
|
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.7f, useAnim, Animation, true)) * 0.35f)), 0.2f);
|
|
}
|
|
else if (!willDie)
|
|
{
|
|
if (!finalFlip)
|
|
{
|
|
FlipAsSword = Owner.direction < 0 ? true : false;
|
|
}
|
|
|
|
float time = (AnimationProgress) - (useAnim / 3);
|
|
float timeMax = useAnim - (useAnim / 3);
|
|
|
|
if (time >= (int)(timeMax * 0.4f) && playSwingSound)
|
|
{
|
|
SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2);
|
|
SoundEngine.PlaySound(swing with { Volume = 0.85f, Pitch = Main.rand.NextFloat(-0.4f, -0.5f) }, Projectile.Center);
|
|
SoundStyle swing2 = new("CalamityMod/Sounds/Item/HeavySwing");
|
|
SoundEngine.PlaySound(swing2 with { Volume = 0.65f, Pitch = Main.rand.NextFloat(0.2f, 0.3f) }, Projectile.Center);
|
|
playSwingSound = false;
|
|
Owner.Calamity().demonSwordKillMode = false;
|
|
}
|
|
if (time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.9f))
|
|
CanHit = true;
|
|
else
|
|
CanHit = false;
|
|
if (time > (int)(timeMax * 0.7f))
|
|
swooshFade = true;
|
|
else
|
|
swooshFade = false;
|
|
|
|
RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(MathHelper.Lerp(150f * Projectile.ai[1] * Owner.direction, 120f * -Projectile.ai[1] * Owner.direction, CalamityUtils.ExpInOutEasing(time / timeMax * 0.9f, 1))),
|
|
0.2f);
|
|
|
|
if (time >= timeMax * 0.9f)
|
|
{
|
|
doSwing = false;
|
|
}
|
|
if (time < (int)(timeMax * 0.75f))
|
|
postSwing = true;
|
|
|
|
if (CanHit)
|
|
{
|
|
for (int i = 0; i < 8; i++)
|
|
{
|
|
float randRot = Main.rand.NextFloat(-20, -100);
|
|
Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(560, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(MathHelper.ToRadians(randRot))), ModContent.DustType<LightDust>(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.9f, 0, default, Main.rand.NextFloat(1.45f, 2.4f));
|
|
dust.noGravity = true;
|
|
dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet;
|
|
}
|
|
for (int i = 0; i < 4; i++)
|
|
{
|
|
float randRot = Main.rand.NextFloat(-20, -100);
|
|
Vector2 dustVel = (new Vector2(0, 11 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot));
|
|
Vector2 placement = Owner.Center + (new Vector2(560, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f));
|
|
GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 33, Main.rand.NextFloat(0.43f, 0.56f), Main.rand.NextBool() ? Color.MediumOrchid : clr, new Vector2(1, 1), shrinkSpeed: 0.1f));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
ArmRotationOffset = MathHelper.ToRadians(-140f);
|
|
ArmRotationOffsetBack = MathHelper.ToRadians(-140f);
|
|
}
|
|
public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone)
|
|
{
|
|
if ((damageDone <= 2 || (target.life <= 0 && target.realLife == -1)) && Projectile.numHits > 0)
|
|
Projectile.numHits -= 1;
|
|
|
|
if (target != null && target.life > 0 && target.active)
|
|
lastHitTarget = target;
|
|
|
|
bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD);
|
|
|
|
int bonusDamage = 4000;
|
|
if (target.Calamity().demonicFlamesBonusDamage <= bonusDamage)
|
|
{
|
|
target.Calamity().demonicFlamesBonusDamage = bonusDamage;
|
|
target.AddBuff(ModContent.BuffType<DemonicFlames>(), 180);
|
|
// Demonic Flames damage must be synced, because OnHitNPC is only run for the client that hit the NPC
|
|
if (Main.netMode != NetmodeID.SinglePlayer)
|
|
DemonicFlamesSyncPacket.Send(target);
|
|
}
|
|
|
|
Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
|
|
CalamityUtils.MoveNPC(target, launchVel, 40, true);
|
|
|
|
if (target.Calamity().demonSwordImpales != 0 || Projectile.numHits == 0)
|
|
{
|
|
int dustNum = (int)MathHelper.Clamp(12 - Projectile.numHits * 3, 3, 12);
|
|
for (int i = 0; i < dustNum; i++)
|
|
{
|
|
float variance = Main.rand.NextFloat(-0.5f, 0.5f);
|
|
Vector2 vel = (launchVel * 55).RotatedBy(variance) * Main.rand.NextFloat(0.2f, 1f) * (1 - Math.Abs(variance));
|
|
int dustStyle = 278;
|
|
Dust dust2 = Dust.NewDustPerfect(target.Center, dustStyle, Projectile.velocity);
|
|
dust2.scale = Main.rand.NextFloat(1.2f, 1.4f) - Math.Abs(variance);
|
|
dust2.velocity = vel;
|
|
dust2.noGravity = true;
|
|
dust2.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet;
|
|
|
|
Particle spark = new SparkParticle(Projectile.Center, vel, true, 55, 1.25f, Main.rand.NextBool() ? clr : Color.MediumOrchid);
|
|
GeneralParticleHandler.SpawnParticle(spark);
|
|
}
|
|
|
|
for (int i = 0; i < 2; i++)
|
|
{
|
|
Particle blastRing = new CustomPulse(target.Center, Vector2.Zero, Color.BlueViolet, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.7f * (i + 1), 1.3f, 18, true);
|
|
GeneralParticleHandler.SpawnParticle(blastRing);
|
|
Particle blastRing2 = new CustomPulse(target.Center, Vector2.Zero, Color.White, "CalamityMod/Particles/BloomCircle", Vector2.One, Main.rand.NextFloat(-10, 10), 0.35f * (i + 1), 0.8f, 18, true);
|
|
GeneralParticleHandler.SpawnParticle(blastRing2);
|
|
}
|
|
}
|
|
|
|
if (!hasLaunchedBlades)
|
|
{
|
|
for (int x = 0; x < Main.maxProjectiles; x++)
|
|
{
|
|
Projectile projectile = Main.projectile[x];
|
|
if (projectile.active && projectile.type == ModContent.ProjectileType<DevilsDevastationThrownBlade>() && projectile.ai[2] == target.whoAmI && projectile.localAI[0] != 5)
|
|
{
|
|
projectile.owner = Owner.whoAmI;
|
|
projectile.localAI[0] = 5;
|
|
projectile.velocity = (launchVel * 16.5f).RotatedByRandom(0.25f);
|
|
Owner.Calamity().demonSwordKillMode = true;
|
|
if (hasKillMode)
|
|
killModeCD.timeLeft = KillMode.cooldownMax + KillMode.buffMax;
|
|
Owner.Calamity().killModeCooldown = KillMode.cooldownMax + KillMode.buffMax;
|
|
hasLaunchedBlades = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (Projectile.numHits == 0)
|
|
{
|
|
Owner.SetScreenshake(12f);
|
|
for (int i = 0; i < 5; i++)
|
|
GeneralParticleHandler.SpawnParticle(new CustomSpark(target.Center + launchVel * 15, launchVel.RotatedBy((0.15f - 0.05f * i) * (i % 2 == 0 ? -1 : 1)) * (10 + 10 * i), "CalamityMod/Particles/DemonSigilParticle", false, 11, 0.7f - 0.15f * i, Main.rand.NextBool() ? clr : Color.MediumOrchid, new Vector2(1.5f, 1), extraRotation: MathHelper.ToRadians(i % 2 == 0 ? 90 : 0), shrinkSpeed: (i % 2 == 0 ? -0.8f : 0.8f)));
|
|
|
|
for (int i = 0; i < 20; i++)
|
|
{
|
|
float distPow = Main.rand.NextFloat(0, 15);
|
|
Vector2 sparkVel = launchVel.RotatedByRandom(distPow * 0.01f) * Main.rand.NextFloat(5, 35 + distPow);
|
|
Particle sparks = new CustomSpark(target.Center + (Vector2.One * distPow).RotatedByRandom(MathHelper.Pi), sparkVel, "CalamityMod/Particles/GlowSpark", false, Main.rand.Next(13, 20 + 1) * 2, (Main.rand.NextFloat(0.5f, 0.85f) - distPow * 0.12f) * 0.2f, (Main.rand.NextBool() ? clr : Color.BlueViolet) * 0.75f, new Vector2(1.3f, 0.4f), true, false, 0, false, shrinkSpeed: 0.5f);
|
|
GeneralParticleHandler.SpawnParticle(sparks);
|
|
}
|
|
|
|
|
|
SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordInsaneImpact");
|
|
SoundEngine.PlaySound(swing with { Volume = 0.8f, Pitch = MathHelper.Clamp(swingCount * 0.05f, -0.25f, 0.5f) }, Projectile.Center);
|
|
SoundStyle swing2 = new("CalamityMod/Sounds/Item/HellkiteBigHit1");
|
|
SoundEngine.PlaySound(swing2 with { Volume = 0.8f, Pitch = MathHelper.Clamp(swingCount * 0.025f, 0.4f, 0.65f) }, Projectile.Center);
|
|
}
|
|
}
|
|
public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
|
|
{
|
|
float minMult = 0.35f;
|
|
int hitsToMinMult = 8;
|
|
float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true);
|
|
modifiers.SourceDamage *= damageMult;
|
|
}
|
|
public override bool PreDraw(ref Color lightColor)
|
|
{
|
|
// Only draw the projectile if the projectile's owner is currently using the item this projectile is attached to.
|
|
Asset<Texture2D> tex = ModContent.Request<Texture2D>(Texture);
|
|
Asset<Texture2D> swoosh = ModContent.Request<Texture2D>("CalamityMod/Particles/VerticalSmearLarge");
|
|
Asset<Texture2D> swoosh2 = ModContent.Request<Texture2D>("CalamityMod/Particles/CircularTrail");
|
|
|
|
float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f;
|
|
float deathFade = willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1;
|
|
if (true)
|
|
{
|
|
Asset<Texture2D> tex2 = ModContent.Request<Texture2D>("CalamityMod/Particles/BloomLineAngled");
|
|
int draws = 30;
|
|
for (int i = 0; i < draws; i++)
|
|
{
|
|
Vector2 offsetDir = Vector2.One.RotatedBy(Projectile.rotation + RotationOffset + MathHelper.ToRadians(90));
|
|
|
|
Color auraColor = Color.Lerp(Color.MediumOrchid, clr, Utils.GetLerpValue(0, draws - 1, i)) with { A = 0 } * 0.38f * (willDie ? deathFade : 1);
|
|
Vector2 drawOffset = -offsetDir * 10 * deathFade * i;
|
|
Main.EntitySpriteDraw(tex2.Value, Projectile.Center - offsetDir * 70 - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(18, 18), tex2.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, tex2.Size() * 0.5f, Vector2.One * (1f - i * 0.02f) * 0.06f, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
|
|
}
|
|
}
|
|
for (int i = 0; i < 20; i++)
|
|
{
|
|
Color auraColor = Color.MediumOrchid with { A = 0 } * 0.18f * (willDie ? deathFade : 1);
|
|
Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 7 * (willDie ? (1 - deathFade) * 3 : 2);
|
|
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY) + Main.rand.NextVector2Circular(7, 7), tex.Frame(1, FrameCount, 0, Frame), auraColor, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
|
|
}
|
|
if ((useAnim > 0 || DrawUnconditionally))
|
|
{
|
|
Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.75f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.9f * hitboxMult, SpriteEffects.None);
|
|
Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, clr with { A = 0 } * fadeIn * 0.85f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(swingCount % 2 == 0 ? -65 : 65) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 1.2f * hitboxMult, SpriteEffects.None);
|
|
|
|
|
|
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), tex.Frame(1, FrameCount, 0, Frame), Color.Lerp(Color.MediumOrchid with { A = 0 }, lightColor, deathFade) * deathFade, Projectile.rotation + RotationOffset + r, FlipAsSword ? new Vector2(tex.Width() - SpriteOrigin.X, SpriteOrigin.Y) : SpriteOrigin, Projectile.scale, spriteEffects != SpriteEffects.None ? spriteEffects : (FlipAsSword ? SpriteEffects.FlipHorizontally : SpriteEffects.None));
|
|
}
|
|
return false;
|
|
}
|
|
public override void ResetStyle()
|
|
{
|
|
}
|
|
}
|
|
}
|