diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs
index fec8a17155..2df30cf271 100644
--- a/CalPlayer/CalamityPlayer.cs
+++ b/CalPlayer/CalamityPlayer.cs
@@ -241,6 +241,8 @@ namespace CalamityMod.CalPlayer
#region Timer and Counter
public int gaelSwipes = 0;
public int arsenalCooldown = 0;
+ public int killModeCooldown = 0;
+ public bool demonSwordKillMode = false;
///
/// Tracks Dragoon Drizzlefish's "gel feed" mechanic in Get fixed boi.
/// Consuming Gel adds 1 to this counter, up to a maximum of 6, and using the weapon has a random chance to decrement the counter.
diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs
index afd1a14ad7..a433b1a697 100644
--- a/CalPlayer/CalamityPlayerMiscEffects.cs
+++ b/CalPlayer/CalamityPlayerMiscEffects.cs
@@ -1770,6 +1770,8 @@ namespace CalamityMod.CalPlayer
if (arsenalCooldown > 0)
arsenalCooldown--;
+ if (killModeCooldown > 0)
+ killModeCooldown--;
if (ascendantInsigniaCooldown > 0 && ascendantInsigniaBuffTime <= 0)
ascendantInsigniaCooldown--;
if (transformerCooldown > 0)
@@ -2514,6 +2516,13 @@ namespace CalamityMod.CalPlayer
omegaBlueCD.timeLeft = 1500;
}
+ bool hasKillMode = cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD);
+ if (hasKillMode && killModeCD.timeLeft > KillMode.cooldownMax && !(Player.ActiveItem().type == ModContent.ItemType() || Player.ActiveItem().type == ModContent.ItemType() || Player.ActiveItem().type == ModContent.ItemType()))
+ {
+ killModeCD.timeLeft = KillMode.cooldownMax - 1;
+ Player.Calamity().killModeCooldown = KillMode.cooldownMax - 1;
+ }
+
bool hasPlagueBlackoutCD = cooldowns.TryGetValue(PlagueBlackout.ID, out CooldownInstance plagueBlackoutCD);
if (!plagueReaper && hasPlagueBlackoutCD && plagueBlackoutCD.timeLeft > 1500)
plagueBlackoutCD.timeLeft = 1500;
diff --git a/Cooldowns/KillMode.cs b/Cooldowns/KillMode.cs
new file mode 100644
index 0000000000..3a627277d8
--- /dev/null
+++ b/Cooldowns/KillMode.cs
@@ -0,0 +1,62 @@
+using System;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Terraria;
+using Terraria.Audio;
+using Terraria.Graphics.Shaders;
+using Terraria.ID;
+using Terraria.Localization;
+using static Terraria.ModLoader.ModContent;
+
+namespace CalamityMod.Cooldowns
+{
+ public class KillMode : CooldownHandler
+ {
+ public static new string ID => "KillMode";
+ public override bool ShouldDisplay => true;
+ public static int cooldownMax = 300;
+ public static int buffMax = 180;
+ public override LocalizedText DisplayName => CalamityUtils.GetText("UI.Cooldowns.KillMode" + (instance.timeLeft > cooldownMax ? "Active" : "Cooldown"));
+ public override string Texture => "CalamityMod/Cooldowns/KillMode";
+ public override string OutlineTexture => "CalamityMod/Cooldowns/KillModeOutline";
+ public override string OverlayTexture => "CalamityMod/Cooldowns/KillModeOverlay";
+ public override Color OutlineColor => instance.timeLeft > cooldownMax ? Color.MediumOrchid : Color.BlueViolet;
+ public override Color CooldownStartColor => instance.timeLeft > cooldownMax ? Color.Lerp(Color.Indigo, Color.DarkMagenta, (instance.timeLeft - cooldownMax) / buffMax) : Color.MediumOrchid;
+ public override Color CooldownEndColor => instance.timeLeft > cooldownMax ? Color.Lerp(Color.BlueViolet, Color.DarkOrchid, (instance.timeLeft - cooldownMax) / buffMax) : Color.DarkOrchid;
+ public override SoundStyle? EndSound => new("CalamityMod/Sounds/Item/DemonSwordKillModeOffCooldown");
+
+ //Charge down at first, and then charge back up
+ private float AdjustedCompletion => instance.timeLeft > cooldownMax ? Utils.GetLerpValue(cooldownMax, cooldownMax + buffMax, instance.timeLeft) : Utils.GetLerpValue(cooldownMax, 0, instance.timeLeft);
+ public override void Tick()
+ {
+ //Main.NewText(AdjustedCompletion);
+ }
+ public override void ApplyBarShaders(float opacity)
+ {
+ //Use the adjusted completion
+ GameShaders.Misc["CalamityMod:CircularBarShader"].UseOpacity(opacity);
+ GameShaders.Misc["CalamityMod:CircularBarShader"].UseSaturation(AdjustedCompletion);
+ GameShaders.Misc["CalamityMod:CircularBarShader"].UseColor(CooldownStartColor);
+ GameShaders.Misc["CalamityMod:CircularBarShader"].UseSecondaryColor(CooldownEndColor);
+ GameShaders.Misc["CalamityMod:CircularBarShader"].Apply();
+ }
+
+ public override void DrawCompact(SpriteBatch spriteBatch, Vector2 position, float opacity, float scale)
+ {
+ Texture2D sprite = Request(Texture).Value;
+ Texture2D outline = Request(OutlineTexture).Value;
+ Texture2D overlay = Request(OverlayTexture).Value;
+
+ //Draw the outline
+ spriteBatch.Draw(outline, position, null, OutlineColor * opacity, 0, outline.Size() * 0.5f, scale, SpriteEffects.None, 0f);
+
+ //Draw the icon
+ spriteBatch.Draw(sprite, position, null, Color.White * opacity, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f);
+
+ //Draw the small overlay
+ int lostHeight = (int)Math.Ceiling(overlay.Height * AdjustedCompletion);
+ Rectangle crop = new Rectangle(0, lostHeight, overlay.Width, overlay.Height - lostHeight);
+ spriteBatch.Draw(overlay, position + Vector2.UnitY * lostHeight * scale, crop, OutlineColor * opacity * 0.9f, 0, sprite.Size() * 0.5f, scale, SpriteEffects.None, 0f);
+ }
+ }
+}
diff --git a/Cooldowns/KillMode.png b/Cooldowns/KillMode.png
new file mode 100644
index 0000000000..cc835514cb
Binary files /dev/null and b/Cooldowns/KillMode.png differ
diff --git a/Cooldowns/KillModeOutline.png b/Cooldowns/KillModeOutline.png
new file mode 100644
index 0000000000..649f58d6e8
Binary files /dev/null and b/Cooldowns/KillModeOutline.png differ
diff --git a/Cooldowns/KillModeOverlay.png b/Cooldowns/KillModeOverlay.png
new file mode 100644
index 0000000000..e3e02deb83
Binary files /dev/null and b/Cooldowns/KillModeOverlay.png differ
diff --git a/Items/Weapons/Melee/BladecrestOathsword.cs b/Items/Weapons/Melee/BladecrestOathsword.cs
index 24ede5b31f..f3af277d60 100644
--- a/Items/Weapons/Melee/BladecrestOathsword.cs
+++ b/Items/Weapons/Melee/BladecrestOathsword.cs
@@ -37,7 +37,7 @@ namespace CalamityMod.Items.Weapons.Melee
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 / 3.5f), 1, 100);
+ 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;
diff --git a/Items/Weapons/Melee/ForbiddenOathblade.cs b/Items/Weapons/Melee/ForbiddenOathblade.cs
index c37bc8adb4..fc5d64a2f3 100644
--- a/Items/Weapons/Melee/ForbiddenOathblade.cs
+++ b/Items/Weapons/Melee/ForbiddenOathblade.cs
@@ -1,9 +1,17 @@
using CalamityMod.Buffs.DamageOverTime;
+using CalamityMod.Cooldowns;
+using CalamityMod.Dusts;
+using CalamityMod.Items.BaseItems;
+using CalamityMod.Items.Materials;
+using CalamityMod.Particles;
using CalamityMod.Projectiles.Melee;
+using CalamityMod.Projectiles.Rogue;
using CalamityMod.Projectiles.Typeless;
using Microsoft.Xna.Framework;
+using Mono.Cecil;
using Terraria;
using Terraria.Audio;
+using Terraria.DataStructures;
using Terraria.ID;
using Terraria.ModLoader;
@@ -12,94 +20,79 @@ namespace CalamityMod.Items.Weapons.Melee
public class ForbiddenOathblade : ModItem, ILocalizedModType
{
public new string LocalizationCategory => "Items.Weapons.Melee";
+ public int throwCount = 0;
public override void SetDefaults()
{
Item.width = 74;
Item.height = 74;
- Item.damage = 110;
- Item.DamageType = DamageClass.Melee;
- Item.useAnimation = Item.useTime = 55;
+ Item.damage = 90;
+ Item.useAnimation = Item.useTime = 50;
+
+ Item.useStyle = ItemUseStyleID.Shoot;
+ Item.shoot = ModContent.ProjectileType();
Item.useTurn = true;
- Item.useStyle = ItemUseStyleID.Swing;
- Item.knockBack = 6.5f;
- Item.UseSound = SoundID.Item1;
+ Item.knockBack = 4.5f;
+ Item.noMelee = true;
+ Item.noUseGraphic = true;
+ Item.DamageType = DamageClass.Melee;
+ Item.UseSound = null;
Item.autoReuse = true;
+ Item.channel = true;
+
Item.value = CalamityGlobalItem.RarityPinkBuyPrice;
Item.rare = ItemRarityID.Pink;
- Item.shoot = ModContent.ProjectileType();
- Item.shootSpeed = 10f;
}
-
- public override void MeleeEffects(Player player, Rectangle hitbox)
+ 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)
{
- if (Main.rand.NextBool(3))
- Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, DustID.ShadowbeamStaff);
- }
-
- public override void OnHitNPC(Player player, NPC target, NPC.HitInfo hit, int damageDone)
- {
- target.AddBuff(BuffID.ShadowFlame, 120);
- target.AddBuff(ModContent.BuffType(), 240);
- if (hit.Crit)
+ player.Calamity().mouseWorldListener = true;
+ if (player.Calamity().mouseRight && player.Calamity().killModeCooldown == 0)
{
- target.AddBuff(BuffID.ShadowFlame, 360);
- target.AddBuff(ModContent.BuffType(), 720);
- int onHitDamage = player.CalcIntDamage(1.25f * Item.damage);
- Projectile blast = Projectile.NewProjectileDirect(Item.GetSource_FromThis(), target.Center, Vector2.Zero, ModContent.ProjectileType(), onHitDamage, 0f, player.whoAmI, target.whoAmI);
- blast.DamageType = Item.DamageType;
- float firstDustScale = 1.7f;
- float secondDustScale = 0.8f;
- float thirdDustScale = 2f;
- Vector2 dustRotation = (target.rotation - 1.57079637f).ToRotationVector2();
- Vector2 dustVelocity = dustRotation * target.velocity.Length();
- SoundEngine.PlaySound(SoundID.Item14, target.Center);
- int dustIncr;
- for (int i = 0; i < 40; i = dustIncr + 1)
+ SoundStyle buff = new("CalamityMod/Sounds/Item/DemonSwordKillMode");
+ SoundEngine.PlaySound(buff with { Volume = 0.95f }, player.Center);
+
+ for (int i = 0; i < 10; i++)
{
- int swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 200, default, firstDustScale);
- Dust dust = Main.dust[swingDust];
- dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f;
- dust.noGravity = true;
- dust.velocity.Y -= 4.5f;
- dust.velocity *= 3f;
- dust.velocity += dustVelocity * Main.rand.NextFloat();
- swingDust = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 100, default, secondDustScale);
- dust.position = target.Center + Vector2.UnitY.RotatedByRandom(3.1415927410125732) * (float)Main.rand.NextDouble() * (float)target.width / 2f;
- dust.velocity.Y -= 3f;
- dust.velocity *= 2f;
- dust.noGravity = true;
- dust.fadeIn = 1f;
- dust.color = Color.Crimson * 0.5f;
- dust.velocity += dustVelocity * Main.rand.NextFloat();
- dustIncr = i;
- }
- for (int j = 0; j < 20; j = dustIncr + 1)
- {
- int swingDust2 = Dust.NewDust(new Vector2(target.position.X, target.position.Y), target.width, target.height, DustID.ShadowbeamStaff, 0f, 0f, 0, default, thirdDustScale);
- Dust dust = Main.dust[swingDust2];
- dust.position = target.Center + Vector2.UnitX.RotatedByRandom(3.1415927410125732).RotatedBy((double)target.velocity.ToRotation(), default) * (float)target.width / 3f;
- dust.noGravity = true;
- dust.velocity.Y -= 1.5f;
- dust.velocity *= 0.5f;
- dust.velocity += dustVelocity * (0.6f + 0.6f * Main.rand.NextFloat());
- dustIncr = j;
+ 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 * 10, Item.knockBack, player.whoAmI, 0, throwCount);
}
}
-
- public override void OnHitPvp(Player player, Player target, Player.HurtInfo hurtInfo)
+ public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback)
{
- target.AddBuff(ModContent.BuffType(), 360);
- target.AddBuff(ModContent.BuffType(), 720);
- SoundEngine.PlaySound(SoundID.Item14, target.Center);
+ 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().
AddIngredient().
AddIngredient().
- AddIngredient(ItemID.SoulofFright, 5).
+ AddRecipeGroup("AnyMythrilBar", 5).
+ AddIngredient(8).
AddTile(TileID.MythrilAnvil).
Register();
}
diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson
index 3c9c78f225..5b2214c354 100644
--- a/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson
+++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Melee.hjson
@@ -312,3 +312,4 @@ WulfrumScrewdriverProj.DisplayName: Wulfrum Screwdriver
YinYoDark.DisplayName: Dark Shard
YinYoLight.DisplayName: Light Shard
BladecrestOathswordThrownBlade.DisplayName: Bladecrest Oathsword Thrown Blade
+ForbiddenOathbladeThrownBlade.DisplayName: Forbidden Oathblade Thrown Blade
diff --git a/Localization/en-US/Mods.CalamityMod.UI.hjson b/Localization/en-US/Mods.CalamityMod.UI.hjson
index 902880a5fa..d396cb2598 100644
--- a/Localization/en-US/Mods.CalamityMod.UI.hjson
+++ b/Localization/en-US/Mods.CalamityMod.UI.hjson
@@ -100,6 +100,8 @@ Cooldowns: {
HellbornShots: Hellborn Shots
HolyProtection: Holy Protection
InkBomb: Ink Bomb Cooldown
+ KillModeActive: Kill Mode Active
+ KillModeCooldown: Kill Mode Cooldown
LifeSteal: Life Steal Cooldown
LionHeartShield: Energy Shell Cooldown
MasterChefShieldDurability: MJOLNIR Shield Level
diff --git a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs
index bd2b8737e8..b99150bbcb 100644
--- a/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs
+++ b/Projectiles/BaseProjectiles/BaseCustomUseStyleProjectile.cs
@@ -66,6 +66,11 @@ namespace CalamityMod.Projectiles.BaseProjectiles
///
public bool FlipAsSword = false;
+ ///
+ /// If true, the sword will be active reguardless of the player being in an item use state.
+ ///
+ public bool IgnoreActiveAnimation = false;
+
///
/// The offset in radians of the weapon's rotation from its current rotation.
///
@@ -164,7 +169,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
{
bool ItemAnimationActive = Owner.ItemAnimationActive;
- if (Owner.HeldItem.type != AssignedItemID)
+ if (Owner.HeldItem.type != AssignedItemID || Owner.dead)
{
Projectile.Kill();
}
@@ -172,7 +177,7 @@ namespace CalamityMod.Projectiles.BaseProjectiles
Owner.Calamity().mouseWorldListener = true;
Owner.Calamity().rightClickListener = true;
- if (ItemAnimationActive)
+ if (ItemAnimationActive || IgnoreActiveAnimation)
{
Animation++;
diff --git a/Projectiles/Melee/BladecrestOathswordThrownBlade.cs b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs
index 10088a4f6f..c7944bdd31 100644
--- a/Projectiles/Melee/BladecrestOathswordThrownBlade.cs
+++ b/Projectiles/Melee/BladecrestOathswordThrownBlade.cs
@@ -115,7 +115,7 @@ namespace CalamityMod.Projectiles.Melee
}
Projectile.Center = stabbedTarget.Center + impalePos;
- if ((stabbedTarget.life <= 0) || stabbedTarget == null || Projectile.localAI[0] == 5)
+ if ((stabbedTarget.life <= 0) || stabbedTarget == null || Projectile.localAI[0] == 5 || !stabbedTarget.active)
{
Projectile.timeLeft = Lifetime;
stabbedTarget.Calamity().demonSwordImpales--;
@@ -184,19 +184,17 @@ namespace CalamityMod.Projectiles.Melee
if (Projectile.timeLeft > Lifetime - fadeOutTime)
Projectile.timeLeft = Lifetime - fadeOutTime;
Projectile.Opacity = Utils.GetLerpValue(0, Lifetime - fadeOutTime, Projectile.timeLeft, true);
- for (int i = 0; i < 2; i++)
+
+ Vector2 dustVel = new Vector2(10, 10).RotatedByRandom(Math.PI) * Main.rand.NextFloat(0.2f, 1f) * Projectile.Opacity;
+ if (Main.rand.NextBool(4))
{
- 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.Red : Color.Crimson;
- dust.noLight = true;
- dust.noLightEmittence = true;
- dust.alpha = 100;
- dust.velocity += Projectile.velocity;
- }
+ 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.Red : Color.Crimson;
+ dust.noLight = true;
+ dust.noLightEmittence = true;
+ dust.alpha = 100;
+ dust.velocity += Projectile.velocity;
}
}
public void throwAnimation()
@@ -225,6 +223,8 @@ namespace CalamityMod.Projectiles.Melee
Projectile.ai[2] = target.whoAmI;
+ if (target.Calamity().demonSwordImpales < 0)
+ target.Calamity().demonSwordImpales = 0;
if (target.Calamity().demonSwordImpales >= 3)
{
float bladeValue = -1;
@@ -310,7 +310,7 @@ namespace CalamityMod.Projectiles.Melee
}
public override bool? CanDamage()
{
- if (ChargeProgress < 1 || fadingOut || stuckInGround || stuckInTarget)
+ if (ChargeProgress < 1 || fadingOut || stuckInGround || stuckInTarget || (Projectile.numHits > 0 && !exitedTarget))
return false;
return base.CanDamage();
diff --git a/Projectiles/Melee/ForbiddenOathbladeHoldout.cs b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs
new file mode 100644
index 0000000000..cad09fb0ae
--- /dev/null
+++ b/Projectiles/Melee/ForbiddenOathbladeHoldout.cs
@@ -0,0 +1,315 @@
+using System;
+using CalamityMod.Buffs.StatDebuffs;
+using CalamityMod.Cooldowns;
+using CalamityMod.Dusts;
+using CalamityMod.Items.Weapons.Melee;
+using CalamityMod.Particles;
+using CalamityMod.Projectiles.BaseProjectiles;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using ReLogic.Content;
+using Terraria;
+using Terraria.Audio;
+using Terraria.DataStructures;
+using Terraria.ID;
+using Terraria.Localization;
+using Terraria.ModLoader;
+
+namespace CalamityMod.Projectiles.Melee
+{
+ public class ForbiddenOathbladeHoldout : BaseCustomUseStyleProjectile, ILocalizedModType
+ {
+ public override int AssignedItemID => ModContent.ItemType();
+
+ public override LocalizedText DisplayName => CalamityUtils.GetItemName();
+ public override string Texture => "CalamityMod/Items/Weapons/Melee/ForbiddenOathblade";
+ public float hitboxMult = 1.3f;
+ public override float HitboxOutset => 60;
+
+ public override Vector2 HitboxSize => new Vector2(120, 120) * hitboxMult;
+ public override float HitboxRotationOffset => MathHelper.ToRadians(-45);
+
+ public override Vector2 SpriteOrigin => new(-3, 74);
+ 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 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 = Owner.itemAnimationMax;
+ 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 UseStyle()
+ {
+ bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD);
+
+ if ((Main.mouseLeft || (hasKillMode && killModeCD.timeLeft == KillMode.cooldownMax + 1)) && holding && postSwingCooldown == 0)
+ {
+ Animation = (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();
+ 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;
+ if (!Owner.Calamity().demonSwordKillMode && postSwingCooldown == 0)
+ {
+ willDie = true;
+ }
+
+ 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);
+
+ 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.4f, 0.5f) }, 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 < 4; i++)
+ {
+ Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(123, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f));
+ dust.noGravity = true;
+ dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet;
+ }
+ float randRot = Main.rand.NextFloat(-30, -60);
+ Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot));
+ Vector2 placement = Owner.Center + (new Vector2(123, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f));
+ GeneralParticleHandler.SpawnParticle(new CustomSpark(placement, dustVel, "CalamityMod/Particles/DemonSigilParticle", false, 23, Main.rand.NextFloat(0.23f, 0.36f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet, new Vector2(1, 1), shrinkSpeed: 0.2f));
+ }
+ }
+ }
+
+ 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;
+
+ bool hasKillMode = Owner.Calamity().cooldowns.TryGetValue(KillMode.ID, out CooldownInstance killModeCD);
+
+ target.AddBuff(BuffID.ShadowFlame, 300);
+
+ Vector2 launchVel = Utils.DirectionTo(Owner.Center, Owner.Calamity().mouseWorld);
+ CalamityUtils.MoveNPC(target, launchVel, 12, 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);
+ 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 = (launchVel * 25).RotatedBy(variance) * Main.rand.NextFloat(0.3f, 1f) * (1 - Math.Abs(variance));
+ dust2.noGravity = true;
+ dust2.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet;
+ }
+
+ 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), 1f, 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.5f, 18, true);
+ GeneralParticleHandler.SpawnParticle(blastRing2);
+ }
+
+ for (int x = 0; x < Main.maxProjectiles; x++)
+ {
+ Projectile projectile = Main.projectile[x];
+ if (projectile.owner == Projectile.owner && projectile.type == ModContent.ProjectileType() && projectile.ai[2] == target.whoAmI)
+ {
+ projectile.localAI[0] = 5;
+ projectile.velocity = (launchVel * 16.5f).RotatedByRandom(0.2f);
+ Owner.Calamity().demonSwordKillMode = true;
+ if (hasKillMode)
+ killModeCD.timeLeft = KillMode.cooldownMax + KillMode.buffMax;
+ Owner.Calamity().killModeCooldown = KillMode.cooldownMax + KillMode.buffMax;
+ }
+ }
+
+ if (Projectile.numHits == 0)
+ {
+ Owner.Calamity().GeneralScreenShakePower = 5.5f;
+ for (int i = 0; i < 4; 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, Color.MediumOrchid, new Vector2(1.5f, 1), extraRotation: MathHelper.ToRadians(i % 2 == 0 ? 90 : 0), shrinkSpeed: (i % 2 == 0 ? -0.8f : 0.8f)));
+
+
+ SoundStyle swing = new("CalamityMod/Sounds/Item/DemonSwordStrongImpact");
+ SoundEngine.PlaySound(swing with { Volume = 1f, Pitch = MathHelper.Clamp(swingCount * 0.05f, -0.1f, 0.65f) }, Projectile.Center);
+ }
+ }
+ public override void ModifyHitNPC(NPC target, ref NPC.HitModifiers modifiers)
+ {
+ float minMult = 0.3f;
+ int hitsToMinMult = 7;
+ 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.
+ if ((useAnim > 0 || DrawUnconditionally))
+ {
+ Asset tex = ModContent.Request(Texture);
+ Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge");
+
+ float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f;
+ float deathFade = willDie ? Utils.GetLerpValue(0, postSwingCooldownMax, postSwingCooldown, true) : 1;
+
+ for (int i = 0; i < 20; i++)
+ {
+ Color auraColor = Color.MediumOrchid with { A = 0 } * 0.18f * (willDie ? deathFade : fadeIn);
+ Vector2 drawOffset = (MathHelper.TwoPi * i / 20f).ToRotationVector2() * 6 * (willDie ? (1 - deathFade) * 2 : fadeIn);
+ Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), 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));
+ }
+
+ Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.BlueViolet with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.29f * 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/ForbiddenOathbladeThrownBlade.cs b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs
new file mode 100644
index 0000000000..29b669a854
--- /dev/null
+++ b/Projectiles/Melee/ForbiddenOathbladeThrownBlade.cs
@@ -0,0 +1,347 @@
+using System;
+using CalamityMod.Dusts;
+using CalamityMod.Particles;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Terraria;
+using Terraria.Audio;
+using Terraria.ID;
+using Terraria.ModLoader;
+using static CalamityMod.CalamityUtils;
+
+namespace CalamityMod.Projectiles.Melee
+{
+ public class ForbiddenOathbladeThrownBlade : ModProjectile, ILocalizedModType
+ {
+ public new string LocalizationCategory => "Projectiles.Melee";
+ public override string Texture => "CalamityMod/Items/Weapons/Melee/ForbiddenOathblade";
+
+ public int ChargeupTime => (int)Projectile.localAI[2];
+ public int Lifetime = 120;
+ 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 bool thrown = false;
+ public int fadeOutTime = 80;
+ 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 = 12;
+ Projectile.height = 12;
+ Projectile.friendly = true;
+ Projectile.tileCollide = false;
+ Projectile.penetrate = -1;
+ Projectile.timeLeft = Lifetime + ChargeupTime;
+ Projectile.DamageType = DamageClass.Melee;
+ Projectile.usesLocalNPCImmunity = true;
+ Projectile.localNPCHitCooldown = -1;
+ }
+
+ 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.5f);
+
+ 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 * 12f;
+ Projectile.spriteDirection = Projectile.direction;
+ thrown = true;
+ time = 0;
+ Projectile.extraUpdates = 1;
+ Projectile.tileCollide = true;
+ }
+
+ 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)
+ 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.tileCollide = 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)
+ {
+ if (Projectile.velocity.Y < 14 && Projectile.timeLeft < (bounces == 1 ? Lifetime - 20 : Lifetime))
+ Projectile.velocity.Y += 0.1f * (bounces * 3);
+ Projectile.ai[2] = 0;
+ }
+
+ 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(90 * (i == 0 ? 1 : -1))).RotatedByRandom(0.1f) * Main.rand.NextFloat(3, 4);
+ if (!exitedTarget && Main.rand.NextBool(3))
+ {
+ Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel * 60, ModContent.DustType(), dustVel, 0, default, Main.rand.NextFloat(0.9f, 1.1f));
+ dust.noGravity = true;
+ dust.color = Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet;
+ dust.noLight = true;
+ dust.noLightEmittence = true;
+ dust.alpha = 50;
+ }
+ if (exitedTarget && i == 0)
+ {
+ Dust dust = Dust.NewDustPerfect(Projectile.Center + safeVel.RotatedBy(Projectile.rotation - MathHelper.ToRadians(Projectile.direction * 45)) * 45, 278, dustVel * Main.rand.NextFloat(1, 4), 0, default, Main.rand.NextFloat(0.4f, 0.6f));
+ dust.noGravity = true;
+ dust.color = Main.rand.NextBool() ? Color.MediumOrchid : 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 : Color.BlueViolet;
+ 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) * -55f * 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)
+ {
+ target.AddBuff(BuffID.ShadowFlame, 180);
+ 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 >= 3)
+ {
+ 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.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.velocity = Projectile.velocity.RotatedByRandom(0.12f);
+
+ for (int i = 0; i < 10; i++)
+ {
+ Particle spark2 = new SparkParticle(target.Center, Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.2f, 1.5f), false, 45, Main.rand.NextFloat(0.3f, 1f), Main.rand.NextBool() ? Color.MediumOrchid : Color.BlueViolet);
+ GeneralParticleHandler.SpawnParticle(spark2);
+
+ Dust dust = Dust.NewDustPerfect(Projectile.Center, ModContent.DustType(), Projectile.velocity.RotatedByRandom(0.5) * Main.rand.NextFloat(0.3f, 1f), 0, default, Main.rand.NextFloat(1.3f, 1.6f));
+ dust.noGravity = true;
+ dust.noLight = true;
+ dust.color = Main.rand.NextBool() ? Color.MediumOrchid : 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.4f;
+ int hitsToMinMult = 8;
+ 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;
+ 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) => CalamityUtils.CircularHitboxCollision(Projectile.Center, Projectile.width / (exitedTarget ? 0.5f : 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/ForbiddenOathblade").Value;
+ Vector2 generalDrawPos = Projectile.Center - Main.screenPosition;
+
+ 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);
+ }
+
+ Main.EntitySpriteDraw(centerTexture, Projectile.Center - Main.screenPosition, null, Color.Lerp(Color.Red 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/GrandDadHoldout.cs b/Projectiles/Melee/GrandDadHoldout.cs
index 990ad619e9..c6f126501a 100644
--- a/Projectiles/Melee/GrandDadHoldout.cs
+++ b/Projectiles/Melee/GrandDadHoldout.cs
@@ -38,6 +38,7 @@ namespace CalamityMod.Projectiles.Melee
public int useAnim;
public int swingCount;
public bool finalFlip = false;
+ public bool swingSound = true;
public override void SetDefaults()
{
base.SetDefaults();
@@ -76,9 +77,9 @@ namespace CalamityMod.Projectiles.Melee
}
if (CanHit)
- fadeIn = MathHelper.Lerp(fadeIn, 1, 0.1f);
+ fadeIn = MathHelper.Lerp(fadeIn, 1, 0.3f);
else
- fadeIn = MathHelper.Lerp(fadeIn, 0, 0.15f);
+ fadeIn = MathHelper.Lerp(fadeIn, 0, 0.35f);
if (!doSwing)
@@ -97,6 +98,7 @@ namespace CalamityMod.Projectiles.Melee
doSwing = true;
swingCount++;
finalFlip = false;
+ swingSound = true;
}
else
{
@@ -114,7 +116,7 @@ namespace CalamityMod.Projectiles.Melee
Projectile.rotation = Projectile.rotation.AngleLerp(Owner.AngleTo(mousePos) + MathHelper.ToRadians(45f), 0.1f);
- if (AnimationProgress < (useAnim / 3))
+ if (AnimationProgress < (useAnim / 1.5f))
{
aimVel = (Owner.Center - Owner.Calamity().mouseWorld).SafeNormalize(Vector2.UnitX) * 65;
CanHit = false;
@@ -124,7 +126,7 @@ namespace CalamityMod.Projectiles.Melee
doSwing = false;
Projectile.ai[1] = -Projectile.ai[1];
}
- RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction), 0.2f);
+ RotationOffset = MathHelper.Lerp(RotationOffset, MathHelper.ToRadians(120f * Projectile.ai[1] * Owner.direction * (1 + (Utils.GetLerpValue(useAnim * 0.8f, useAnim, Animation, true)) * 0.35f)), 0.2f);
}
else
{
@@ -136,10 +138,11 @@ namespace CalamityMod.Projectiles.Melee
float time = (AnimationProgress) - (useAnim / 3);
float timeMax = useAnim - (useAnim / 3);
- if (time == (int)(timeMax * 0.4f))
+ if (time >= (int)(timeMax * 0.4f) && swingSound)
{
SoundStyle fire = new("CalamityMod/Sounds/Item/HeavySwing");
SoundEngine.PlaySound(fire with { Volume = 0.8f, Pitch = Main.rand.NextFloat(0.2f, 0.32f) }, Projectile.Center);
+ swingSound = false;
}
if ( time > (int)(timeMax * 0.4f) && time < (int)(timeMax * 0.7f))
{
@@ -286,6 +289,10 @@ namespace CalamityMod.Projectiles.Melee
float r = FlipAsSword ? MathHelper.ToRadians(90) : 0f;
+ Asset swoosh = ModContent.Request("CalamityMod/Particles/VerticalSmearLarge");
+ if (Animation > useAnim * 0.2f)
+ Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.DodgerBlue with { A = 0 } * fadeIn * 0.65f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -90 : 90) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.6f, SpriteEffects.None);
+
for (int i = 0; i < 25; i++)
{
Texture2D centerTexture = ModContent.Request("CalamityMod/Projectiles/Melee/GrandDadGhost").Value;
diff --git a/Projectiles/Melee/OldLordClaymoreHoldout.cs b/Projectiles/Melee/OldLordClaymoreHoldout.cs
index fdd52af749..914f90b213 100644
--- a/Projectiles/Melee/OldLordClaymoreHoldout.cs
+++ b/Projectiles/Melee/OldLordClaymoreHoldout.cs
@@ -25,7 +25,7 @@ namespace CalamityMod.Projectiles.Melee
public float hitboxMult = 1.3f;
public override float HitboxOutset => 60;
- public override Vector2 HitboxSize => new Vector2(105, 105) * hitboxMult * Projectile.scale;
+ public override Vector2 HitboxSize => new Vector2(105, 105) * hitboxMult;
public override float HitboxRotationOffset => MathHelper.ToRadians(-45);
public override Vector2 SpriteOrigin => new(-3, 70);
@@ -49,7 +49,7 @@ namespace CalamityMod.Projectiles.Melee
{
CanHit = false;
Projectile.knockBack = 0;
- Projectile.scale = 1;
+ Projectile.scale = 1.15f; // Needs to be slightly bigger for viablility
Projectile.ai[1] = -1;
base.OnSpawn(source);
// 14NOV2024: Ozzatron: clamped mouse position unnecessary, only used for direction
@@ -147,17 +147,7 @@ namespace CalamityMod.Projectiles.Melee
playSwingSound = false;
}
if (time > (int)(timeMax * 0.2f) && time < (int)(timeMax * 0.75f))
- {
CanHit = true;
-
- Vector2 particleVel = new Vector2(0, 10 * -Projectile.ai[1] * Owner.direction).RotatedBy(FinalRotation + MathHelper.ToRadians(-45));
- Vector2 particlePos = Owner.Center + (new Vector2(Main.rand.Next(10, 90), 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)));
-
- Dust dust = Dust.NewDustPerfect(particlePos, 79);
- dust.noGravity = true;
- dust.scale = Main.rand.NextFloat(0.85f, 1.3f);
- dust.velocity = -particleVel.RotatedByRandom(0.2f);
- }
else
CanHit = false;
@@ -173,14 +163,14 @@ namespace CalamityMod.Projectiles.Melee
{
for (int i = 0; i < 4; i++)
{
- Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f));
+ Dust dust = Dust.NewDustPerfect(Owner.Center + (new Vector2(115, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), ModContent.DustType(), Vector2.One.RotatedByRandom(MathHelper.Pi) * 0.6f, 0, default, Main.rand.NextFloat(1.15f, 1.5f));
dust.noGravity = true;
dust.color = Main.rand.NextBool() ? Color.Orange :Color.OrangeRed;
}
float randRot = Main.rand.NextFloat(-30, -60);
Vector2 dustVel = (new Vector2(0, 8 * -Projectile.ai[1] * Owner.direction)).RotatedBy(FinalRotation + MathHelper.ToRadians(randRot));
- GeneralParticleHandler.SpawnParticle(new SparkParticle(Owner.Center + (new Vector2(100, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), dustVel, false, 23, Main.rand.NextFloat(0.4f, 0.8f), Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed));
+ GeneralParticleHandler.SpawnParticle(new SparkParticle(Owner.Center + (new Vector2(115, 0).RotatedBy(FinalRotation + MathHelper.ToRadians(-45)).RotatedByRandom(0.3f)), dustVel, false, 23, Main.rand.NextFloat(0.4f, 0.8f), Main.rand.NextBool(4) ? Color.Orange : Color.OrangeRed));
}
}
}
@@ -210,8 +200,6 @@ namespace CalamityMod.Projectiles.Melee
dust2.color = Main.rand.NextBool() ? Color.Orange : Color.OrangeRed;
}
-
- float bladeValue = -1;
for (int x = 0; x < Main.maxProjectiles; x++)
{
Projectile projectile = Main.projectile[x];
@@ -255,7 +243,7 @@ namespace CalamityMod.Projectiles.Melee
Main.EntitySpriteDraw(tex.Value, Projectile.Center - Main.screenPosition + drawOffset + new Vector2(0, Owner.gfxOffY), 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));
}
- Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.Orange with { A = 0 } * fadeIn * 0.2f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -95 : 95) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.33f * hitboxMult, SpriteEffects.None);
+ //Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.Orange with { A = 0 } * (float)Math.Pow(fadeIn, 20) * 0.2f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(-Projectile.ai[1] * 95 * fadeIn) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.33f * hitboxMult, SpriteEffects.None);
Main.EntitySpriteDraw(swoosh.Value, Projectile.Center - Main.screenPosition + new Vector2(0, Owner.gfxOffY), null, Color.OrangeRed with { A = 0 } * fadeIn * 0.5f, (FinalRotation + MathHelper.ToRadians(45)) + MathHelper.ToRadians(Projectile.ai[1] == 1 ? -70 : 70) * -Owner.direction, swoosh.Size() * 0.5f, Projectile.scale * 0.25f * hitboxMult, SpriteEffects.None);
diff --git a/Sounds/Item/DemonSwordKillModeOffCooldown.ogg b/Sounds/Item/DemonSwordKillModeOffCooldown.ogg
new file mode 100644
index 0000000000..4b045acde7
Binary files /dev/null and b/Sounds/Item/DemonSwordKillModeOffCooldown.ogg differ
diff --git a/Systems/Collections/PierceResistExceptionList.cs b/Systems/Collections/PierceResistExceptionList.cs
index dc85e6fabe..c98d800718 100644
--- a/Systems/Collections/PierceResistExceptionList.cs
+++ b/Systems/Collections/PierceResistExceptionList.cs
@@ -53,6 +53,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 10d8eca909..00fd5f5ebc 100644
--- a/Systems/Collections/ProjectileDestroyExceptionsList.cs
+++ b/Systems/Collections/ProjectileDestroyExceptionsList.cs
@@ -66,6 +66,7 @@ namespace CalamityMod.Systems.Collections
ProjectileType(),
ProjectileType(),
ProjectileType(),
+ ProjectileType(),
ProjectileType(),
ProjectileType(),
ProjectileType(),