From ae4afc46c9a2b479dfffc24dda462ad6b5e6646c Mon Sep 17 00:00:00 2001 From: doze-zoze Date: Wed, 11 Mar 2026 21:12:44 -0500 Subject: [PATCH 1/3] supernova cookable test --- Items/Weapons/Rogue/Supernova.cs | 18 +-- .../Mods.CalamityMod.Projectiles.Rogue.hjson | 1 + Projectiles/Rogue/SupernovaHoldout.cs | 120 ++++++++++++++++++ 3 files changed, 127 insertions(+), 12 deletions(-) create mode 100644 Projectiles/Rogue/SupernovaHoldout.cs diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index abcaa7fee0..911bd3ab8d 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -14,6 +14,7 @@ namespace CalamityMod.Items.Weapons.Rogue { public class Supernova : RogueWeapon { + public static float StealthTimeInSeconds => 2f; public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Item/SupernovaBoom") { Volume = 0.9f }; public static readonly SoundStyle StealthExplosionSound = new("CalamityMod/Sounds/Item/SupernovaStealthExplode") { Volume = 1f }; public static readonly SoundStyle StealthChargeSound = new("CalamityMod/Sounds/Item/SupernovaStealthCharge") { Volume = 1f }; @@ -31,26 +32,19 @@ namespace CalamityMod.Items.Weapons.Rogue Item.UseSound = SoundID.Item1; Item.autoReuse = true; Item.value = CalamityGlobalItem.RarityVioletBuyPrice; - Item.shoot = ModContent.ProjectileType(); + Item.shoot = ModContent.ProjectileType(); Item.shootSpeed = 16f; Item.DamageType = RogueDamageClass.Instance; Item.rare = ModContent.RarityType(); + Item.channel = true; } public override float StealthDamageMultiplier => 0.7f; - public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) + public override void HoldItem(Player player) { - if (player.Calamity().StealthStrikeAvailable()) //setting the stealth strike - { - int stealth = Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - if (stealth.WithinBounds(Main.maxProjectiles)) - Main.projectile[stealth].Calamity().stealthStrike = true; - return false; - } - else - Projectile.NewProjectile(source, position, velocity, type, damage, knockback, player.whoAmI); - return false; + if (player.ownedProjectileCounts[Item.shoot] <= 0) + player.Calamity().rogueStealth = 0; } public override void PostDrawInWorld(SpriteBatch spriteBatch, Color lightColor, Color alphaColor, float rotation, float scale, int whoAmI) diff --git a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson index e8d01b227f..069e84ecc4 100644 --- a/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Projectiles.Rogue.hjson @@ -290,6 +290,7 @@ Stormfrontspark.DisplayName: Stormfront Spark SubductionFlameburst.DisplayName: Flame Pillar SubductionSlicerProj.DisplayName: Subduction Slicer SulphuricNukesplosion.DisplayName: Nuke +SupernovaHoldout.DisplayName: Supernova SupernovaBomb.DisplayName: Supernova Bomb SupernovaBoom.DisplayName: Micro Supernova SupernovaStealthBoom.DisplayName: Exo Supernova diff --git a/Projectiles/Rogue/SupernovaHoldout.cs b/Projectiles/Rogue/SupernovaHoldout.cs new file mode 100644 index 0000000000..1e621f53c8 --- /dev/null +++ b/Projectiles/Rogue/SupernovaHoldout.cs @@ -0,0 +1,120 @@ +using System; +using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Projectiles.BaseProjectiles; +using Microsoft.Xna.Framework; +using Terraria; +using Terraria.ModLoader; + +namespace CalamityMod.Projectiles.Rogue +{ + public class SupernovaHoldout : BaseSwordHoldoutProjectile, ILocalizedModType + { + public new string LocalizationCategory => "Projectiles.Rogue"; + public override string Texture => "CalamityMod/Items/Weapons/Rogue/Supernova"; + public override bool useMeleeSpeed => false; + public override bool useMeleeSize => false; + public override int swingWidth => 180; + public override Item BaseItem => ModContent.GetModItem(ModContent.ItemType()).Item; + public override int AfterImageLength => 0; + + public override int StartupTime { get; set; } + public override int CooldownTime { get; set; } + + int explodeTimer = 0; + + public override void Defaults() + { + Projectile.width = 106; + Projectile.height = 112; + Projectile.MaxUpdates = 4; + Projectile.noEnchantmentVisuals = true; + Projectile.DamageType = RogueDamageClass.Instance; + Projectile.ContinuouslyUpdateDamageStats = true; + } + public override void Spawn() + { + var player = Main.player[Projectile.owner]; + var modplayer = player.GetModPlayer(); + StartupTime = 50; + CooldownTime = 10; + swingTime -= StartupTime + CooldownTime; + OffsetDistance = 48; + modplayer.swingNum = 0; + RotateInStartup = 1; + Projectile.scale = 0.4f; + } + + public override void AdditionalAI() + { + Lighting.AddLight(Projectile.Center, new Vector3(1, 1, 1)); + var player = Main.player[Projectile.owner]; + var cplayer = player.Calamity(); + if (Projectile.Opacity > 0) + { + cplayer.temporaryStealthMax = 1.3f; + cplayer.temporaryStealthTimer = 2; + } + + var avgStealth = 0.8f * cplayer.stealthGenMoving + 0.2f * cplayer.stealthGenStandstill; + var explodeTimeGoal = CalamityUtils.SecondsToFrames(Supernova.StealthTimeInSeconds) / avgStealth + 30; + var stealthTime = explodeTimeGoal - 30; + + + cplayer.rogueStealth = Projectile.Opacity <= 0 ? 0 : Math.Max(cplayer.temporaryStealthMax, cplayer.rogueStealthMax) * MathHelper.Clamp(explodeTimer / stealthTime, 0f, 1f); + + if (player.channel && inStartup) + { + + if (timer >= StartupTime - 1) + { + if (Projectile.FinalExtraUpdate() && explodeTimer < explodeTimeGoal) + explodeTimer++; + timer--; + Projectile.timeLeft++; + } + } + if (explodeTimer >= explodeTimeGoal && inCooldown && !Projectile.FinalExtraUpdate()) + { + timer--; + Projectile.timeLeft++; + } + + if (inSwing) + { + if (swingTimer == (int)(swingTime * 0.75f)) + { + if (Projectile.owner == Main.myPlayer && Projectile.Opacity > 0) + { + var p = Projectile.NewProjectileDirect(Projectile.GetSource_FromThis(), Projectile.Center, angle * -16 * cplayer.rogueVelocity, ModContent.ProjectileType(), Projectile.damage, Projectile.knockBack, Projectile.owner); + if (player.Calamity().StealthStrikeAvailable()) + { + p.Calamity().stealthStrike = true; + } + } + Projectile.Opacity = 0; + } + } + } + + public override float SwingFunction() + { + if (inStartup) + { + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.2f, swingWidth * -0.5f, StartupCompletion)); + } + if (inCooldown) + return MathHelper.ToRadians(MathHelper.Lerp(swingWidth * 0.2f, swingWidth * 0.33f, 1 - MathF.Pow(1 - CooldownCompletion, 3f))); + return MathHelper.ToRadians(MathHelper.SmoothStep(swingWidth * -0.7f, swingWidth * 0.2f, SwingCompletion)); + } + + public override bool? CanHitNPC(NPC target) + { + return false; + } + + public override bool CanHitPlayer(Player target) + { + return false; + } + } +} From 11e750d86e0563f375e1e76711ccf9fa9f442082 Mon Sep 17 00:00:00 2001 From: doze-zoze Date: Wed, 11 Mar 2026 22:42:27 -0500 Subject: [PATCH 2/3] right-click spam, balancing --- Items/Weapons/Rogue/Supernova.cs | 7 +++++-- .../en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson | 2 ++ Projectiles/Rogue/SupernovaHoldout.cs | 12 +++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index 911bd3ab8d..de6131f848 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -22,7 +22,7 @@ namespace CalamityMod.Items.Weapons.Rogue { Item.width = 106; Item.height = 112; - Item.damage = 5036; + Item.damage = 5200; Item.noMelee = true; Item.noUseGraphic = true; Item.useAnimation = 70; @@ -37,9 +37,12 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; Item.rare = ModContent.RarityType(); Item.channel = true; + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } - public override float StealthDamageMultiplier => 0.7f; + public override bool AltFunctionUse(Player player) => true; + + public override float StealthDamageMultiplier => 0.8f; public override void HoldItem(Player player) { diff --git a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson index 16c707b5c7..ea7c30fbdf 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Weapons.Rogue.hjson @@ -1161,6 +1161,8 @@ Supernova: { DisplayName: Supernova Tooltip: ''' + Disables normal stealth generation + Hold to generate stealth, or hold to toss the bomb without generating stealth Tosses a smart bomb that locks onto and tracks targets If no target is found it will return to you Each bomb creates a miniature supernova that drags in weak enemies and chases strong enemies diff --git a/Projectiles/Rogue/SupernovaHoldout.cs b/Projectiles/Rogue/SupernovaHoldout.cs index 1e621f53c8..8236645ea8 100644 --- a/Projectiles/Rogue/SupernovaHoldout.cs +++ b/Projectiles/Rogue/SupernovaHoldout.cs @@ -1,8 +1,10 @@ using System; using CalamityMod.Items.Weapons.Rogue; +using CalamityMod.Particles; using CalamityMod.Projectiles.BaseProjectiles; using Microsoft.Xna.Framework; using Terraria; +using Terraria.ID; using Terraria.ModLoader; namespace CalamityMod.Projectiles.Rogue @@ -31,7 +33,15 @@ namespace CalamityMod.Projectiles.Rogue Projectile.DamageType = RogueDamageClass.Instance; Projectile.ContinuouslyUpdateDamageStats = true; } - public override void Spawn() + + public Color randomColor => Main.rand.Next(4) switch + { + 0 => Color.Red, + 1 => Color.MediumTurquoise, + 2 => Color.Orange, + _ => Color.LawnGreen, + }; + public override void Spawn() { var player = Main.player[Projectile.owner]; var modplayer = player.GetModPlayer(); From 0bd4a99666bb933d8d6c8a7ba105adac214982a4 Mon Sep 17 00:00:00 2001 From: doze-zoze Date: Thu, 12 Mar 2026 14:45:48 -0500 Subject: [PATCH 3/3] fixed right click autouse being in the wrong spot --- Items/Weapons/Rogue/Supernova.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Items/Weapons/Rogue/Supernova.cs b/Items/Weapons/Rogue/Supernova.cs index de6131f848..0f67b61514 100644 --- a/Items/Weapons/Rogue/Supernova.cs +++ b/Items/Weapons/Rogue/Supernova.cs @@ -18,6 +18,11 @@ namespace CalamityMod.Items.Weapons.Rogue public static readonly SoundStyle ExplosionSound = new("CalamityMod/Sounds/Item/SupernovaBoom") { Volume = 0.9f }; public static readonly SoundStyle StealthExplosionSound = new("CalamityMod/Sounds/Item/SupernovaStealthExplode") { Volume = 1f }; public static readonly SoundStyle StealthChargeSound = new("CalamityMod/Sounds/Item/SupernovaStealthCharge") { Volume = 1f }; + + public override void SetStaticDefaults() + { + ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; + } public override void SetDefaults() { Item.width = 106; @@ -37,7 +42,6 @@ namespace CalamityMod.Items.Weapons.Rogue Item.DamageType = RogueDamageClass.Instance; Item.rare = ModContent.RarityType(); Item.channel = true; - ItemID.Sets.ItemsThatAllowRepeatedRightClick[Type] = true; } public override bool AltFunctionUse(Player player) => true;