From 1881c8ef7c6c3415906e7d65cb11b3f1d38b43f7 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Mon, 9 Jun 2025 11:58:37 -0500 Subject: [PATCH 1/3] pt1 --- CalPlayer/CalamityPlayer.cs | 20 +++++--- CalPlayer/CalamityPlayerMiscEffects.cs | 17 ------- CalPlayer/CalamityPlayerOnHit.cs | 23 +++------ DataStructures/SummonTag.cs | 7 +++ Items/Armor/ForbiddenCirclet.cs | 50 ++++++++++++++++++- .../en-US/Mods.CalamityMod.Buffs.hjson | 5 ++ Projectiles/Rogue/CircletMark.cs | 2 +- Projectiles/Summon/ForbiddenCircletEater.cs | 1 + Utilities/ProjectileUtils.cs | 2 +- 9 files changed, 83 insertions(+), 44 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 1f7e29d431..2dbffbdd25 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -3915,9 +3915,8 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(PlagueReaperMask.ActivationSound, Player.Center); Player.AddCooldown(PlagueBlackout.ID, 1800); } - if (forbiddenCirclet && forbiddenCooldown <= 0) + if (forbiddenCirclet && Player.ownedProjectileCounts[ModContent.ProjectileType()] < 2) { - forbiddenCooldown = 45; int stormMana = (int)(ForbiddenCirclet.manaCost * Player.manaCost); if (Player.statMana < stormMana) { @@ -3928,7 +3927,7 @@ namespace CalamityMod.CalPlayer } if (Player.statMana >= stormMana && !Player.silence) { - var source = Player.GetSource_Misc("1"); + var source = Player.GetSource_ItemUse(ContentSamples.ItemsByType[ItemType()]); Player.manaRegenDelay = (int)Player.maxRegenDelay; Player.statMana -= stormMana; @@ -3940,9 +3939,16 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { + if (Player.ownedProjectileCounts[ProjectileType()] > 0 ) + { + foreach (var item in Main.ActiveProjectiles) + { + if (item.owner != Player.whoAmI || item.type != ProjectileType()) + continue; + item.timeLeft = 60; + } + } int mark = Projectile.NewProjectile(source, Player.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), damage, kBack, Player.whoAmI); - if (mark.WithinBounds(Main.maxProjectiles)) - Main.projectile[mark].DamageType = DamageClass.Generic; } } } @@ -5403,8 +5409,8 @@ namespace CalamityMod.CalPlayer bool hasNonWeaponFunction = isPickaxe || isAxe || isHammer || isPlaced || isChannelable; bool playerUsingWeapon = hasDamage && hasHitboxes && !hasNonWeaponFunction; - // The Gem Tech armor's rogue crystal ensures that stealth is not consumed by non-rogue items. - if ((it.IsAir || !it.CountsAsClass()) && GemTechSet && GemTechState.IsRedGemActive) + // The Gem Tech armor's rogue crystal ensures that stealth is not consumed by non-rogue items. Forbidden Circlet does this for summon weapons + if ((it.IsAir || (!it.CountsAsClass()) && GemTechSet && GemTechState.IsRedGemActive) || (it.CountsAsClass() && forbiddenCirclet)) playerUsingWeapon = false; // Molten Amputator consumes stealth in a special way diff --git a/CalPlayer/CalamityPlayerMiscEffects.cs b/CalPlayer/CalamityPlayerMiscEffects.cs index dc1d30416e..990ed86a37 100644 --- a/CalPlayer/CalamityPlayerMiscEffects.cs +++ b/CalPlayer/CalamityPlayerMiscEffects.cs @@ -4929,23 +4929,6 @@ namespace CalamityMod.CalPlayer #region Limits private void Limits() { - // TODO -- what is Forbidden Circlet actually supposed to do? - if (forbiddenCirclet) - { - ref StatModifier summon = ref Player.GetDamage(); - ref StatModifier rogue = ref Player.GetDamage(); - float boostToSummonFromRogue = 0f; - float boostToRogueFromSummon = 0f; - - if (summon.Additive < rogue.Additive) - boostToSummonFromRogue = rogue.Additive - summon.Additive; - if (rogue.Additive < summon.Additive) - boostToRogueFromSummon = summon.Additive - rogue.Additive; - - summon += boostToSummonFromRogue; - rogue += boostToRogueFromSummon; - } - // 10% is converted to 9%, 25% is converted to 20%, 50% is converted to 33%, 75% is converted to 43%, 100% is converted to 50% if (Player.endurance > 0f) Player.endurance = 1f - (1f / (1f + Player.endurance)); diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index 31b9ec0761..3d4c85a071 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -8,6 +8,7 @@ using CalamityMod.Buffs.StatDebuffs; using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Accessories; +using CalamityMod.Items.Armor; using CalamityMod.Items.Armor.Reaver; using CalamityMod.Items.Fishing.AstralCatches; using CalamityMod.Items.VanillaArmorChanges; @@ -414,6 +415,11 @@ namespace CalamityMod.CalPlayer globalProj.arcFlashCooldown = 90; } + if (forbiddenCirclet && globalProj.stealthStrike) + { + target.AddBuff(ModContent.BuffType(), 600); + } + if (!proj.npcProj && !proj.trap && proj.friendly) { if (plaguebringerCarapace && FriendlyBeesList.Includes(proj.type)) @@ -1125,23 +1131,6 @@ namespace CalamityMod.CalPlayer rogueCrownCooldown = spawnedFeathers ? 15 : 60; } - if (forbiddenCirclet && modProj.stealthStrike && forbiddenCooldown <= 0 && modProj.stealthStrikeHitCount < 3) - { - for (int index2 = 0; index2 < 6; index2++) - { - float xVector = Main.rand.Next(-35, 36) * 0.02f; - float yVector = Main.rand.Next(-35, 36) * 0.02f; - xVector *= 10f; - yVector *= 10f; - int damage = (int)Player.GetTotalDamage().ApplyTo(40); - - int eater = Projectile.NewProjectile(spawnSource, proj.Center.X, proj.Center.Y, xVector, yVector, ProjectileType(), damage, proj.knockBack, proj.owner); - if (eater.WithinBounds(Main.maxProjectiles)) - Main.projectile[eater].DamageType = DamageClass.Generic; - forbiddenCooldown = 15; - } - } - if (titanHeartSet && modProj.stealthStrike && titanCooldown <= 0 && modProj.stealthStrikeHitCount < 3) { int damage = (int)Player.GetTotalDamage().ApplyTo(40); diff --git a/DataStructures/SummonTag.cs b/DataStructures/SummonTag.cs index 61c2540ab0..23343fe0e4 100644 --- a/DataStructures/SummonTag.cs +++ b/DataStructures/SummonTag.cs @@ -113,6 +113,13 @@ namespace CalamityMod.DataStructures critChance += TagCritChance; modifiers.CritDamage += TagCritDamage; } + + /// + /// Blank tag damage functionality + /// + public static void BlankTagModifyHit(Projectile proj, NPC npc, ref NPC.HitModifiers modifiers, ref float tagDamageMult, ref float critChance) + { + } /// /// Due to how Firecracker works, this allows it to work with crit accessories. /// diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index f5566fca6f..92a6915c05 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -1,4 +1,7 @@ using CalamityMod.CalPlayer; +using CalamityMod.DataStructures; +using CalamityMod.Projectiles.Summon; +using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; using Terraria.ModLoader; @@ -13,10 +16,41 @@ namespace CalamityMod.Items.Armor public const int tornadoBaseDmg = 80; public const float tornadoBaseKB = 1f; + public static SummonTag summonTag = new SummonTag() + { + //These tag damage fields determine the damage of the spawned eater. The resulting number from each is added together + //So, 0.5 multiplicative and 10 flat would make the damage be 50% of the spawning hit's damage, plus 10 more. + //If you want entirely flt, set multiplicative to 0. If you want entirely multiplicative, set flat to 0. + MultiplicativeTagDamage = 0.25f, + FlatTagDamage = 5, + AllowsWhipStacking = true, + TagOnHit = tagOnHit, + TagModifyHitEffects = SummonTag.BlankTagModifyHit + }; + + public static void tagOnHit(NPC npc, Projectile projectile, NPC.HitInfo hit, int damageDone) + { + + if (Main.rand.NextBool(5)) + { + float xVector = Main.rand.Next(-35, 36) * 0.02f; + float yVector = Main.rand.Next(-35, 36) * 0.02f; + xVector *= 10f; + yVector *= 10f; + + int damage = (int)Main.player[projectile.owner].GetBestClassDamage().ApplyTo(damageDone * summonTag.MultiplicativeTagDamage) + summonTag.FlatTagDamage; + Projectile.NewProjectile(projectile.GetSource_OnHit(npc), npc.Center.X, npc.Center.Y, xVector, yVector, ModContent.ProjectileType(), damage, 3, projectile.owner); + + } + + } + public override void SetStaticDefaults() { if (!Main.dedServ) ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; + summonTag.TagItem = Type; + SummonTagDebuffDict.Add(ModContent.BuffType(),summonTag); } public override void SetDefaults() @@ -48,13 +82,15 @@ namespace CalamityMod.Items.Armor player.setBonus = this.GetLocalization("SetBonus").Format(hotkey, stormMana); CalamityPlayer modPlayer = player.Calamity(); modPlayer.forbiddenCirclet = true; - modPlayer.rogueStealthMax += 0.4f; + modPlayer.rogueStealthMax += 1f; + player.GetDamage() += 0.1f; modPlayer.wearingRogueArmor = true; } public override void UpdateEquip(Player player) { player.GetDamage() += 0.1f; + player.GetDamage() += 0.1f; player.Calamity().rogueVelocity += 0.15f; } @@ -68,4 +104,16 @@ namespace CalamityMod.Items.Armor .Register(); } } + + public class ForbiddenStealthSummonTagBuff : ModBuff + { + public override string Texture => "CalamityMod/Buffs/Summon/Whips/SentinalLash"; + + public override void SetStaticDefaults() + { + BuffID.Sets.IsATagBuff[Type] = true; + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + } + } } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 971ac6e917..41be6c06bd 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1595,3 +1595,8 @@ PopoNoselessBuff: { DisplayName: Noseless Popo Description: Your nose has been stolen! } + +ForbiddenStealthSummonTagBuff: { + DisplayName: Forbidden Stealth Summon Tag Buff + Description: Mods.CalamityMod.Buffs.ForbiddenStealthSummonTagBuff.Description +} diff --git a/Projectiles/Rogue/CircletMark.cs b/Projectiles/Rogue/CircletMark.cs index 1222796e47..d96f92c000 100644 --- a/Projectiles/Rogue/CircletMark.cs +++ b/Projectiles/Rogue/CircletMark.cs @@ -125,7 +125,7 @@ namespace CalamityMod.Projectiles.Rogue } Projectile.velocity = Vector2.Zero; Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] == 60f && Projectile.owner == Main.myPlayer) + if (Projectile.localAI[1] == 10f && Projectile.owner == Main.myPlayer) { Projectile.NewProjectile(Projectile.GetSource_FromThis(), Projectile.Center, Vector2.Zero, ModContent.ProjectileType(), Projectile.damage, 2f, Projectile.owner, 0f, 0f); } diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index 90472d54b1..07b1ba6e66 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -15,6 +15,7 @@ namespace CalamityMod.Projectiles.Summon { Main.projFrames[Type] = 4; ProjectileID.Sets.CultistIsResistantTo[Type] = true; + ProjectileID.Sets.MinionShot[Type] = true; //This marks it as a minion shot, which allows it to proc summon tag effects. } public override void SetDefaults() diff --git a/Utilities/ProjectileUtils.cs b/Utilities/ProjectileUtils.cs index e8b9ab486f..2251750b6e 100644 --- a/Utilities/ProjectileUtils.cs +++ b/Utilities/ProjectileUtils.cs @@ -184,7 +184,7 @@ namespace CalamityMod foreach (NPC n in Main.ActiveNPCs) { float extraDistance = (n.width / 2) + (n.height / 2); - if (!n.CanBeChasedBy(projectile, false) || !projectile.WithinRange(n.Center, maxDistance + extraDistance)) + if (!n.CanBeChasedBy(projectile, false) || !projectile.WithinRange(n.Center, maxDistance + extraDistance) || projectile.localNPCImmunity[n.whoAmI] > 0) continue; float currentNPCDist = Vector2.Distance(n.Center, projectile.Center); From 3086e7b3c4e882893b64abc2d94a4bf20b8a02e4 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Sat, 21 Jun 2025 09:23:51 -0500 Subject: [PATCH 2/3] forbiddedn changes pt2 --- CalPlayer/CalamityPlayer.cs | 8 +-- Items/Armor/ForbiddenCirclet.cs | 16 ++++- .../en-US/Mods.CalamityMod.Common.hjson | 2 + ...ods.CalamityMod.Items.Armor.Hardmode.hjson | 10 +-- Projectiles/Rogue/CircletTornado.cs | 40 +----------- Projectiles/Summon/ForbiddenCircletEater.cs | 64 +++---------------- 6 files changed, 37 insertions(+), 103 deletions(-) diff --git a/CalPlayer/CalamityPlayer.cs b/CalPlayer/CalamityPlayer.cs index 2dbffbdd25..e32420746c 100644 --- a/CalPlayer/CalamityPlayer.cs +++ b/CalPlayer/CalamityPlayer.cs @@ -3915,7 +3915,7 @@ namespace CalamityMod.CalPlayer SoundEngine.PlaySound(PlagueReaperMask.ActivationSound, Player.Center); Player.AddCooldown(PlagueBlackout.ID, 1800); } - if (forbiddenCirclet && Player.ownedProjectileCounts[ModContent.ProjectileType()] < 2) + if (forbiddenCirclet && Player.ownedProjectileCounts[ModContent.ProjectileType()] < 2) { int stormMana = (int)(ForbiddenCirclet.manaCost * Player.manaCost); if (Player.statMana < stormMana) @@ -3939,16 +3939,16 @@ namespace CalamityMod.CalPlayer if (Player.whoAmI == Main.myPlayer) { - if (Player.ownedProjectileCounts[ProjectileType()] > 0 ) + if (Player.ownedProjectileCounts[ProjectileType()] > 0 ) { foreach (var item in Main.ActiveProjectiles) { - if (item.owner != Player.whoAmI || item.type != ProjectileType()) + if (item.owner != Player.whoAmI || item.type != ProjectileType()) continue; item.timeLeft = 60; } } - int mark = Projectile.NewProjectile(source, Player.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), damage, kBack, Player.whoAmI); + int mark = Projectile.NewProjectile(source, Player.ClampedMouseWorld(), Vector2.Zero, ProjectileType(), damage, kBack, Player.whoAmI); } } } diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index 92a6915c05..f908c1ac52 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -4,6 +4,7 @@ using CalamityMod.Projectiles.Summon; using CalamityMod.Systems.Collections; using Terraria; using Terraria.ID; +using Terraria.Localization; using Terraria.ModLoader; namespace CalamityMod.Items.Armor @@ -13,7 +14,7 @@ namespace CalamityMod.Items.Armor { public new string LocalizationCategory => "Items.Armor.Hardmode"; public const int manaCost = 60; - public const int tornadoBaseDmg = 80; + public const int tornadoBaseDmg = 60; public const float tornadoBaseKB = 1f; public static SummonTag summonTag = new SummonTag() @@ -25,7 +26,8 @@ namespace CalamityMod.Items.Armor FlatTagDamage = 5, AllowsWhipStacking = true, TagOnHit = tagOnHit, - TagModifyHitEffects = SummonTag.BlankTagModifyHit + TagModifyHitEffects = SummonTag.BlankTagModifyHit, + AutoDrawTooltip = false }; public static void tagOnHit(NPC npc, Projectile projectile, NPC.HitInfo hit, int damageDone) @@ -79,7 +81,7 @@ namespace CalamityMod.Items.Armor { int stormMana = (int)(manaCost * player.manaCost); string hotkey = CalamityKeybinds.ArmorSetBonusHotKey.TooltipHotkeyString(); - player.setBonus = this.GetLocalization("SetBonus").Format(hotkey, stormMana); + player.setBonus = this.GetLocalization("SetBonus").Format(FormatHotkeyWithVanillaSupport(hotkey), stormMana); CalamityPlayer modPlayer = player.Calamity(); modPlayer.forbiddenCirclet = true; modPlayer.rogueStealthMax += 1f; @@ -87,6 +89,14 @@ namespace CalamityMod.Items.Armor modPlayer.wearingRogueArmor = true; } + public string FormatHotkeyWithVanillaSupport(string hotkey) + { + if (hotkey == CalamityUtils.GetText("Misc.HotkeyNotBound").Value) + { + return CalamityUtils.GetText("Common.VanillaArmorSetBonus").Format(Language.GetTextValue(Main.ReversedUpDownArmorSetBonuses ? "Key.UP" : "Key.DOWN")); + } + return CalamityUtils.GetText("Common.CalamityArmorSetBonus").Format(hotkey); + } public override void UpdateEquip(Player player) { player.GetDamage() += 0.1f; diff --git a/Localization/en-US/Mods.CalamityMod.Common.hjson b/Localization/en-US/Mods.CalamityMod.Common.hjson index 413fa82e21..5a9bff2f3b 100644 --- a/Localization/en-US/Mods.CalamityMod.Common.hjson +++ b/Localization/en-US/Mods.CalamityMod.Common.hjson @@ -14,6 +14,8 @@ RogueVelocity: "{0}% increased rogue velocity" SummonTagDamageFlat: "{0} summon tag damage" SummonTagDamageMult: "{0}x summon tag damage" SummonTagCrit: "{0}% summon tag critcal strike chance" +VanillaArmorSetBonus: Double tap {0} +CalamityArmorSetBonus: Press {0} DodgeInformation: ''' Attacks that deal less than 5% of your max life in damage will not be dodged diff --git a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson index 23e2a20942..f47ad68755 100644 --- a/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson +++ b/Localization/en-US/Mods.CalamityMod.Items.Armor.Hardmode.hjson @@ -186,14 +186,14 @@ FathomSwarmerVisage: { ForbiddenCirclet: { DisplayName: Forbidden Circlet - Tooltip: 10% increased summon damage and 15% increased rogue velocity + Tooltip: 10% increased summon and rogue damage and 15% increased rogue velocity SetBonus: ''' - +40 maximum stealth - Press {0} to call an ancient storm to the cursor location + +100 maximum stealth and 10% increased Rogue damage + {0} to call an ancient storm to the cursor location The ancient storm costs {1} mana and benefits from both summon and rogue bonuses - Rogue stealth strikes spawn homing eaters on enemy hits - Rogue and summon attacks will scale off of the stat with a higher boost + Rogue stealth strikes will tag enemies, causing summons to spawn homing eaters on hit + Using summon weapons no longer reset your stealth Minions no longer deal less damage while wielding rogue weapons ''' } diff --git a/Projectiles/Rogue/CircletTornado.cs b/Projectiles/Rogue/CircletTornado.cs index 8ea5f2ff63..3608f16e42 100644 --- a/Projectiles/Rogue/CircletTornado.cs +++ b/Projectiles/Rogue/CircletTornado.cs @@ -19,6 +19,7 @@ namespace CalamityMod.Projectiles.Rogue Projectile.friendly = true; Projectile.tileCollide = false; Projectile.DamageType = RogueDamageClass.Instance; + Projectile.minion = true; Projectile.penetrate = -1; Projectile.timeLeft = 1200; Projectile.usesLocalNPCImmunity = true; @@ -29,33 +30,6 @@ namespace CalamityMod.Projectiles.Rogue { //only 1 tornado can exist at a time Projectile.localAI[1] += 1f; - if (Projectile.localAI[1] >= 10f) - { - Projectile.localAI[1] = 0f; - int projCount = 0; - int oldestTornado = 0; - float tornadoAge = 0f; - int projType = Projectile.type; - for (int projIndex = 0; projIndex < Main.maxProjectiles; projIndex++) - { - Projectile proj = Main.projectile[projIndex]; - if (proj.active && proj.owner == Projectile.owner && proj.type == projType && proj.ai[0] < 900f) - { - projCount++; - if (proj.ai[0] > tornadoAge) - { - oldestTornado = projIndex; - tornadoAge = proj.ai[0]; - } - } - } - if (projCount > 1) - { - Main.projectile[oldestTornado].netUpdate = true; - Main.projectile[oldestTornado].ai[0] = 36000f; - return; - } - } float lifeSpan = 900f; if (Projectile.soundDelay == 0) @@ -64,10 +38,6 @@ namespace CalamityMod.Projectiles.Rogue SoundEngine.PlaySound(SoundID.Item122, Projectile.Center); } Projectile.ai[0] += 1f; - if (Projectile.ai[0] >= lifeSpan) - { - Projectile.Kill(); - } if (Projectile.localAI[0] >= 30f) { Projectile.damage = 0; @@ -113,14 +83,11 @@ namespace CalamityMod.Projectiles.Rogue Projectile.netUpdate = true; } } - if (Projectile.ai[0] < lifeSpan - 120f) - { - return; - } } public override bool PreDraw(ref Color lightColor) { + float OPACITY = MathHelper.Clamp(Projectile.timeLeft / 20f,0,1); float aiTracker = Projectile.ai[0]; float trackerClamp = MathHelper.Clamp(aiTracker / 30f, 0f, 1f); if (aiTracker > 540f) @@ -163,12 +130,11 @@ namespace CalamityMod.Projectiles.Rogue newSandYellow = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, sandYellow, 2f - colorChanger * 2f); } newSandYellow.A = (byte)((float)newSandYellow.A * 0.5f); - newSandYellow *= trackerClamp; spinArea *= colorChangeVector * 100f; spinArea.Y = 0f; spinArea.X = 0f; spinArea += new Vector2(sizeModdingVector2.X, k) - Main.screenPosition; - Main.spriteBatch.Draw(texture2D23, spinArea, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), newSandYellow, aiTrackMult + incStorageMult, smallRect, 1f + lowerColorChanger, SpriteEffects.None, 0); + Main.spriteBatch.Draw(texture2D23, spinArea, new Microsoft.Xna.Framework.Rectangle?(drawRectangle), newSandYellow * OPACITY, aiTrackMult + incStorageMult, smallRect, 1f + lowerColorChanger, SpriteEffects.None, 0); } return false; } diff --git a/Projectiles/Summon/ForbiddenCircletEater.cs b/Projectiles/Summon/ForbiddenCircletEater.cs index 07b1ba6e66..52e97c0270 100644 --- a/Projectiles/Summon/ForbiddenCircletEater.cs +++ b/Projectiles/Summon/ForbiddenCircletEater.cs @@ -71,6 +71,8 @@ namespace CalamityMod.Projectiles.Summon float attackDistance = 100000f; bool canAttack = false; Projectile.ai[0] += 1f; + + NPC target = null; if (Projectile.ai[0] > 30f) { if (player.HasMinionAttackTargetNPC) @@ -83,14 +85,11 @@ namespace CalamityMod.Projectiles.Summon float npcDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY); if (npcDist < 640f && npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - attackDistance = npcDist; - projX = npcX; - projY = npcY; - canAttack = true; + target = npc; } } } - if (!canAttack) + if (target.IsNullOrInactive()) { foreach (NPC npc in Main.ActiveNPCs) { @@ -101,60 +100,17 @@ namespace CalamityMod.Projectiles.Summon float npcDist = Math.Abs(Projectile.position.X + (float)(Projectile.width / 2) - npcX) + Math.Abs(Projectile.position.Y + (float)(Projectile.height / 2) - npcY); if (npcDist < 640f && npcDist < attackDistance && Collision.CanHit(Projectile.position, Projectile.width, Projectile.height, npc.position, npc.width, npc.height)) { - attackDistance = npcDist; - projX = npcX; - projY = npcY; - canAttack = true; + + target = npc; } } } } } - if (!canAttack) - { - projX = Projectile.position.X + (float)(Projectile.width / 2) + Projectile.velocity.X * 100f; - projY = Projectile.position.Y + (float)(Projectile.height / 2) + Projectile.velocity.Y * 100f; - } - float projVel = 0.16f; - Vector2 playerDirection = Projectile.Center; - float playerX = projX - playerDirection.X; - float playerY = projY - playerDirection.Y; - float playerDist = (float)Math.Sqrt((double)(playerX * playerX + playerY * playerY)); - playerDist = 10f / playerDist; - playerX *= playerDist; - playerY *= playerDist; - if (Projectile.velocity.X < playerX) - { - Projectile.velocity.X = Projectile.velocity.X + projVel; - if (Projectile.velocity.X < 0f && playerX > 0f) - { - Projectile.velocity.X = Projectile.velocity.X + projVel * 2f; - } - } - else if (Projectile.velocity.X > playerX) - { - Projectile.velocity.X = Projectile.velocity.X - projVel; - if (Projectile.velocity.X > 0f && playerX < 0f) - { - Projectile.velocity.X = Projectile.velocity.X - projVel * 2f; - } - } - if (Projectile.velocity.Y < playerY) - { - Projectile.velocity.Y = Projectile.velocity.Y + projVel; - if (Projectile.velocity.Y < 0f && playerY > 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y + projVel * 2f; - } - } - else if (Projectile.velocity.Y > playerY) - { - Projectile.velocity.Y = Projectile.velocity.Y - projVel; - if (Projectile.velocity.Y > 0f && playerY < 0f) - { - Projectile.velocity.Y = Projectile.velocity.Y - projVel * 2f; - } - } + if (!target.IsNullOrInactive()) + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.DirectionTo(target.Center) * 15, 0.1f); + else + Projectile.velocity = Vector2.Lerp(Projectile.velocity, Projectile.velocity.SafeNormalize(Vector2.Zero) * 15, 0.1f); } public override bool OnTileCollide(Vector2 oldVelocity) From c8132f02f8f3c90d81847edf2fa717af4f5808a4 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Fri, 8 Aug 2025 11:56:36 -0500 Subject: [PATCH 3/3] fixes & cleanup --- .../Whips/ForbiddenStealthSummonTagBuff.cs | 23 +++++++++++++++++++ CalPlayer/CalamityPlayerOnHit.cs | 1 + Items/Armor/ForbiddenCirclet.cs | 17 +++----------- .../en-US/Mods.CalamityMod.Buffs.hjson | 2 +- 4 files changed, 28 insertions(+), 15 deletions(-) create mode 100644 Buffs/Summon/Whips/ForbiddenStealthSummonTagBuff.cs diff --git a/Buffs/Summon/Whips/ForbiddenStealthSummonTagBuff.cs b/Buffs/Summon/Whips/ForbiddenStealthSummonTagBuff.cs new file mode 100644 index 0000000000..fe389e7d6d --- /dev/null +++ b/Buffs/Summon/Whips/ForbiddenStealthSummonTagBuff.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Terraria; +using Terraria.ID; +using Terraria.ModLoader; + +namespace CalamityMod.Buffs.Summon.Whips +{ + public class ForbiddenStealthSummonTagBuff : ModBuff + { + public override string Texture => "CalamityMod/Buffs/Summon/Whips/SentinalLash"; + + public override void SetStaticDefaults() + { + BuffID.Sets.IsATagBuff[Type] = true; + Main.debuff[Type] = true; + Main.buffNoSave[Type] = true; + } + } +} diff --git a/CalPlayer/CalamityPlayerOnHit.cs b/CalPlayer/CalamityPlayerOnHit.cs index ad4a53c83e..f1a1dcfe9f 100644 --- a/CalPlayer/CalamityPlayerOnHit.cs +++ b/CalPlayer/CalamityPlayerOnHit.cs @@ -5,6 +5,7 @@ using CalamityMod.Balancing; using CalamityMod.Buffs.DamageOverTime; using CalamityMod.Buffs.StatBuffs; using CalamityMod.Buffs.StatDebuffs; +using CalamityMod.Buffs.Summon.Whips; using CalamityMod.Cooldowns; using CalamityMod.Dusts; using CalamityMod.Items.Accessories; diff --git a/Items/Armor/ForbiddenCirclet.cs b/Items/Armor/ForbiddenCirclet.cs index c5cc1182bd..79ad71d000 100644 --- a/Items/Armor/ForbiddenCirclet.cs +++ b/Items/Armor/ForbiddenCirclet.cs @@ -1,4 +1,5 @@ -using CalamityMod.CalPlayer; +using CalamityMod.Buffs.Summon.Whips; +using CalamityMod.CalPlayer; using CalamityMod.DataStructures; using CalamityMod.Projectiles.Summon; using CalamityMod.Systems.Collections; @@ -63,7 +64,7 @@ namespace CalamityMod.Items.Armor if (!Main.dedServ) ArmorIDs.Head.Sets.DrawFullHair[Item.headSlot] = true; summonTag.TagItem = Type; - SummonTagDebuffDict.Add(ModContent.BuffType(),summonTag); + CalamityBuffSets.SummonTagDebuff.Add(ModContent.BuffType(),summonTag); } public override void SetDefaults() @@ -119,16 +120,4 @@ namespace CalamityMod.Items.Armor .Register(); } } - - public class ForbiddenStealthSummonTagBuff : ModBuff - { - public override string Texture => "CalamityMod/Buffs/Summon/Whips/SentinalLash"; - - public override void SetStaticDefaults() - { - BuffID.Sets.IsATagBuff[Type] = true; - Main.debuff[Type] = true; - Main.buffNoSave[Type] = true; - } - } } diff --git a/Localization/en-US/Mods.CalamityMod.Buffs.hjson b/Localization/en-US/Mods.CalamityMod.Buffs.hjson index 56f9cdb35e..0e8e942090 100644 --- a/Localization/en-US/Mods.CalamityMod.Buffs.hjson +++ b/Localization/en-US/Mods.CalamityMod.Buffs.hjson @@ -1593,5 +1593,5 @@ PopoNoselessBuff: { ForbiddenStealthSummonTagBuff: { DisplayName: Forbidden Stealth Summon Tag Buff - Description: Mods.CalamityMod.Buffs.ForbiddenStealthSummonTagBuff.Description + Description: If you're seeing this, something went horribly wrong }