diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index 434bc0cca7..b5ec51c2f0 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -240,7 +240,20 @@ namespace CalamityMod.CalPlayer } else { + if (Player.wingTime > 0 && Player.miscCounter % 3 == 0) + Player.wingTime += 2; + if (Player.miscCounter % 5 == 0) + Player.HealPlayer(2, HealTextType.None); + + if (Player.dashDelay > 0) // Reduced dash cooldown + { + Player.dashDelay = 0; + } + if (Player.dashDelay == -1) + { + fxScale = 1.5f; + } } if (Player.velocity.Length() > 2) diff --git a/Items/Weapons/Melee/DevilsDevastation.cs b/Items/Weapons/Melee/DevilsDevastation.cs index d3c09e52f2..909a61588a 100644 --- a/Items/Weapons/Melee/DevilsDevastation.cs +++ b/Items/Weapons/Melee/DevilsDevastation.cs @@ -1,6 +1,9 @@ using System; using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; using CalamityMod.Items.Materials; +using CalamityMod.Particles; using CalamityMod.Projectiles.Melee; using CalamityMod.Projectiles.Typeless; using CalamityMod.Rarities; @@ -17,25 +20,73 @@ namespace CalamityMod.Items.Weapons.Melee public class DevilsDevastation : ModItem, ILocalizedModType { public new string LocalizationCategory => "Items.Weapons.Melee"; - + public int throwCount = 0; public override void SetDefaults() { Item.width = 118; Item.height = 118; - Item.damage = 166; - Item.DamageType = DamageClass.Melee; - Item.useAnimation = 20; - Item.useTime = 20; + + Item.damage = 235; + Item.useAnimation = Item.useTime = 43; + + Item.useStyle = ItemUseStyleID.Shoot; + Item.shoot = ModContent.ProjectileType(); Item.useTurn = true; - Item.useStyle = ItemUseStyleID.Swing; - Item.knockBack = 6.75f; - Item.UseSound = SoundID.Item1; + Item.knockBack = 7.5f; + Item.noMelee = true; + Item.noUseGraphic = true; + Item.DamageType = DamageClass.Melee; + Item.UseSound = null; Item.autoReuse = true; + Item.channel = true; + Item.value = CalamityGlobalItem.RarityDarkBlueBuyPrice; - Item.shoot = ModContent.ProjectileType(); - Item.shootSpeed = 28f; Item.rare = ModContent.RarityType(); } + public override bool MeleePrefix() => true; + public override bool CanUseItem(Player player) => player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && !player.Calamity().mouseRight; + public override void HoldItem(Player player) + { + player.Calamity().mouseWorldListener = true; + if (player.Calamity().mouseRight && player.Calamity().killModeCooldown == 0 && !Main.mapFullscreen && !Main.blockMouse) + { + SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode"); + SoundEngine.PlaySound(buff with { Volume = 0.95f }, player.Center); + + for (int i = 0; i < 10; i++) + { + Vector2 vel = (MathHelper.TwoPi * i / 10f).ToRotationVector2() * 6.5f; + Particle spark2 = new CustomSpark(player.Center + vel * 14, -vel * 0.1f, "CalamityMod/Particles/DemonSigilParticle", false, 22, 0.6f, (i % 2 == 0 ? Color.MediumOrchid : Color.BlueViolet) * 0.7f, new Vector2(1, 1), true, false, 0, false, false, -0.23f); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust c = Dust.NewDustPerfect(player.Center, ModContent.DustType()); + c.velocity = vel; + c.scale = 1.7f; + c.noGravity = true; + c.color = (i % 2 != 0 ? Color.MediumOrchid : Color.BlueViolet); + c.noLightEmittence = true; + } + + player.Calamity().demonSwordKillMode = true; + + int cooldownTime = KillMode.cooldownMax + KillMode.buffMax; + player.Calamity().killModeCooldown = cooldownTime; + player.AddCooldown(KillMode.ID, cooldownTime); + } + if (player.Calamity().demonSwordKillMode && player.ownedProjectileCounts[ModContent.ProjectileType()] <= 0 && player.Calamity().killModeCooldown == KillMode.cooldownMax + KillMode.buffMax) + { + Projectile blade = Projectile.NewProjectileDirect(player.GetSource_FromThis(), player.MountedCenter, Vector2.Zero, ModContent.ProjectileType(), Item.damage * 30, Item.knockBack, player.whoAmI, 0, throwCount); + } + } + public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + { + throwCount++; + int useSpeed = (int)MathHelper.Clamp((Item.useTime / 2.8f), 1, 100); + Projectile blade = Projectile.NewProjectileDirect(source, player.MountedCenter, velocity, type, damage, knockback, player.whoAmI, 0, throwCount); + blade.localAI[2] = useSpeed; + blade.timeLeft += useSpeed; + return false; + } public override void AddRecipes() { CreateRecipe(). diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson index 601c3b2966..d0b4e18e75 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson @@ -307,3 +307,4 @@ YinYoLight.DisplayName: Light Shard BladecrestOathswordThrownBlade.DisplayName: Bladecrest Oathsword Thrown Blade ForbiddenOathbladeThrownBlade.DisplayName: Forbidden Oathblade Thrown Blade ExaltedOathbladeThrownBlade.DisplayName: Exalted Oathblade Thrown Blade +DevilsDevastationThrownBlade.DisplayName: Devils Devastation Thrown Blade diff --git a/NPCs/CalamityGlobalNPC.cs b/NPCs/CalamityGlobalNPC.cs index 4db3252e36..d325e0fa3d 100644 --- a/NPCs/CalamityGlobalNPC.cs +++ b/NPCs/CalamityGlobalNPC.cs @@ -1131,7 +1131,7 @@ namespace CalamityMod.NPCs // Additionally, when you apply the debuff you can give it extra damage. This way it can be viable for multiple tiers if (deepBrimstoneFlames > 0) // This is like Brimstone Flames but purple and it can't be resisted // { - int baseDeepBrimstoneFlamesDoTValue = (int)((60 + deepBrimstoneFlamesBonusDamage) * Math.Max(heatDamageMult, 1)); + int baseDeepBrimstoneFlamesDoTValue = (int)((deepBrimstoneFlamesBonusDamage) * Math.Max(heatDamageMult, 1)); ApplyDPSDebuff(baseDeepBrimstoneFlamesDoTValue, baseDeepBrimstoneFlamesDoTValue / 15, ref npc.lifeRegen, ref damage); } diff --git a/Particles/BloomLineAngled.png b/Particles/BloomLineAngled.png new file mode 100644 index 0000000000..7fe67e7680 Binary files /dev/null and b/Particles/BloomLineAngled.png differ diff --git a/Projectiles/Melee/DevilsDevastationHoldout.cs b/Projectiles/Melee/DevilsDevastationHoldout.cs new file mode 100644 index 0000000000..4b3f8e2901 --- /dev/null +++ b/Projectiles/Melee/DevilsDevastationHoldout.cs @@ -0,0 +1,413 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Cooldowns; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using CalamityMod.Projectiles.BaseProjectiles; +using CalamityMod.Projectiles.Ranged; +using CalamityMod.Projectiles.Rogue; +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 +{ + public class DevilsDevastationHoldout : BaseCustomUseStyleProjectile, ILocalizedModType + { + public override int AssignedItemID => ModContent.ItemType(); + + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + 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 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) + { + IgnoreActiveAnimation = true; + DrawUnconditionally = true; + CanHit = false; + Projectile.knockBack = 0; + Projectile.scale = 1.15f; + Projectile.ai[1] = -1; + base.OnSpawn(source); + // 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()); + 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.Calamity().GeneralScreenShakePower = 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 crack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, vel.RotatedBy(MathHelper.ToRadians(45)), ModContent.ProjectileType(), 0, 0f, Owner.whoAmI, 1, 0); + } + Projectile strike = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), lastHitTarget.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage * 2, 0f, Owner.whoAmI, lastHitTarget.whoAmI, 0); + SoundStyle dieSound = new("CalamityMod/Sounds/Item/LanceofDestinyStrong"); + SoundEngine.PlaySound(dieSound with { Volume = 0.9f, Pitch = 0.3f }, lastHitTarget.Center); + } + } + 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; + } + 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) + fadeIn = MathHelper.Lerp(fadeIn, 1, 0.5f); + else + fadeIn = MathHelper.Lerp(fadeIn, 0, 0.45f); + + 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; + swingCount++; + 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.75f)) + CanHit = true; + else + CanHit = 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(), 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 = 3000; + if (target.Calamity().deepBrimstoneFlamesBonusDamage <= bonusDamage) + { + target.Calamity().deepBrimstoneFlamesBonusDamage = bonusDamage; + target.AddBuff(ModContent.BuffType(), 180); + } + + Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld); + CalamityUtils.MoveNPC(target, launchVel, 40, true); + + 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.owner == Projectile.owner && projectile.type == ModContent.ProjectileType() && projectile.ai[2] == target.whoAmI && projectile.localAI[0] != 5) + { + 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.Calamity().GeneralScreenShakePower = 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 * (Owner.Calamity().mouseRight ? 2.5f : 1); + } + 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 tex = ModContent.Request(Texture); + Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge"); + Asset swoosh2 = ModContent.Request("CalamityMod/Particles/CircularTrail"); + + float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f; + float deathFade = willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1; + if (true) + { + Asset tex2 = ModContent.Request("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(Projectile.ai[1] == 1 ? -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(Projectile.ai[1] == 1 ? -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() + { + } + } +} diff --git a/Projectiles/Melee/DevilsDevastationThrownBlade.cs b/Projectiles/Melee/DevilsDevastationThrownBlade.cs new file mode 100644 index 0000000000..0885dbe362 --- /dev/null +++ b/Projectiles/Melee/DevilsDevastationThrownBlade.cs @@ -0,0 +1,376 @@ +using System; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.ModLoader; +using static CalamityMod.CalamityUtils; + +namespace CalamityMod.Projectiles.Melee +{ + public class DevilsDevastationThrownBlade : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override string Texture => "CalamityMod/Items/Weapons/Melee/DevilsDevastation"; + + public int ChargeupTime => (int)Projectile.localAI[2]; + public int Lifetime = 180; + public float OverallProgress => 1 - Projectile.timeLeft / (float)Lifetime; + public float ThrowProgress => 1 - Projectile.timeLeft / (float)(Lifetime); + public float ChargeProgress => 1 - (Projectile.timeLeft - Lifetime) / (float)(ChargeupTime); + public Player Owner => Main.player[Projectile.owner]; + + // Real variables here + public ref float time => ref Projectile.ai[0]; + public ref float stabOrder => ref Projectile.ai[1]; + public ref NPC stabbedTarget => ref Main.npc[(int)Projectile.ai[2]]; + + public Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.5f); + public bool thrown = false; + public int fadeOutTime = 120; + public bool stuckInTarget = false; + public int stuckTimer = 0; + public bool exitedTarget = false; + public bool stuckInGround = false; + public Vector2 impalePos; + public int bounces = 0; + public Vector2 tipPosition = Vector2.Zero; + public bool fadingOut => Projectile.timeLeft <= (Lifetime - fadeOutTime); + public override void SetDefaults() + { + Projectile.width = 35; + Projectile.height = 35; + Projectile.friendly = true; + Projectile.tileCollide = false; + Projectile.penetrate = -1; + Projectile.timeLeft = Lifetime + ChargeupTime; + Projectile.DamageType = DamageClass.Melee; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = -1; + Projectile.noEnchantmentVisuals = true; + } + + public override bool ShouldUpdatePosition() + { + return (ChargeProgress >= 1 && !stuckInGround && !stuckInTarget); + } + + //Swing animation keys + public CurveSegment pullback = new CurveSegment(EasingType.PolyOut, 0f, 0f, MathHelper.PiOver4 * -1.2f, 2); + public CurveSegment throwout = new CurveSegment(EasingType.PolyOut, 0.7f, MathHelper.PiOver4 * -1.2f, MathHelper.PiOver4 * 1.2f + MathHelper.PiOver2, 3); + internal float ArmAnticipationMovement() => PiecewiseAnimation(ChargeProgress, new CurveSegment[] { pullback, throwout }); + + public override void AI() + { + float playerDist = Vector2.Distance(Owner.Center, Projectile.Center); + + Projectile.spriteDirection = Projectile.direction; + Vector3 Light = Color.MediumOrchid.ToVector3(); + Lighting.AddLight(Projectile.Center, Light * 0.85f); + + if (Projectile.timeLeft == Lifetime) + { + Projectile.netUpdate = true; + + // 15NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction + Vector2 toMouse = (Main.MouseWorld - Owner.Center).SafeNormalize(Vector2.UnitX * Owner.direction); + Projectile.velocity = toMouse * 14; + Projectile.Center = Owner.MountedCenter + toMouse * 30f; + Projectile.spriteDirection = Projectile.direction; + thrown = true; + time = 0; + Projectile.extraUpdates = 3; + } + + if (Projectile.velocity.X > 0) + Projectile.direction = 1; + else + Projectile.direction = -1; + + if (thrown) + { + Projectile.spriteDirection = Projectile.direction; + + if (!stuckInGround && exitedTarget) + Projectile.rotation += (0.35f * (MathF.Abs(Projectile.velocity.Y) * 0.03f + 0.85f)) * Main.rand.NextFloat(0.7f, 1f) * Projectile.direction * Projectile.Opacity; + else + Projectile.rotation = (Projectile.velocity.ToRotation() + MathHelper.PiOver4 * (Projectile.direction == 1 ? 1 : 3)); + + if (time > fadeOutTime * 0.7f && !exitedTarget) + Projectile.velocity *= 0.93f; + + if (stuckInTarget) + { + Projectile.tileCollide = false; + time--; + Projectile.timeLeft++; + if (stuckTimer > 0) + stuckTimer--; + else + { + Projectile.velocity *= 0.01f; + stabbedTarget.Calamity().demonSwordImpales--; + stuckInTarget = false; + fadeOutEffect(); + } + + Projectile.Center = stabbedTarget.Center + impalePos; + if ((stabbedTarget.life <= 0) || stabbedTarget == null || Projectile.localAI[0] == 5 || !stabbedTarget.active) + { + Projectile.timeLeft = Lifetime; + stabbedTarget.Calamity().demonSwordImpales--; + stuckInTarget = false; + exitedTarget = true; + + Projectile.rotation += Main.rand.NextFloat(-1.5f, 1.5f); + for (int i = 0; i < Main.maxNPCs; i++) + Projectile.localNPCImmunity[i] = 0; + Projectile.numHits = 0; + SoundStyle unstuck = new("CalamityMod/Sounds/NPCHit/PerfLargeHit", 3); + SoundEngine.PlaySound(unstuck with { Volume = 0.85f, Pitch = Main.rand.NextFloat(0.3f, 0.4f), MaxInstances = 3 }, Projectile.Center); + } + } + if (exitedTarget && !stuckInGround) + { + Projectile.extraUpdates = 3; + } + + if (fadingOut) + fadeOutEffect(); + } + if (!fadingOut && !stuckInTarget && !stuckInGround && ChargeProgress >= 1) + { + for (int i = 0; i < 2; i++) + { + Vector2 safeVel = Projectile.velocity.SafeNormalize(Vector2.UnitX); + Vector2 dustVel = exitedTarget ? safeVel.RotatedBy(MathHelper.ToRadians(-90 * Projectile.direction) + Projectile.rotation) : safeVel.RotatedBy(MathHelper.ToRadians(70 * (i == 0 ? 1 : -1))) * 6; + if (!exitedTarget) + { + Particle spark = new VelChangingSpark(Projectile.Center + safeVel * 95, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 5, 0.2f, (clr) * 0.95f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); + GeneralParticleHandler.SpawnParticle(spark); + + Particle spark2 = new VelChangingSpark(Projectile.Center + safeVel * 95, -dustVel, -Projectile.velocity, "CalamityMod/Particles/BloomCircle", 10, 0.2f, (Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet) * 0.65f, new Vector2(1.2f, 1f), true, false, 0, false, 1.0f, 0.22f); + GeneralParticleHandler.SpawnParticle(spark2); + } + if (exitedTarget && i == 0) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 60, ModContent.DustType(), dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(1.2f, 1.4f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet; + } + } + + if (Main.rand.NextBool(4)) + { + Particle spark2 = new CustomSpark(Projectile.Center, -Projectile.velocity.RotatedByRandom(0.3f) * Main.rand.NextFloat(0.2f, 0.6f), "CalamityMod/Particles/DemonSigilParticle", false, 17, Main.rand.NextFloat(0.2f, 0.3f), Color.Lerp(Color.MediumOrchid, Color.BlueViolet, Main.rand.NextFloat(0, 0.7f)) * 0.6f, new Vector2(1, 1), true, false, Main.rand.NextFloat(-1f, 1f), false, false); + GeneralParticleHandler.SpawnParticle(spark2); + } + } + + //Anticipation animation. Make the player look like they're holding the item + if (ChargeProgress < 1) + { + throwAnimation(); + if (ChargeProgress >= 0.6f && time == 0) + { + SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordSwing", 2); + SoundEngine.PlaySound(swing with { Volume = 0.65f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f) }, Projectile.Center); + time++; + } + return; + } + else + time++; + } + public void fadeOutEffect() + { + Projectile.tileCollide = false; + if (Projectile.timeLeft > Lifetime - fadeOutTime) + Projectile.timeLeft = Lifetime - fadeOutTime; + Projectile.Opacity = Utils.GetLerpValue(0, Lifetime - fadeOutTime, Projectile.timeLeft, true); + + Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity; + if (Main.rand.NextBool(4)) + { + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + dust.noGravity = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : clr; + dust.noLight = true; + dust.noLightEmittence = true; + dust.alpha = 100; + dust.velocity += Projectile.velocity; + } + } + public void throwAnimation() + { + Owner.ChangeDir(MathF.Sign(Main.MouseWorld.X - Owner.Center.X)); + + float armRotation = ArmAnticipationMovement() * Owner.direction; + + Owner.heldProj = Projectile.whoAmI; + Projectile.spriteDirection = Owner.direction; + Projectile.direction = Owner.direction; + + Projectile.Center = Owner.MountedCenter + Vector2.UnitY.RotatedBy(armRotation * Owner.gravDir) * -80f * Owner.gravDir; + Projectile.rotation = (-MathHelper.PiOver4 * Projectile.direction + armRotation) * Owner.gravDir; + + Owner.SetCompositeArmFront(true, Player.CompositeArmStretchAmount.Full, MathHelper.Pi + armRotation); + + } + + public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) + { + int bonusDamage = 1000; + if (target.Calamity().deepBrimstoneFlamesBonusDamage <= bonusDamage) + { + target.Calamity().deepBrimstoneFlamesBonusDamage = bonusDamage; + target.AddBuff(ModContent.BuffType(), 120); + } + + if (!exitedTarget) + { + SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); + SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(-0.1f, 0.1f), MaxInstances = 3 }, Projectile.Center); + + Projectile.ai[2] = target.whoAmI; + + if (target.Calamity().demonSwordImpales < 0) + target.Calamity().demonSwordImpales = 0; + if (target.Calamity().demonSwordImpales >= 5) + { + float bladeValue = -1; + Projectile ejectedBlade = null; + for (int x = 0; x < Main.maxProjectiles; x++) + { + Projectile projectile = Main.projectile[x]; + if (projectile.owner == Projectile.owner && projectile.type == Projectile.type && Projectile.localAI[0] != 5 && projectile.ai[2] == Projectile.ai[2] && projectile.timeLeft > (Lifetime - fadeOutTime) && (bladeValue == -1 || bladeValue > projectile.ai[1])) + { + bladeValue = projectile.ai[1]; + ejectedBlade = projectile; + } + } + ejectedBlade.localAI[0] = 5; + ejectedBlade.ai[1] += 1000; + ejectedBlade.velocity = Projectile.velocity; + + for (int i = 0; i < 12; i++) + { + Particle spark2 = new SparkParticle(target.Center, Projectile.velocity.RotatedByRandom(0.45) * Main.rand.NextFloat(2.5f, 4.5f), false, 50, Main.rand.NextFloat(0.2f, 1.3f), Main.rand.NextBool() ? clr : Color.BlueViolet); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.35) * Main.rand.NextFloat(2f, 4f), 0, default, Main.rand.NextFloat(1.3f, 1.6f)); + dust.noGravity = true; + dust.noLight = true; + dust.color = Main.rand.NextBool() ? Color.MediumOrchid : clr; + } + } + else + { + for (int i = 0; i < 8; i++) + { + Particle spark2 = new SparkParticle(target.Center, Projectile.velocity.RotatedByRandom(0.3) * Main.rand.NextFloat(0.4f, 2.5f), false, 50, Main.rand.NextFloat(0.2f, 1.3f), Main.rand.NextBool() ? Color.MediumOrchid : clr); + GeneralParticleHandler.SpawnParticle(spark2); + + Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.2) * Main.rand.NextFloat(0.5f, 2f), 0, default, Main.rand.NextFloat(1.1f, 1.4f)); + dust.noGravity = false; + dust.noLight = true; + dust.color = Main.rand.NextBool() ? clr : Color.BlueViolet; + } + } + target.Calamity().demonSwordImpales++; + + stuckInTarget = true; + impalePos = Projectile.Center - stabbedTarget.Center; + stuckTimer = 3600; + } + } + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + float minMult = 0.45f; + int hitsToMinMult = 9; + float damageMult = Utils.Remap(Projectile.numHits, 0, hitsToMinMult, 1, minMult, true); + modifiers.SourceDamage *= damageMult * (exitedTarget ? 1.15f : 1f); + } + public override bool OnTileCollide(Vector2 oldVelocity) + { + if (exitedTarget) + { + if (bounces >= 2) + { + impaleGround(oldVelocity); + } + else + { + if (Projectile.velocity.X != oldVelocity.X) + { + Projectile.velocity.X = -oldVelocity.X; + } + if (Projectile.velocity.Y != oldVelocity.Y) + { + Projectile.velocity.Y = -oldVelocity.Y; + } + if (Projectile.velocity.Length() < 8) + Projectile.velocity = Projectile.velocity.SafeNormalize(Vector2.UnitX) * 8; + Projectile.velocity.Y *= 0.85f; + Projectile.velocity = Projectile.velocity.RotatedByRandom(0.2f); + SoundEngine.PlaySound(new("CalamityMod/Sounds/Custom/CeramicImpact", 2) { Volume = 0.35f, Pitch = Main.rand.NextFloat(-0.4f, -0.5f) }, Projectile.Center); + bounces++; + Projectile.timeLeft = Lifetime; + } + } + else + { + impaleGround(oldVelocity); + } + + return false; + } + public void impaleGround(Vector2 oldVelocity) + { + Projectile.velocity = oldVelocity; + stuckInGround = true; + Projectile.timeLeft = (int)(Lifetime - fadeOutTime * 0.3f); + Projectile.tileCollide = false; + SoundStyle stuck = new("CalamityMod/Sounds/Item/DemonSwordImpact", 2); + SoundEngine.PlaySound(stuck with { Volume = 0.75f, Pitch = Main.rand.NextFloat(0.2f, 0.3f), MaxInstances = 3 }, Projectile.Center); + } + public override bool? CanDamage() + { + if (ChargeProgress < 1 || fadingOut || stuckInGround || stuckInTarget || (Projectile.numHits > 0 && !exitedTarget)) + return false; + + return base.CanDamage(); + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => (Projectile.numHits > 0 && !exitedTarget) ? false : CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.3f : 1), targetHitbox); // After exiting a target, the hitbox is larger + public override bool PreDraw(ref Color lightColor) + { + Texture2D centerTexture = ModContent.Request("CalamityMod/Items/Weapons/Melee/DevilsDevastation").Value; + Vector2 generalDrawPos = Projectile.Center - Main.screenPosition; + Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.35f); + float fadeScale = (1 - Projectile.Opacity); + for (int i = 0; i < 16; i++) + { + Color auraColor = Color.MediumOrchid with { A = 0 } * 0.4f * fadeScale * Projectile.Opacity; + Vector2 drawOffset = (MathHelper.TwoPi * i / 16f).ToRotationVector2() * 9 * fadeScale; + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition + drawOffset, null, auraColor, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + } + if (exitedTarget && !stuckInGround) + { + Asset p = ModContent.Request("CalamityMod/Particles/CircularSmearFire3"); + Asset p2 = ModContent.Request("CalamityMod/Particles/SemiCircularSmearSwipe"); + + Main.EntitySpriteDraw(p2.Value, generalDrawPos, null, clr with { A = 0 } * 0.65f, Projectile.rotation * Main.rand.NextFloat(1.6f, 1.7f), p2.Size() * 0.5f, 1.4f * Main.rand.NextFloat(0.8f, 1.15f), Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + Main.EntitySpriteDraw(p.Value, generalDrawPos, null, Color.MediumOrchid with { A = 0 } * 0.75f, Projectile.rotation * Main.rand.NextFloat(1.2f, 1.3f), p.Size() * 0.5f, 1.25f, Projectile.direction == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None); + + } + Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.BlueViolet with { A = 0 }, lightColor, Projectile.Opacity) * Projectile.Opacity, Projectile.rotation, centerTexture.Size() * 0.5f, Projectile.scale, Projectile.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally); + + return false; + } + } +} diff --git a/Projectiles/Melee/DevilsStrike.cs b/Projectiles/Melee/DevilsStrike.cs new file mode 100644 index 0000000000..a3b088fec3 --- /dev/null +++ b/Projectiles/Melee/DevilsStrike.cs @@ -0,0 +1,83 @@ +using System; +using System.Runtime.ConstrainedExecution; +using CalamityMod.Buffs.DamageOverTime; +using CalamityMod.Dusts; +using CalamityMod.Items.Weapons.Melee; +using CalamityMod.Particles; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using ReLogic.Content; +using Terraria; +using Terraria.Audio; +using Terraria.ID; +using Terraria.Localization; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Melee +{ + public class DevilsStrike : ModProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Melee"; + public override LocalizedText DisplayName => CalamityUtils.GetItemName(); + public override string Texture => "CalamityMod/Projectiles/InvisibleProj"; + + public int time = 0; + public float fade = 0; + public int angleTimer = 20; + public Color clr = Color.Lerp(Color.DeepPink, Color.Orange, 0.5f); + public int curveDir = 1; + public override void SetDefaults() + { + Projectile.width = 20; + Projectile.height = 20; + Projectile.friendly = true; + Projectile.penetrate = -1; + Projectile.DamageType = DamageClass.MeleeNoSpeed; + Projectile.extraUpdates = 80; + Projectile.usesLocalNPCImmunity = true; + Projectile.localNPCHitCooldown = 0; + Projectile.timeLeft = 400; + Projectile.tileCollide = false; + } + + public override void AI() + { + float deathLerp = Utils.Remap(Projectile.timeLeft, 300, 0, 40, 5); + + if (time == 0) + { + angleTimer += Main.rand.Next(60, 80 + 1); + curveDir = Main.rand.NextBool() ? 1 : -1; + } + time++; + if (angleTimer > 0) + { + angleTimer--; + Projectile.velocity = Projectile.velocity.RotatedByRandom(0.01f); + } + else + { + angleTimer = Main.rand.Next(60, 80 + 1); + Projectile.velocity = Projectile.velocity.RotatedBy((0.9f * Utils.GetLerpValue(0, 300, Projectile.timeLeft, true) * curveDir) * Main.rand.NextFloat(0.85f, 1.15f) * Projectile.ai[0]); + curveDir *= -1; + } + if (time % 6 == 0) + GeneralParticleHandler.SpawnParticle(new CustomSpark(Projectile.Center, Projectile.velocity * 0.1f, "CalamityMod/Particles/BloomCircle", false, 20, Main.rand.NextFloat(0.05f, 0.055f) * deathLerp * Projectile.ai[0], (Main.rand.NextBool() ? Color.MediumOrchid : clr) * 0.7f, new Vector2(0.8f, 1), shrinkSpeed: 0.2f)); + if (angleTimer % 60 == 0 && Projectile.ai[0] == 1) + { + Projectile crack = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, (Projectile.velocity * 0.8f).RotatedBy(Main.rand.NextBool() ? -0.6f : 0.6f), ModContent.ProjectileType(), Projectile.damage, 0f, Projectile.owner, 0.7f, 0); + crack.timeLeft = 250; + } + } + + public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers) + { + + } + public override bool PreDraw(ref Color lightColor) + { + return false; + } + public override bool? Colliding(Rectangle projHitbox, Rectangle targetHitbox) => false; + } +} diff --git a/Projectiles/Melee/ExaltedOathbladeHoldout.cs b/Projectiles/Melee/ExaltedOathbladeHoldout.cs index 7213af9310..7855b854bb 100644 --- a/Projectiles/Melee/ExaltedOathbladeHoldout.cs +++ b/Projectiles/Melee/ExaltedOathbladeHoldout.cs @@ -233,7 +233,7 @@ namespace CalamityMod.Projectiles.Melee bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); - int bonusDamage = 240; + int bonusDamage = 300; if (target.Calamity().deepBrimstoneFlamesBonusDamage <= bonusDamage) { target.Calamity().deepBrimstoneFlamesBonusDamage = bonusDamage; diff --git a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs index 1132dd1bbe..46a499f96b 100644 --- a/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs +++ b/Projectiles/Melee/ExaltedOathbladeThrownBlade.cs @@ -224,7 +224,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int bonusDamage = 60; + int bonusDamage = 120; if (target.Calamity().deepBrimstoneFlamesBonusDamage <= bonusDamage) { target.Calamity().deepBrimstoneFlamesBonusDamage = bonusDamage; diff --git a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs index c0a62ed3f7..3fc2ca75c0 100644 --- a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs +++ b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs @@ -231,7 +231,7 @@ namespace CalamityMod.Projectiles.Melee bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD); - int bonusDamage = 60; + int bonusDamage = 120; if (target.Calamity().deepBrimstoneFlamesBonusDamage <= bonusDamage) { target.Calamity().deepBrimstoneFlamesBonusDamage = bonusDamage; diff --git a/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs index efce8e5e97..823d858897 100644 --- a/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs +++ b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs @@ -226,7 +226,7 @@ namespace CalamityMod.Projectiles.Melee public override void OnHitNPC(NPC target, NPC.HitInfo hit, int damageDone) { - int bonusDamage = 0; + int bonusDamage = 60; if (target.Calamity().deepBrimstoneFlamesBonusDamage <= bonusDamage) { target.Calamity().deepBrimstoneFlamesBonusDamage = bonusDamage; diff --git a/Projectiles/Melee/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs index c6f126501a..769789e314 100644 --- a/Projectiles/Melee/GrandDadHoldout.cs +++ b/Projectiles/Melee/GrandDadHoldout.cs @@ -50,7 +50,7 @@ namespace CalamityMod.Projectiles.Melee { Projectile.knockBack = 0; Projectile.scale = 1; - Projectile.ai[1] = 1; + Projectile.ai[1] = -1; base.OnSpawn(source); // 14NOV2024: Ozzatron: clamped mouse position unnecessary, as Grand Dad has no projectiles diff --git a/Sounds/Item/DemonSwordFinalStrike.ogg b/Sounds/Item/DemonSwordFinalStrike.ogg new file mode 100644 index 0000000000..2a41668677 Binary files /dev/null and b/Sounds/Item/DemonSwordFinalStrike.ogg differ diff --git a/Systems/Collections/PierceResistExceptionList.cs b/Systems/Collections/PierceResistExceptionList.cs index c98d800718..95dc2ecceb 100644 --- a/Systems/Collections/PierceResistExceptionList.cs +++ b/Systems/Collections/PierceResistExceptionList.cs @@ -40,6 +40,7 @@ namespace CalamityMod.Systems.Collections ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), @@ -49,6 +50,7 @@ namespace CalamityMod.Systems.Collections ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(), diff --git a/Systems/Collections/ProjectileDestroyExceptionsList.cs b/Systems/Collections/ProjectileDestroyExceptionsList.cs index 00fd5f5ebc..5992a004e2 100644 --- a/Systems/Collections/ProjectileDestroyExceptionsList.cs +++ b/Systems/Collections/ProjectileDestroyExceptionsList.cs @@ -67,6 +67,8 @@ namespace CalamityMod.Systems.Collections ProjectileType(), ProjectileType(), ProjectileType(), + ProjectileType(), + ProjectileType(), ProjectileType(), ProjectileType(), ProjectileType(),