From 3086e7b3c4e882893b64abc2d94a4bf20b8a02e4 Mon Sep 17 00:00:00 2001 From: Doze-Zoze Date: Sat, 21 Jun 2025 09:23:51 -0500 Subject: [PATCH] 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)