From 56e6d243368e84a1b6d25cd62320b4354322b025 Mon Sep 17 00:00:00 2001 From: Xyk Date: Tue, 13 Jan 2026 11:41:35 -0800 Subject: [PATCH] Minion fixes --- Items/Weapons/Summon/DazzlingStabberStaff.cs | 30 +++++++++++++++----- Items/Weapons/Summon/SeashineHilt.cs | 17 +++++++++-- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/Items/Weapons/Summon/DazzlingStabberStaff.cs b/Items/Weapons/Summon/DazzlingStabberStaff.cs index 86f2e16692..2eb6396a97 100644 --- a/Items/Weapons/Summon/DazzlingStabberStaff.cs +++ b/Items/Weapons/Summon/DazzlingStabberStaff.cs @@ -39,27 +39,43 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + float usedMinionSlots = 0; + foreach (var minions in Main.ActiveProjectiles) + { + if (minions.owner == player.whoAmI) + usedMinionSlots += minions.minionSlots; + } + bool hasSlotsForSummon = true; + if (usedMinionSlots + 1 > player.maxMinions) + hasSlotsForSummon = false; + player.AddBuff(Item.buffType, 2); - for (int i = 0; i < 3; i++) + int projCount = player.ownedProjectileCounts[type] + (hasSlotsForSummon ? 3 : 0); + if (hasSlotsForSummon) { - var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); - minion.originalDamage = Item.damage; + for (int i = 0; i < 3; i++) + { + var minion = Projectile.NewProjectileDirect(source, player.ClampedMouseWorld(), Vector2.Zero, type, damage, knockback, player.whoAmI, 0, 0, i + 1); + minion.originalDamage = Item.damage; + } } float angleMax = MathHelper.ToRadians(360f); - if (player.ownedProjectileCounts[type] == 1) + if (projCount == 100) angleMax = 0f; float index = 1f; - if (player.ownedProjectileCounts[Item.shoot] > 30) + if (projCount > 30) { - angleMax += MathHelper.ToRadians((player.ownedProjectileCounts[Item.shoot] - 30) * 2.5f); + angleMax += MathHelper.ToRadians((projCount - 30) * 2.5f); } angleMax = angleMax > MathHelper.ToRadians(360f) ? MathHelper.ToRadians(360f) : angleMax; // More intuitive than using a min function foreach (Projectile p in Main.ActiveProjectiles) { if (p.type == type && p.owner == player.whoAmI) { - p.ai[1] = index / player.ownedProjectileCounts[type] * angleMax - angleMax / 2f; + int adjustedProjCount = (int)(projCount); + Main.NewText("index: " + index.ToString() + " | projCount: " + adjustedProjCount.ToString() + " | angleMax: " + angleMax.ToString()); + p.ai[1] = index / adjustedProjCount * angleMax - angleMax / 2f; p.netUpdate = true; index++; } diff --git a/Items/Weapons/Summon/SeashineHilt.cs b/Items/Weapons/Summon/SeashineHilt.cs index 347289457d..312100f28f 100644 --- a/Items/Weapons/Summon/SeashineHilt.cs +++ b/Items/Weapons/Summon/SeashineHilt.cs @@ -47,7 +47,7 @@ namespace CalamityMod.Items.Weapons.Summon // There's a long cooldown on commanding blades // This is so you don't just hold down right click, since now it's optimal to only command blades when all are ready if (player.altFunctionUse == 2) - return 0.1f; + return 0.37f; else return 1f; } @@ -57,6 +57,17 @@ namespace CalamityMod.Items.Weapons.Summon } public override bool Shoot(Player player, EntitySource_ItemUse_WithAmmo source, Vector2 position, Vector2 velocity, int type, int damage, float knockback) { + float usedMinionSlots = 0; + foreach (var minions in Main.ActiveProjectiles) + { + if (minions.owner == player.whoAmI) + usedMinionSlots += minions.minionSlots; + } + bool hasSlotsForSummon = true; + if (usedMinionSlots + 1 > player.maxMinions) + hasSlotsForSummon = false; + + // Call all active blades to attack if they are charged // The check to see if a blade is charged is done in the blade itself if (player.altFunctionUse == 2) @@ -89,7 +100,7 @@ namespace CalamityMod.Items.Weapons.Summon SoundEngine.PlaySound(SoundID.Item101 with { Volume = 0.9f, Pitch = Main.rand.NextFloat(0.3f, 0.5f) }, player.Center); } } - else // Toss out the summon + else if (hasSlotsForSummon) // Toss out the summon { player.AddBuff(Item.buffType, 2); SoundEngine.PlaySound(SoundID.Item1, player.Center); @@ -117,6 +128,8 @@ namespace CalamityMod.Items.Weapons.Summon } } } + + return false; } public override void UseItemFrame(Player player) // Player hand animation when you command the blades