From 51c2aa2193ba400db313e8a5ef43ba07da8f9cf1 Mon Sep 17 00:00:00 2001 From: Ozzatron Date: Tue, 11 Jul 2023 22:06:41 -0400 Subject: [PATCH] fixed botch tooltip edits (for now) (sorry) --- Items/CalamityGlobalItemTooltip.cs | 67 +++++++++++++++--------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/Items/CalamityGlobalItemTooltip.cs b/Items/CalamityGlobalItemTooltip.cs index 70aaa57d2e..85713d6aa6 100644 --- a/Items/CalamityGlobalItemTooltip.cs +++ b/Items/CalamityGlobalItemTooltip.cs @@ -235,9 +235,9 @@ namespace CalamityMod.Items // For items such as a Copper Helmet which literally have no tooltips at all, add a custom "Tooltip0" which mimics the vanilla Tooltip0. void AddTooltip(string text) { - // Don't add the tooltip if the item is in a social slot - if (item.social) - return; + // Don't add the tooltip if the item is in a social slot + if (item.social) + return; int defenseIndex = -1; for (int i = 0; i < tooltips.Count; ++i) @@ -346,7 +346,7 @@ namespace CalamityMod.Items if (item.type == ItemID.SpaceGun) { - int cost = (int)(item.mana * Main.LocalPlayer.manaCost * 0.5f); + int cost = (int)(item.mana * Main.LocalPlayer.manaCost * 0.5f); EditTooltipByName("UseMana", (line) => line.Text = $"Uses {cost} mana"); } if (item.healLife > 0 && Main.LocalPlayer.Calamity().healingPotBonus != 1f) @@ -600,21 +600,25 @@ namespace CalamityMod.Items // Nightwither immunity pre-Moon Lord and Holy Flames immunity pre-Profaned Guardians and melee speed removal. if (item.type == ItemID.MoonStone) + { EditTooltipByNum(1, (line) => line.Text += "\nGrants immunity to Nightwither"); EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("melee speed, ", "")); + } if (item.type == ItemID.SunStone) + { EditTooltipByNum(1, (line) => line.Text += "\nGrants immunity to Holy Flames"); EditTooltipByNum(0, (line) => line.Text = line.Text.Replace("melee speed, ", "")); + } if (item.type == ItemID.CelestialStone) + { EditTooltipByNum(2, (line) => line.Text += "\nGrants immunity to Nightwither and Holy Flames"); EditTooltipByNum(0, (line) => line.Text = line.Text.Replace(" melee speed,", "")); + } if (item.type == ItemID.CelestialShell) + { EditTooltipByNum(4, (line) => line.Text += "\nGrants immunity to Nightwither and Holy Flames"); - EditTooltipByNum(0, (line) => line.Text = line.Text.Replace(" melee speed,", "")); - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace(" melee speed,", "")); EditTooltipByNum(2, (line) => line.Text = line.Text.Replace(" melee speed,", "")); - EditTooltipByNum(3, (line) => line.Text = line.Text.Replace(" melee speed,", "")); - EditTooltipByNum(4, (line) => line.Text = line.Text.Replace(" melee speed,", "")); + } // Arcane and Magnet Flower buffs. if (item.type == ItemID.ArcaneFlower || item.type == ItemID.MagnetFlower) @@ -674,8 +678,7 @@ namespace CalamityMod.Items if (item.type == ItemID.BerserkerGlove) { - EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("12% increased melee speed", "")); - EditTooltipByNum(0, (line) => line.Text += "\n10% increased true melee damage"); + EditTooltipByNum(1, (line) => line.Text = line.Text.Replace("12% increased melee speed", "10% increased true melee damage")); } if (item.type == ItemID.MechanicalGlove) @@ -844,9 +847,7 @@ namespace CalamityMod.Items if (item.type == ItemID.SquireAltShirt) EditTooltipByNum(0, (line) => line.Text = "30% increased minion damage and increased life regeneration"); if (item.type == ItemID.SquireAltPants) - EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and melee critical strike chance\n" + - "20% increased movement speed"); - EditTooltipByNum(1, (line) => line.Text = ""); + EditTooltipByNum(0, (line) => line.Text = "10% increased minion damage and melee critical strike chance"); // Shinobi Infiltrator armor if (item.type == ItemID.MonkAltHead) @@ -1167,18 +1168,18 @@ namespace CalamityMod.Items if (stealthGenBoost > 0) { TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Expert"); - if (line == null) - line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Price"); + if (line == null) + line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Price"); TooltipLine StealthGen = new TooltipLine(Mod, "PrefixStealthGenBoost", "+" + Math.Round(stealthGenBoost * 100f) + "% stealth generation") { IsModifier = true }; - if (line == null) - tooltips.Add(StealthGen); - else - tooltips.Insert(tooltips.IndexOf(line), StealthGen); + if (line == null) + tooltips.Add(StealthGen); + else + tooltips.Insert(tooltips.IndexOf(line), StealthGen); } } #endregion @@ -1193,27 +1194,27 @@ namespace CalamityMod.Items if (stealthDmgBonus > 0) { TooltipLine line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixShootSpeed"); - if (line == null) - line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixCritChance"); - else if (line == null) - line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixSpeed"); - else if (line == null) - line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixDamage"); + if (line == null) + line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixCritChance"); + else if (line == null) + line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixSpeed"); + else if (line == null) + line = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "PrefixDamage"); TooltipLine line2 = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Expert"); - if (line2 == null) - line2 = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Price"); + if (line2 == null) + line2 = tooltips.FirstOrDefault(x => x.Mod == "Terraria" && x.Name == "Price"); TooltipLine StealthDmg = new TooltipLine(Mod, "PrefixStealthDamageBoost", "+" + Math.Round(stealthDmgBonus * 100f) + "% stealth strike damage") { IsModifier = true }; - // If price/expert line doesn't exist, just add it to the end - if (line2 == null) - tooltips.Add(StealthDmg); - // Otherwise, insert it right before the sell price (or expert line) - else - tooltips.Insert(tooltips.IndexOf(line2), StealthDmg); + // If price/expert line doesn't exist, just add it to the end + if (line2 == null) + tooltips.Add(StealthDmg); + // Otherwise, insert it right before the sell price (or expert line) + else + tooltips.Insert(tooltips.IndexOf(line2), StealthDmg); } } #endregion