private void OnTriggerEnter(Collider other) { // If the enemy is hit with a projectile that IS NOT tagged enemy if (other.GetComponent <SkillProjectile>() && !other.gameObject.CompareTag("Enemy")) { TakeDamage(other.GetComponent <SkillProjectile>().Skill.amountOfDamage + _playerAbilitySystem.CalculateElementalDamage()); transform.LookAt(other.transform); Destroy(other.gameObject); } // If the enemy is hit by a player weapon if (other.CompareTag("EquippedWeapon")) { var enemyHitDetection = other.GetComponent <EnemyHitDetection>(); if (enemyHitDetection != null) { // Perform a range check if (Vector3.Distance(transform.position, _player.gameObject.transform.position) <= _player.GetComponent <PlayerEquipmentManager>().weaponItem.weaponRange) { TakeDamage(enemyHitDetection.playerAbilitySystem.CalculatePhysicalDamage()); // ## Health-on-Hit _player.CurrentHp += _playerAbilitySystem.healthOnHitAmount / 100 * _player.maxHp; } } } }
public override void Load(string json) { var data = JsonUtility.FromJson <CharacterData>(json); CharacterPool.Register(data.characterId, player); player.data = data; player.characterController.enabled = false; transform.position = data.position; player.graphic.rotation = data.rotation; for (int i = 0; i < player.inventory.slots; i++) { player.inventory.DestroyItem(i); } for (int i = 0; i < data.items.Count; i++) { for (int j = 0; j < data.quantities[i]; j++) { player.inventory.AddItem(data.items[i]); } player.inventory.items[i].Equipped = data.equipped[i]; } player.GetComponent <CharacterEquipment>().CheckEquipment(); player.characterController.enabled = true; }
private void Start() { _playerControls = GetComponent <Player.Player>().Controls; _camera = Camera.main; _player = GetComponent <Player.Player>(); _playerAbilitiesSystem = _player.GetComponent <AbilitiesSystem>(); }
private void Start() { _player = GameManager.Instance.player; _playerAbilities = _player.GetComponent <AbilitiesSystem>(); // player name should not change during game playerName.SetText("Callum"); }
private void Awake() { // Get the player target _player = FindObjectOfType <Player.Player>(); CurHp = maxHp; _xpToGive = (5 + damage) * enemyLevel; _animator = GetComponentInChildren <Animator>(); _playerAbilitySystem = _player.GetComponent <AbilitiesSystem>(); }
private void Awake() { _player = GetComponentInParent <Player>(); _playerAbilitySystem = _player.GetComponent <AbilitiesSystem>(); }
private void Awake() { // Get the player _player = FindObjectOfType <Player.Player>(); _playerAbilitySystem = _player.GetComponent <AbilitiesSystem>(); }
private void RefreshInventoryItems() { foreach (var item in _inventory.GetItemList()) { switch (item) { case WeaponItem: { var weaponSlot = _itemSlotContainer.Find("weaponSlot"); var weaponSlotImage = weaponSlot.Find("image").GetComponent <Image>(); weaponSlot.GetComponent <Button_UI>().enabled = true; weaponSlotImage.sprite = item.GetSprite(); weaponSlotImage.gameObject.SetActive(true); weaponSlot.GetComponent <Button_UI>().MouseRightClickFunc = () => { // Un-equip the item CursorController.Instance.SetCursor(CursorController.CursorTypes.Dequip); _player.GetComponent <PlayerEquipmentManager>().UnEquip(item); weaponSlot.GetComponent <Button_UI>().enabled = false; weaponSlotImage.gameObject.SetActive(false); }; // Display item stats when hovering over weaponSlot.GetComponent <Button_UI>().MouseOverOnceTooltipFunc = () => { GenerateItemTooltip(item, weaponSlot.position); }; weaponSlot.GetComponent <Button_UI>().MouseOutOnceTooltipFunc = () => { UI_Inventory.Instance.hoverInterface.SetActive(false); }; break; } case HelmetItem: { var headSlot = _itemSlotContainer.Find("headSlot"); var headSlotImage = headSlot.Find("image").GetComponent <Image>(); headSlot.GetComponent <Button_UI>().enabled = true; headSlotImage.sprite = item.GetSprite(); headSlotImage.gameObject.SetActive(true); headSlot.GetComponent <Button_UI>().MouseRightClickFunc = () => { // Un-equip the item _player.GetComponent <PlayerEquipmentManager>().UnEquip(item); headSlot.GetComponent <Button_UI>().enabled = false; headSlotImage.gameObject.SetActive(false); }; // Display item stats when hovering over headSlot.GetComponent <Button_UI>().MouseOverOnceTooltipFunc = () => { GenerateItemTooltip(item, headSlot.position); }; headSlot.GetComponent <Button_UI>().MouseOutOnceTooltipFunc = () => { UI_Inventory.Instance.hoverInterface.SetActive(false); }; break; } case ChestItem: { var chestSlot = _itemSlotContainer.Find("chestSlot"); var chestSlotImage = chestSlot.Find("image").GetComponent <Image>(); chestSlot.GetComponent <Button_UI>().enabled = true; chestSlotImage.sprite = item.GetSprite(); chestSlotImage.gameObject.SetActive(true); chestSlot.GetComponent <Button_UI>().MouseRightClickFunc = () => { // Un-equip the item _player.GetComponent <PlayerEquipmentManager>().UnEquip(item); chestSlot.GetComponent <Button_UI>().enabled = false; chestSlotImage.gameObject.SetActive(false); }; // Display item stats when hovering over chestSlot.GetComponent <Button_UI>().MouseOverOnceTooltipFunc = () => { GenerateItemTooltip(item, chestSlot.position); }; chestSlot.GetComponent <Button_UI>().MouseOutOnceTooltipFunc = () => { UI_Inventory.Instance.hoverInterface.SetActive(false); }; break; } case BootItem: { var bootsSlot = _itemSlotContainer.Find("bootsSlot"); var bootsSlotImage = bootsSlot.Find("image").GetComponent <Image>(); bootsSlot.GetComponent <Button_UI>().enabled = true; bootsSlotImage.sprite = item.GetSprite(); bootsSlotImage.gameObject.SetActive(true); bootsSlot.GetComponent <Button_UI>().MouseRightClickFunc = () => { // Un-equip the item _player.GetComponent <PlayerEquipmentManager>().UnEquip(item); bootsSlot.GetComponent <Button_UI>().enabled = false; bootsSlotImage.gameObject.SetActive(false); }; // Display item stats when hovering over bootsSlot.GetComponent <Button_UI>().MouseOverOnceTooltipFunc = () => { GenerateItemTooltip(item, bootsSlot.position); }; bootsSlot.GetComponent <Button_UI>().MouseOutOnceTooltipFunc = () => { UI_Inventory.Instance.hoverInterface.SetActive(false); }; break; } } } }
public void EquipArmour(ArmourItem armourItem) { #region Base Stats _playerAbilitySystem.strength += armourItem.strengthAmount; _playerAbilitySystem.intelligence += armourItem.intelligenceAmount; _playerAbilitySystem.strengthPhysicalDamageIncreaseAmount += armourItem.physicalArmour; _playerAbilitySystem.intelligenceElementalDamageIncreaseAmount += armourItem.elementalArmour; switch (armourItem.healthAmount) { case > 0: _player.maxHp += armourItem.healthAmount; break; case < 0: _player.maxHp -= armourItem.healthAmount; break; } switch (armourItem.manaAmount) { case > 0: _playerAbilitySystem.maxMana += armourItem.manaAmount; break; case < 0: _playerAbilitySystem.maxMana -= armourItem.manaAmount; break; } switch (armourItem.strengthAmount) { // Update Player Stats case < 0: _player.maxHp -= (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength); break; case > 0: _player.maxHp += (_playerAbilitySystem.strengthHpIncreaseAmount * _playerAbilitySystem.strength); break; } switch (armourItem.intelligenceAmount) { case < 0: _playerAbilitySystem.maxMana -= _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence; break; case > 0: _playerAbilitySystem.maxMana += _playerAbilitySystem.intelligenceManaIncreaseAmount * _playerAbilitySystem.intelligence; break; } #endregion // ## HELMET ITEM ## if (armourItem is HelmetItem helmetItem) { head = helmetItem; _playerAbilitySystem.manaRegenerationPercentage += helmetItem.manaRegenerationPercentage; _player.GetComponent <SkillsManager>().activeSkills.ForEach(skill => skill.manaCost -= helmetItem.reducedManaCostOfSkillsAmount); _playerAbilitySystem.reducedManaCostOfSkillsAmount += helmetItem.reducedManaCostOfSkillsAmount; } // ## CHEST ITEM ## if (armourItem is ChestItem chestItem) { chest = chestItem; _playerAbilitySystem.healthOnHitAmount += chestItem.healthOnHitAmount; if (_playerAbilitySystem.GetComponent <PlayerEquipmentManager>().hasWeaponEquipped) { _playerAbilitySystem.GetComponent <PlayerEquipmentManager>().weaponItem.weaponRange += chestItem.additionalWeaponRangeAmount; } } if (armourItem is BootItem bootItem) { boots = bootItem; _playerAbilitySystem.moveSpeedIncreaseAmount += bootItem.moveSpeedIncrease; // Increase Movement Speed GetComponent <NavMeshAgent>().speed += (bootItem.moveSpeedIncrease / 100 * GetComponent <NavMeshAgent>().speed); } // ## Add Armour to Equipment Inventory ## _equipmentInventory.AddItem(armourItem); }
/// <summary> /// Set the player, and the ability system variable /// </summary> /// <param name="player">The player</param> public void SetPlayer(Player.Player player) { _player = player; _playerAbilitySystem = _player.GetComponent <AbilitiesSystem>(); }
public void SetItemStats(Item item) { var itemStats = hoverInterface.transform.Find("ItemStats").GetComponent <TextMeshProUGUI>(); itemStats.SetText(""); // Reset Item Stats Text Box var playerEquipment = _player.GetComponent <PlayerEquipmentManager>(); switch (item) { case WeaponItem weaponItem: var damageString = $"<b>Damage:</b> {weaponItem.damage}"; var rangeString = $"<b>Range:</b> {weaponItem.weaponRange:F}".Replace("-", ""); var attackSpeedString = $"<b>Attack Rate:</b> {weaponItem.attackRate:F}"; var specialAbilityString = $"<b>Unique Ability:</b> <i>{weaponItem.specialAbility.ability.ToString()}</i>"; if (playerEquipment.hasWeaponEquipped) { var equippedItem = playerEquipment.weaponItem; // Weapon Damage if (equippedItem.damage > weaponItem.damage) { damageString = damageString.Replace($"{weaponItem.damage}", $"<color=red>{weaponItem.damage}</color> <size=75%>-{equippedItem.damage - weaponItem.damage}</size>"); } if (equippedItem.damage < weaponItem.damage) { damageString = damageString.Replace($"{weaponItem.damage}", $"<color=green>{weaponItem.damage:F}</color> <size=75%>+{weaponItem.damage - equippedItem.damage}</size>"); } // Weapon Range if (equippedItem.weaponRange > weaponItem.weaponRange) { rangeString = rangeString.Replace($"{weaponItem.weaponRange:F}", $"<color=red>{weaponItem.weaponRange:F}</color> <size=75%>-{(float)equippedItem.weaponRange - (float)weaponItem.weaponRange:F}</size>"); } if (equippedItem.weaponRange < weaponItem.weaponRange) { rangeString = rangeString.Replace($"{weaponItem.weaponRange:F}", $"<color=green>{weaponItem.weaponRange:F}</color> <size=75%>+{weaponItem.weaponRange - equippedItem.weaponRange:F}</size>"); } // Weapon attack speed if (equippedItem.attackRate > weaponItem.attackRate) { attackSpeedString = attackSpeedString.Replace($"{weaponItem.attackRate:F}", $"<color=red>{weaponItem.attackRate:F}</color> <size=75%>+{weaponItem.attackRate - equippedItem.attackRate:F}</size>"); } if (equippedItem.attackRate < weaponItem.attackRate) { attackSpeedString = attackSpeedString.Replace($"{weaponItem.attackRate:F}", $"<color=green>{weaponItem.attackRate:F}</color> <size=75%>-{equippedItem.attackRate - weaponItem.attackRate:F}</size>"); } } if (weaponItem.itemRarity == ItemRarity.Unique) { itemStats.SetText($"{specialAbilityString}\n" + $"{damageString}\n" + $"{rangeString}\n" + $"{attackSpeedString}\n"); } else { itemStats.SetText($"{damageString}\n" + $"{rangeString}\n" + $"{attackSpeedString}"); } break; case ArmourItem armourItem: var physicalArmourString = $"Physical Armour: {armourItem.physicalArmour}"; var elementalArmourString = $"Elemental Armour: {armourItem.elementalArmour}"; var healthString = $"Health: {armourItem.healthAmount}"; var manaString = $"Mana: {armourItem.manaAmount}"; var strengthString = $"Strength: {armourItem.strengthAmount}"; var intelligenceString = $"Intelligence: {armourItem.intelligenceAmount}"; var specialAbility = $"Unique Ability: {armourItem.specialAbility.ability.ToString()}"; switch (armourItem) { case HelmetItem helmetItem: { var manaRegenerationAmount = $"Mana Regen: {helmetItem.manaRegenerationPercentage}%"; var reducedManaCostString = $"Skills Mana Cost: {helmetItem.reducedManaCostOfSkillsAmount}"; // ## If we already have a helmet equipped, compare. ## if (playerEquipment.head != null) { var equippedItem = playerEquipment.head; // Helmet physical armour if (equippedItem.physicalArmour > helmetItem.physicalArmour) { physicalArmourString = physicalArmourString.Replace($"{helmetItem.physicalArmour}", $"<color=red>{helmetItem.physicalArmour}</color> <size=75%>-{equippedItem.physicalArmour - helmetItem.physicalArmour}</size>"); } if (equippedItem.physicalArmour < helmetItem.physicalArmour) { physicalArmourString = physicalArmourString.Replace($"{helmetItem.physicalArmour}", $"<color=green>{helmetItem.physicalArmour}</color> <size=75%>+{helmetItem.physicalArmour - equippedItem.physicalArmour}</size>"); } // Helmet elemental armour if (equippedItem.elementalArmour > helmetItem.elementalArmour) { elementalArmourString = elementalArmourString.Replace($"{helmetItem.elementalArmour}", $"<color=red>{helmetItem.elementalArmour}</color> <size=75%>-{equippedItem.elementalArmour - helmetItem.elementalArmour}</size>"); } if (equippedItem.elementalArmour < helmetItem.elementalArmour) { elementalArmourString = elementalArmourString.Replace($"{helmetItem.elementalArmour}", $"<color=green>{helmetItem.elementalArmour}</color> <size=75%>+{helmetItem.elementalArmour - equippedItem.elementalArmour}</size>"); } // Helmet health if (equippedItem.healthAmount > helmetItem.healthAmount) { healthString = healthString.Replace($"{helmetItem.healthAmount}", $"<color=red>{helmetItem.healthAmount}</color> <size=75%>{helmetItem.healthAmount - equippedItem.healthAmount}</size>"); } if (equippedItem.healthAmount < helmetItem.healthAmount) { healthString = healthString.Replace($"{helmetItem.healthAmount}", $"<color=green>{helmetItem.healthAmount}</color> <size=75%>+{helmetItem.healthAmount - equippedItem.healthAmount}</size>"); } // Helmet mana if (equippedItem.manaAmount > helmetItem.manaAmount) { manaString = manaString.Replace($"{helmetItem.manaAmount}", $"<color=red>{helmetItem.manaAmount}</color> <size=75%>{helmetItem.manaAmount - equippedItem.manaAmount}</size>"); } if (equippedItem.manaAmount < helmetItem.manaAmount) { manaString = manaString.Replace($"{helmetItem.manaAmount}", $"<color=green>{helmetItem.manaAmount}</color> <size=75%>+{helmetItem.manaAmount - equippedItem.manaAmount}</size>"); } // Helmet strength if (equippedItem.strengthAmount > helmetItem.strengthAmount) { strengthString = strengthString.Replace($"{helmetItem.strengthAmount}", $"<color=red>{helmetItem.strengthAmount}</color> <size=75%>{helmetItem.strengthAmount - equippedItem.strengthAmount}</size>"); } if (equippedItem.strengthAmount < helmetItem.strengthAmount) { strengthString = strengthString.Replace($"{helmetItem.strengthAmount}", $"<color=green>{helmetItem.strengthAmount}</color> <size=75%>+{helmetItem.strengthAmount - equippedItem.strengthAmount}</size>"); } // Helmet intelligence if (equippedItem.intelligenceAmount > helmetItem.intelligenceAmount) { intelligenceString = intelligenceString.Replace($"{helmetItem.intelligenceAmount}", $"<color=red>{helmetItem.intelligenceAmount}</color> <size=75%>{helmetItem.intelligenceAmount - equippedItem.intelligenceAmount}</size>"); } if (equippedItem.intelligenceAmount < helmetItem.intelligenceAmount) { intelligenceString = intelligenceString.Replace($"{helmetItem.intelligenceAmount}", $"<color=green>{helmetItem.intelligenceAmount}</color> <size=75%>+{helmetItem.intelligenceAmount - equippedItem.intelligenceAmount}</size>"); } // Mana if (equippedItem.manaRegenerationPercentage > helmetItem.manaRegenerationPercentage) { manaRegenerationAmount = manaRegenerationAmount.Replace( $"{helmetItem.manaRegenerationPercentage}", $"<color=red>{helmetItem.manaRegenerationPercentage}</color> <size=75%>-{equippedItem.manaRegenerationPercentage - helmetItem.manaRegenerationPercentage}%</size>"); } if (equippedItem.manaRegenerationPercentage < helmetItem.manaRegenerationPercentage) { manaRegenerationAmount = manaRegenerationAmount.Replace( $"{helmetItem.manaRegenerationPercentage}", $"<color=green>{helmetItem.manaRegenerationPercentage}</color> <size=75%>+{helmetItem.manaRegenerationPercentage - equippedItem.manaRegenerationPercentage}%</size>"); } // Reduced Mana Cost of skills if (equippedItem.reducedManaCostOfSkillsAmount > helmetItem.reducedManaCostOfSkillsAmount) { reducedManaCostString = reducedManaCostString.Replace( $"{helmetItem.reducedManaCostOfSkillsAmount}", $"<color=red>{helmetItem.reducedManaCostOfSkillsAmount}</color> <size=75%>-{equippedItem.reducedManaCostOfSkillsAmount - helmetItem.reducedManaCostOfSkillsAmount}</size>"); } if (equippedItem.reducedManaCostOfSkillsAmount < helmetItem.reducedManaCostOfSkillsAmount) { reducedManaCostString = reducedManaCostString.Replace( $"{helmetItem.reducedManaCostOfSkillsAmount}", $"<color=green>{helmetItem.reducedManaCostOfSkillsAmount}</color> <size=75%>+{helmetItem.reducedManaCostOfSkillsAmount - equippedItem.reducedManaCostOfSkillsAmount}</size>"); } } if (helmetItem.itemRarity == ItemRarity.Unique) { itemStats.SetText($"{physicalArmourString}\n" + $"{elementalArmourString}\n" + $"{healthString}\n" + $"{manaString}\n" + $"{strengthString}\n" + $"{intelligenceString}\n" + $"{specialAbility}\n" + $"{manaRegenerationAmount}\n" + $"{reducedManaCostString}"); } else { itemStats.SetText($"{physicalArmourString}\n" + $"{elementalArmourString}\n" + $"{healthString}\n" + $"{manaString}\n" + $"{strengthString}\n" + $"{intelligenceString}\n" + $"{manaRegenerationAmount}\n" + $"{reducedManaCostString}"); } break; } case ChestItem chestItem: { var healthOnHitAmountString = $"Health On Hit: {chestItem.healthOnHitAmount}"; var weaponRangeString = $"Weapon Range: {chestItem.additionalWeaponRangeAmount}"; // ## If we already have a chest equipped, compare. ## if (playerEquipment.chest != null) { var equippedItem = playerEquipment.chest; // Helmet physical armour if (equippedItem.physicalArmour > chestItem.physicalArmour) { physicalArmourString = physicalArmourString.Replace($"{chestItem.physicalArmour}", $"<color=red>{chestItem.physicalArmour}</color> <size=75%>-{equippedItem.physicalArmour - chestItem.physicalArmour}</size>"); } if (equippedItem.physicalArmour < chestItem.physicalArmour) { physicalArmourString = physicalArmourString.Replace($"{chestItem.physicalArmour}", $"<color=green>{chestItem.physicalArmour}</color> <size=75%>+{chestItem.physicalArmour - equippedItem.physicalArmour}</size>"); } // Helmet elemental armour if (equippedItem.elementalArmour > chestItem.elementalArmour) { elementalArmourString = elementalArmourString.Replace($"{chestItem.elementalArmour}", $"<color=red>{chestItem.elementalArmour}</color> <size=75%>-{equippedItem.elementalArmour - chestItem.elementalArmour}</size>"); } if (equippedItem.elementalArmour < chestItem.elementalArmour) { elementalArmourString = elementalArmourString.Replace($"{chestItem.elementalArmour}", $"<color=green>{chestItem.elementalArmour}</color> <size=75%>+{chestItem.elementalArmour - equippedItem.elementalArmour}</size>"); } // Helmet health if (equippedItem.healthAmount > chestItem.healthAmount) { healthString = healthString.Replace($"{chestItem.healthAmount}", $"<color=red>{chestItem.healthAmount}</color> <size=75%>{chestItem.healthAmount - equippedItem.healthAmount}</size>"); } if (equippedItem.healthAmount < chestItem.healthAmount) { healthString = healthString.Replace($"{chestItem.healthAmount}", $"<color=green>{chestItem.healthAmount}</color> <size=75%>+{chestItem.healthAmount - equippedItem.healthAmount}</size>"); } // Helmet mana if (equippedItem.manaAmount > chestItem.manaAmount) { manaString = manaString.Replace($"{chestItem.manaAmount}", $"<color=red>{chestItem.manaAmount}</color> <size=75%>{chestItem.manaAmount - equippedItem.manaAmount}</size>"); } if (equippedItem.manaAmount < chestItem.manaAmount) { manaString = manaString.Replace($"{chestItem.manaAmount}", $"<color=green>{chestItem.manaAmount}</color> <size=75%>+{chestItem.manaAmount - equippedItem.manaAmount}</size>"); } // Helmet strength if (equippedItem.strengthAmount > chestItem.strengthAmount) { strengthString = strengthString.Replace($"{chestItem.strengthAmount}", $"<color=red>{chestItem.strengthAmount}</color> <size=75%>{chestItem.strengthAmount - equippedItem.strengthAmount}</size>"); } if (equippedItem.strengthAmount < chestItem.strengthAmount) { strengthString = strengthString.Replace($"{chestItem.strengthAmount}", $"<color=green>{chestItem.strengthAmount}</color> <size=75%>+{chestItem.strengthAmount - equippedItem.strengthAmount}</size>"); } // Helmet intelligence if (equippedItem.intelligenceAmount > chestItem.intelligenceAmount) { intelligenceString = intelligenceString.Replace($"{chestItem.intelligenceAmount}", $"<color=red>{chestItem.intelligenceAmount}</color> <size=75%>{chestItem.intelligenceAmount - equippedItem.intelligenceAmount}</size>"); } if (equippedItem.intelligenceAmount < chestItem.intelligenceAmount) { intelligenceString = intelligenceString.Replace($"{chestItem.intelligenceAmount}", $"<color=green>{chestItem.intelligenceAmount}</color> <size=75%>+{chestItem.intelligenceAmount - equippedItem.intelligenceAmount}</size>"); } // Health on Hit Amount if (equippedItem.healthOnHitAmount > chestItem.healthOnHitAmount) { healthOnHitAmountString = healthOnHitAmountString.Replace( $"{chestItem.healthOnHitAmount}", $"<color=red>{chestItem.healthOnHitAmount}</color> <size=75%>-{equippedItem.healthOnHitAmount - chestItem.healthOnHitAmount}</size>"); } if (equippedItem.healthOnHitAmount < chestItem.healthOnHitAmount) { healthOnHitAmountString = healthOnHitAmountString.Replace( $"{chestItem.healthOnHitAmount}", $"<color=green>{chestItem.healthOnHitAmount}</color> <size=75%>+{chestItem.healthOnHitAmount - equippedItem.healthOnHitAmount}</size>"); } // Additional Weapon Range if (equippedItem.additionalWeaponRangeAmount > chestItem.additionalWeaponRangeAmount) { weaponRangeString = weaponRangeString.Replace( $"{chestItem.additionalWeaponRangeAmount}", $"<color=red>{chestItem.additionalWeaponRangeAmount}</color> <size=75%>-{equippedItem.additionalWeaponRangeAmount - chestItem.additionalWeaponRangeAmount}</size>"); } if (equippedItem.additionalWeaponRangeAmount < chestItem.additionalWeaponRangeAmount) { weaponRangeString = weaponRangeString.Replace( $"{chestItem.additionalWeaponRangeAmount}", $"<color=green>{chestItem.additionalWeaponRangeAmount}</color> <size=75%>+{chestItem.additionalWeaponRangeAmount - equippedItem.additionalWeaponRangeAmount}</size>"); } } if (chestItem.itemRarity == ItemRarity.Unique) { itemStats.SetText($"{physicalArmourString}\n" + $"{elementalArmourString}\n" + $"{healthString}\n" + $"{manaString}\n" + $"{strengthString}\n" + $"{intelligenceString}\n" + $"{specialAbility}\n" + $"{healthOnHitAmountString}\n" + $"{weaponRangeString}\n"); } else { itemStats.SetText($"{physicalArmourString}\n" + $"{elementalArmourString}\n" + $"{healthString}\n" + $"{manaString}\n" + $"{strengthString}\n" + $"{intelligenceString}\n" + $"{healthOnHitAmountString}\n" + $"{weaponRangeString}\n"); } break; } case BootItem bootItem: { var moveSpeedIncreaseString = $"Move Speed Increase: {bootItem.moveSpeedIncrease:F}%"; // ## If we already have boots equipped, compare. ## if (playerEquipment.boots != null) { var equippedItem = playerEquipment.boots; // Helmet physical armour if (equippedItem.physicalArmour > bootItem.physicalArmour) { physicalArmourString = physicalArmourString.Replace($"{bootItem.physicalArmour}", $"<color=red>{bootItem.physicalArmour}</color> <size=75%>-{equippedItem.physicalArmour - bootItem.physicalArmour}</size>"); } if (equippedItem.physicalArmour < bootItem.physicalArmour) { physicalArmourString = physicalArmourString.Replace($"{bootItem.physicalArmour}", $"<color=green>{bootItem.physicalArmour}</color> <size=75%>+{bootItem.physicalArmour - equippedItem.physicalArmour}</size>"); } // Helmet elemental armour if (equippedItem.elementalArmour > bootItem.elementalArmour) { elementalArmourString = elementalArmourString.Replace($"{bootItem.elementalArmour}", $"<color=red>{bootItem.elementalArmour}</color> <size=75%>-{equippedItem.elementalArmour - bootItem.elementalArmour}</size>"); } if (equippedItem.elementalArmour < bootItem.elementalArmour) { elementalArmourString = elementalArmourString.Replace($"{bootItem.elementalArmour}", $"<color=green>{bootItem.elementalArmour}</color> <size=75%>+{bootItem.elementalArmour - equippedItem.elementalArmour}</size>"); } // Helmet health if (equippedItem.healthAmount > bootItem.healthAmount) { healthString = healthString.Replace($"{bootItem.healthAmount}", $"<color=red>{bootItem.healthAmount}</color> <size=75%>{bootItem.healthAmount - equippedItem.healthAmount}</size>"); } if (equippedItem.healthAmount < bootItem.healthAmount) { healthString = healthString.Replace($"{bootItem.healthAmount}", $"<color=green>{bootItem.healthAmount}</color> <size=75%>+{bootItem.healthAmount - equippedItem.healthAmount}</size>"); } // Helmet mana if (equippedItem.manaAmount > bootItem.manaAmount) { manaString = manaString.Replace($"{bootItem.manaAmount}", $"<color=red>{bootItem.manaAmount}</color> <size=75%>{bootItem.manaAmount - equippedItem.manaAmount}</size>"); } if (equippedItem.manaAmount < bootItem.manaAmount) { manaString = manaString.Replace($"{bootItem.manaAmount}", $"<color=green>{bootItem.manaAmount}</color> <size=75%>+{bootItem.manaAmount - equippedItem.manaAmount}</size>"); } // Helmet strength if (equippedItem.strengthAmount > bootItem.strengthAmount) { strengthString = strengthString.Replace($"{bootItem.strengthAmount}", $"<color=red>{bootItem.strengthAmount}</color> <size=75%>{bootItem.strengthAmount - equippedItem.strengthAmount}</size>"); } if (equippedItem.strengthAmount < bootItem.strengthAmount) { strengthString = strengthString.Replace($"{bootItem.strengthAmount}", $"<color=green>{bootItem.strengthAmount}</color> <size=75%>+{bootItem.strengthAmount - equippedItem.strengthAmount}</size>"); } // Helmet intelligence if (equippedItem.intelligenceAmount > bootItem.intelligenceAmount) { intelligenceString = intelligenceString.Replace($"{bootItem.intelligenceAmount}", $"<color=red>{bootItem.intelligenceAmount}</color> <size=75%>{bootItem.intelligenceAmount - equippedItem.intelligenceAmount}</size>"); } if (equippedItem.intelligenceAmount < bootItem.intelligenceAmount) { intelligenceString = intelligenceString.Replace($"{bootItem.intelligenceAmount}", $"<color=green>{bootItem.intelligenceAmount}</color> <size=75%>+{bootItem.intelligenceAmount - equippedItem.intelligenceAmount}</size>"); } // Move Speed Increase if (equippedItem.moveSpeedIncrease > bootItem.moveSpeedIncrease) { moveSpeedIncreaseString = moveSpeedIncreaseString.Replace( $"{bootItem.moveSpeedIncrease}", $"<color=red>{bootItem.moveSpeedIncrease}</color> <size=75%>-{equippedItem.moveSpeedIncrease - bootItem.moveSpeedIncrease}</size"); } if (equippedItem.moveSpeedIncrease < bootItem.moveSpeedIncrease) { moveSpeedIncreaseString = moveSpeedIncreaseString.Replace( $"{bootItem.moveSpeedIncrease}", $"<color=green>{bootItem.moveSpeedIncrease}</color> <size=75%>+{bootItem.moveSpeedIncrease - equippedItem.moveSpeedIncrease}</size>"); } } if (bootItem.itemRarity == ItemRarity.Unique) { itemStats.SetText($"{physicalArmourString}\n" + $"{elementalArmourString}\n" + $"{healthString}\n" + $"{manaString}\n" + $"{strengthString}\n" + $"{intelligenceString}\n" + $"{specialAbility}\n" + $"{moveSpeedIncreaseString}\n"); } else { itemStats.SetText($"{physicalArmourString}\n" + $"{elementalArmourString}\n" + $"{healthString}\n" + $"{manaString}\n" + $"{strengthString}\n" + $"{intelligenceString}\n" + $"{moveSpeedIncreaseString}\n"); } break; } } break; case HealthPotion healthPotion: itemStats.SetText($"Restore Amount: {healthPotion.restoreAmount}"); break; case ManaPotion manaPotion: itemStats.SetText($"Restore Amount: {manaPotion.restoreAmount}"); break; case Coin _: itemStats.SetText(""); break; } }