From fba6bbdd240318bd4bdcaaa765a7f53499595230 Mon Sep 17 00:00:00 2001 From: IbanPlay <56191483+IbanPlay@users.noreply.github.com> Date: Mon, 8 Aug 2022 20:28:56 +0200 Subject: [PATCH] shelved the stealth tooltip stuff for now --- .../SnowRuffian/SnowRuffianChestplate.cs | 6 +- Items/Armor/SnowRuffian/SnowRuffianGreaves.cs | 6 +- Items/Armor/SnowRuffian/SnowRuffianMask.cs | 17 ++-- Items/BaseItems/StealthGrantingArmorPiece.cs | 95 ------------------- Utilities/MathematicalUtils.cs | 6 -- 5 files changed, 10 insertions(+), 120 deletions(-) delete mode 100644 Items/BaseItems/StealthGrantingArmorPiece.cs diff --git a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs index e1bc587b25..8e3a828192 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianChestplate.cs @@ -1,16 +1,12 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.BaseItems; namespace CalamityMod.Items.Armor.SnowRuffian { [AutoloadEquip(EquipType.Body)] - public class SnowRuffianChestplate : StealthGrantingArmorPiece + public class SnowRuffianChestplate : ModItem { - public override bool HasArmorSet(Player player) => SnowRuffianMask.HasRuffianArmorSet(player); - public override float StealthBoost => 0.5f; - public override void Load() { if (Main.netMode == NetmodeID.Server) diff --git a/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs b/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs index 53856a016f..2b0665f9ea 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianGreaves.cs @@ -1,16 +1,12 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.BaseItems; namespace CalamityMod.Items.Armor.SnowRuffian { [AutoloadEquip(EquipType.Legs)] - public class SnowRuffianGreaves : StealthGrantingArmorPiece + public class SnowRuffianGreaves : ModItem { - public override bool HasArmorSet(Player player) => SnowRuffianMask.HasRuffianArmorSet(player); - public override float StealthBoost => 0.5f; - public override void SetStaticDefaults() { SacrificeTotal = 1; diff --git a/Items/Armor/SnowRuffian/SnowRuffianMask.cs b/Items/Armor/SnowRuffian/SnowRuffianMask.cs index c0e12c2c3a..9b89e8d715 100644 --- a/Items/Armor/SnowRuffian/SnowRuffianMask.cs +++ b/Items/Armor/SnowRuffian/SnowRuffianMask.cs @@ -2,19 +2,14 @@ using Terraria; using Terraria.ID; using Terraria.ModLoader; -using CalamityMod.Items.BaseItems; namespace CalamityMod.Items.Armor.SnowRuffian { [AutoloadEquip(EquipType.Head)] - public class SnowRuffianMask : StealthGrantingArmorPiece + public class SnowRuffianMask : ModItem { private bool shouldBoost = false; - public static bool HasRuffianArmorSet(Player player) => player.armor[0].type == ModContent.ItemType() && player.armor[1].type == ModContent.ItemType() && player.armor[2].type == ModContent.ItemType(); - public override float StealthBoost => 0.5f; - public override bool HasArmorSet(Player player) => HasRuffianArmorSet(player); - public override void Load() { @@ -49,11 +44,15 @@ namespace CalamityMod.Items.Armor.SnowRuffian { var modPlayer = player.Calamity(); modPlayer.snowRuffianSet = true; + modPlayer.rogueStealthMax += 0.5f; player.setBonus = "5% increased rogue damage\n" + - "You can glide to negate fall damage"; + "You can glide to negate fall damage\n" + + "Rogue stealth builds while not attacking and slower while moving, up to a max of 50\n" + + "Once you have built max stealth, you will be able to perform a Stealth Strike\n" + + "Rogue stealth only reduces when you attack, it does not reduce while moving\n" + + "The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; player.GetDamage() += 0.05f; - - StealthSetBonus(player); + player.Calamity().wearingRogueArmor = true; if (player.controlJump) { diff --git a/Items/BaseItems/StealthGrantingArmorPiece.cs b/Items/BaseItems/StealthGrantingArmorPiece.cs deleted file mode 100644 index c1eed81c41..0000000000 --- a/Items/BaseItems/StealthGrantingArmorPiece.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.Collections.Generic; -using CalamityMod.CalPlayer; -using Terraria; -using Terraria.ID; -using Terraria.ModLoader; -using Microsoft.Xna.Framework; -using static Microsoft.Xna.Framework.Input.Keys; - -namespace CalamityMod.Items.BaseItems -{ - public abstract class StealthGrantingArmorPiece : ModItem - { - /// - /// Checks if the arlmor is part of a set. - /// - public abstract bool HasArmorSet(Player player); - /// - /// How much stealth is granted by this armor set - /// - public abstract float StealthBoost { get; } - /// - /// The text that appears to query about the extra stealth details. If shift is meant to show more than just stealth, it can be edited. - /// - public virtual string TooltipExpansionQueryText => "Hold SHIFT for an explanation of the stealth mechanics"; - public static string StealthSalesPitch = " Rogue stealth builds while not attacking and slower while moving\n" + - " Your maximum stealth depends on the armor and accessories you are wearing\n" + - " Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - " Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - " The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - public static string StealthColorHex => Color.Lerp(new Color(227, 180, 253), new Color(205, 236, 253), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly)).ToHex(); - public static Color StealthSalesPitchColor => Color.Lerp(Color.Lerp(new Color(227, 180, 253), new Color(205, 236, 253), 0.5f + 0.5f * (float)Math.Sin(Main.GlobalTimeWrappedHourly)), new Color(230, 230, 230), 0.5f); - - - /// - /// Takes care of the required stealth set bonus effects. - /// Call this after setting the players setBonus. - /// - /// - public void StealthSetBonus(Player player) - { - var modPlayer = player.Calamity(); - modPlayer.rogueStealthMax += StealthBoost; - modPlayer.wearingRogueArmor = true; - } - - public void EditStealthDescription(Item item, List tooltips) - { - StealthSalesPitch = " Rogue stealth builds while not attacking and slower while moving\n" + - " Your maximum stealth depends on the armor and accessories you are wearing\n" + - " Once you have built max stealth, you will be able to perform a Stealth Strike\n" + - " Rogue stealth only reduces when you attack, it does not reduce while moving\n" + - " The higher your rogue stealth the higher your rogue damage, crit, and movement speed"; - - if (HasArmorSet(Main.LocalPlayer)) - { - if (!Main.keyState.IsKeyDown(LeftShift)) - { - TooltipLine stealthInfoQuery = new TooltipLine(item.ModItem.Mod, "CalamityMod:ExpandedStealthDisplayQuery", TooltipExpansionQueryText); - stealthInfoQuery.OverrideColor = new Color(190, 190, 190); - tooltips.Add(stealthInfoQuery); - } - - else - { - TooltipLine stealthInfoTitle = new TooltipLine(item.ModItem.Mod, "CalamityMod:ExpandedStealthDisplayTitle", "[- Stealth -]"); - stealthInfoTitle.OverrideColor = StealthSalesPitchColor; - tooltips.Add(stealthInfoTitle); - - TooltipLine stealthInfo = new TooltipLine(item.ModItem.Mod, "CalamityMod:ExpandedStealthDisplay", StealthSalesPitch); - stealthInfo.OverrideColor = Color.White; - tooltips.Add(stealthInfo); - } - - } - } - - public override sealed void ModifyTooltips(List tooltips) - { - if (HasArmorSet(Main.LocalPlayer)) - { - int setBonusIndex = tooltips.FindIndex(x => x.Name == "SetBonus" && x.Mod == "Terraria"); - - if (setBonusIndex != -1) - { - setBonusIndex++; - TooltipLine stealthCount = new TooltipLine(Item.ModItem.Mod, "CalamityMod:ArmorSetStealth", $"Grants {StealthBoost * 100} base [c/" + StealthColorHex + ":Stealth]."); - tooltips.Insert(setBonusIndex, stealthCount); - - EditStealthDescription(Item, tooltips); - } - } - } - } -} diff --git a/Utilities/MathematicalUtils.cs b/Utilities/MathematicalUtils.cs index b5b2e2c2a4..8e3e17d123 100644 --- a/Utilities/MathematicalUtils.cs +++ b/Utilities/MathematicalUtils.cs @@ -352,12 +352,6 @@ namespace CalamityMod #endregion - - public static string ToHex(this Color color) - { - return color.R.ToString("X") + color.G.ToString("X") + color.B.ToString("X"); - } - // REMOVE THIS IN CALAMITY 1.4, it's a 1.4 World.cs function. // Due to its temporary state, this method will not receive an XML documentation comment. public static Rectangle ClampToWorld(Rectangle tileRectangle)