You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.5 KiB
40 lines
1.5 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class ItemArmor : Item
|
|
{
|
|
public int Defense { get; private set; }
|
|
|
|
public int Block { get; private set; }
|
|
|
|
public ItemArmor(string name, string iconName, int pbasePrice,int pDefense, int pBlock, string descr = "", ItemRarity rarity = ItemRarity.Common) : base(name, iconName, pbasePrice, descr,rarity)
|
|
{
|
|
Block = pBlock;
|
|
Defense = pDefense;
|
|
}
|
|
|
|
// This is used so we can identify a type purely through polymorphism. No hardcoding of types involved, nothing to see here!
|
|
public override ItemType GetItemType()
|
|
{
|
|
return ItemType.Armor;
|
|
}
|
|
|
|
public override string GetStats()
|
|
{
|
|
return "Defense: " + Defense + "\tBlock: " + Block;
|
|
}
|
|
|
|
public override void Upgrade(float upgradeFactor)
|
|
{
|
|
Block = (int) (Block * upgradeFactor); // Don't wanna randomise upgrades for now, to be honest
|
|
Defense = (int) (Defense * upgradeFactor);
|
|
// We increase value, but only by half as much as the upgrade improved stats. No one wants to buy a bad item upgraded to be passable. Cost to do so is higher by as much as the upgrade shop charges extra
|
|
basePrice += (int)(GetUpgradeCosts(upgradeFactor) * 0.5); // The goal is to make upgrading an endless money sink, and incentivise buying better base items
|
|
}
|
|
|
|
public override int GetUpgradeCosts(float upgradeFactor)
|
|
{
|
|
return (int) (((basePrice * upgradeFactor) - basePrice));
|
|
}
|
|
}
|
|
|