diff --git a/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs b/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs index 9937544a5174bd039b4d913efee1571e0e60cb4a..72ff08e6dbdb6c0c265016b602b22e2e3262ddcd 100644 --- a/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs +++ b/MrBigsock/Assets/Code/Core/Abilities/Base/BaseAbility.cs @@ -1,6 +1,8 @@ using System.Collections; using System; using System.Collections.Generic; +using System.Text; + using UnityEngine; using UnityEngine.InputSystem; @@ -102,6 +104,26 @@ namespace BigSock { */ protected abstract bool Activate(Character actor, Vector3? target); + + + + /* + Returns text that represents info about the ability. + */ + public string GetToolTip() { + var sb = new StringBuilder() + .AppendLine(Name) + .AppendLine() + .AppendLine(Description) + .AppendLine($"Cooldown: {Cooldown}"); + + if(ManaCost != 0) sb.AppendLine($"Mana Cost: {ManaCost}"); + if(StaminaCost != 0) sb.AppendLine($"Stamina Cost: {StaminaCost}"); + if(HPCost != 0) sb.AppendLine($"HP Cost: {HPCost}"); + + return sb.ToString(); + } + } /* diff --git a/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs b/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs index 0bcd5fcb83f78cd5b80672dda1b88646759954c4..5751ef5bd397e15cb0eed17c2f0ff49be457ad7d 100644 --- a/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs +++ b/MrBigsock/Assets/Code/Core/Abilities/Base/IAbility.cs @@ -76,5 +76,11 @@ namespace BigSock { Try to use the ability. */ bool Use(Character actor, Vector3? target); + + /* + Returns text that represents info about the ability. + */ + string GetToolTip(); + } } \ No newline at end of file diff --git a/MrBigsock/Assets/Code/Core/CharacterStats.cs b/MrBigsock/Assets/Code/Core/CharacterStats.cs index d60f46760873e5c4f78d9037949ffc998f66d342..9580ee1b8081cbe8a350c7f8ac61f21bc84abdcf 100644 --- a/MrBigsock/Assets/Code/Core/CharacterStats.cs +++ b/MrBigsock/Assets/Code/Core/CharacterStats.cs @@ -1,6 +1,8 @@ using System.Collections; using System; using System.Collections.Generic; +using System.Text; + using UnityEngine; using UnityEngine.InputSystem; @@ -92,5 +94,36 @@ namespace BigSock { The range of the character. */ public float Accuracy { get; set; } + + + + /* + Returns text representing the modifications it does in percent. + */ + public string GetToolTip() { + var sb = new StringBuilder(); + if(MaxHP != 0) sb.AppendLine($"Max HP: {MaxHP:P0}"); + + if(MaxMana != 0) sb.AppendLine($"Max Mana: {MaxMana:P0}"); + if(RegenMana != 0) sb.AppendLine($"Regen Mana: {RegenMana:P0}"); + + if(MaxStamina != 0) sb.AppendLine($"Max Stamina: {MaxStamina:P0}"); + if(RegenStamina != 0) sb.AppendLine($"Regen Stamina: {RegenStamina:P0}"); + + if(Damage != 0) sb.AppendLine($"Damage: {Damage:P0}"); + if(Knockback != 0) sb.AppendLine($"Knockback: {Knockback:P0}"); + + if(Range != 0) sb.AppendLine($"Range: {Range:P0}"); + if(ProjectileSpeed != 0) sb.AppendLine($"Projectile Speed: {ProjectileSpeed:P0}"); + if(Accuracy != 0) sb.AppendLine($"Accuracy: {Accuracy:P0}"); + + if(MoveSpeed != 0) sb.AppendLine($"Move Speed: {MoveSpeed:P0}"); + if(AttackSpeed != 0) sb.AppendLine($"Attack Speed: {AttackSpeed:P0}"); + + if(CritChance != 0) sb.AppendLine($"Crit Chance: {CritChance:P0}"); + if(CritDamageModifier != 0) sb.AppendLine($"Crit Damage Modifier: {CritDamageModifier:P0}"); + + return sb.ToString(); + } } } \ No newline at end of file diff --git a/MrBigsock/Assets/Code/Core/ICharacterStats.cs b/MrBigsock/Assets/Code/Core/ICharacterStats.cs index da7c4ae6fa3d5f308527cc553dd56b84ebf14bdb..92356b43f72a29cb17e7b06dec4671b11a8ccf12 100644 --- a/MrBigsock/Assets/Code/Core/ICharacterStats.cs +++ b/MrBigsock/Assets/Code/Core/ICharacterStats.cs @@ -82,6 +82,12 @@ namespace BigSock { */ float Accuracy { get; } + + /* + Returns text representing the modifications it does in percent. + */ + string GetToolTip(); + } /* diff --git a/MrBigsock/Assets/Code/Item/Base/ActiveItemBase.cs b/MrBigsock/Assets/Code/Item/Base/ActiveItemBase.cs index f49b48f3f0cbaa962b8f1ee038bac2d687b069a2..89c493d1d35acb35f29384f391e1fb27c6830d7a 100644 --- a/MrBigsock/Assets/Code/Item/Base/ActiveItemBase.cs +++ b/MrBigsock/Assets/Code/Item/Base/ActiveItemBase.cs @@ -1,6 +1,8 @@ using System.Collections; using System; using System.Collections.Generic; +using System.Text; + using UnityEngine; using UnityEngine.InputSystem; @@ -18,5 +20,21 @@ namespace BigSock.Item { public abstract IAbility Ability { get; } + /* + The type of the item. + */ + public override string ItemType => "Active"; + + /* + Returns a string used to inform the user about this item in greater detail. + */ + public override string GetToolTip() { + return new StringBuilder() + .AppendLine(base.GetToolTip()) + .AppendLine() + .AppendLine(Ability.GetToolTip()) + .ToString(); + } + } } \ No newline at end of file diff --git a/MrBigsock/Assets/Code/Item/Base/ConditionalItemBase.cs b/MrBigsock/Assets/Code/Item/Base/ConditionalItemBase.cs index 3b9ba9764b075de08cf612aa1752e3eb11283be8..d60ad11816ac4f5d375579f3be095e0d68dc3d4d 100644 --- a/MrBigsock/Assets/Code/Item/Base/ConditionalItemBase.cs +++ b/MrBigsock/Assets/Code/Item/Base/ConditionalItemBase.cs @@ -19,10 +19,18 @@ namespace BigSock.Item { */ public abstract TriggerType Trigger { get; } + + /* + The type of the item. + */ + public override string ItemType => "Conditional"; + /* - The handler to activate when the condition is triggered. + Returns a string used to inform the user about this item in greater detail. */ - //public Action<ICharEventParams> Handler { get; set; } + public override string GetToolTip() { + return $"{base.GetToolTip()}\n\nTrigger: {Trigger}"; + } } } \ No newline at end of file diff --git a/MrBigsock/Assets/Code/Item/Base/IItem.cs b/MrBigsock/Assets/Code/Item/Base/IItem.cs index 5782cedef3c7797cf0e43daa654d1b894b01845c..53c4c0948c6e1a71681d072e26eb4b6f9f96124d 100644 --- a/MrBigsock/Assets/Code/Item/Base/IItem.cs +++ b/MrBigsock/Assets/Code/Item/Base/IItem.cs @@ -32,5 +32,12 @@ namespace BigSock.Item { Sprite Icon { get; } + + /* + Returns a string used to inform the user about this item in greater detail. + */ + string GetToolTip(); + + } } \ No newline at end of file diff --git a/MrBigsock/Assets/Code/Item/Base/ItemBase.cs b/MrBigsock/Assets/Code/Item/Base/ItemBase.cs index 606f8ef5ea714fa8e391f049ad223746d410c3e2..f0a6760f13ff55d7fe2eae0ae85c3eb9af7efb41 100644 --- a/MrBigsock/Assets/Code/Item/Base/ItemBase.cs +++ b/MrBigsock/Assets/Code/Item/Base/ItemBase.cs @@ -40,12 +40,25 @@ namespace BigSock.Item { public virtual string IconName { get; } = "item/tilesetnice"; + /* + The type of the item. + */ + public abstract string ItemType { get; } + + + public ItemBase() { //Icon = SpriteService.SINGLETON.Get(IconName); } + /* + Returns a string used to inform the user about this item in greater detail. + */ + public virtual string GetToolTip() { + return $"{Name} ({ItemType})\n\n{Description}"; + } } } \ No newline at end of file diff --git a/MrBigsock/Assets/Code/Item/Base/PassiveItemBase.cs b/MrBigsock/Assets/Code/Item/Base/PassiveItemBase.cs index c5a96e9964a3f0b2e0cbde0ea655137a98f84e47..a38822381d8434e2830714b28c5061141e52821c 100644 --- a/MrBigsock/Assets/Code/Item/Base/PassiveItemBase.cs +++ b/MrBigsock/Assets/Code/Item/Base/PassiveItemBase.cs @@ -1,6 +1,8 @@ using System.Collections; using System; using System.Collections.Generic; +using System.Text; + using UnityEngine; using UnityEngine.InputSystem; @@ -17,5 +19,23 @@ namespace BigSock.Item { public ICharacterStats Modifier { get; set; } + + /* + The type of the item. + */ + public override string ItemType => "Passive"; + + /* + Returns a string used to inform the user about this item in greater detail. + */ + public override string GetToolTip() { + var stats = Modifier.GetToolTip(); + var sb = new StringBuilder().AppendLine(base.GetToolTip()); + + if(stats.Length > 0) sb.AppendLine($"\n{stats}"); + + return sb.ToString(); + } + } } \ No newline at end of file