shelved the stealth tooltip stuff for now

This commit is contained in:
IbanPlay authored and Cameron Ewell committed 2022-08-09 00:59:10 -04:00
1 parent ba1fffec08
commit fba6bbdd24
5 files changed
+10 -120

No files matched your search

@@ -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)
@@ -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;
+8 -9
View File
@@ -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<SnowRuffianMask>() && player.armor[1].type == ModContent.ItemType<SnowRuffianChestplate>() && player.armor[2].type == ModContent.ItemType<SnowRuffianGreaves>();
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<ThrowingDamageClass>() += 0.05f;
StealthSetBonus(player);
player.Calamity().wearingRogueArmor = true;
if (player.controlJump)
{
@@ -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
{
/// <summary>
/// Checks if the arlmor is part of a set.
/// </summary>
public abstract bool HasArmorSet(Player player);
/// <summary>
/// How much stealth is granted by this armor set
/// </summary>
public abstract float StealthBoost { get; }
/// <summary>
/// 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.
/// </summary>
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);
/// <summary>
/// Takes care of the required stealth set bonus effects.
/// Call this after setting the players setBonus.
/// </summary>
/// <param name="player"></param>
public void StealthSetBonus(Player player)
{
var modPlayer = player.Calamity();
modPlayer.rogueStealthMax += StealthBoost;
modPlayer.wearingRogueArmor = true;
}
public void EditStealthDescription(Item item, List<TooltipLine> 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<TooltipLine> 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);
}
}
}
}
}
-6
View File
@@ -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)