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 ItemWeapon : Item
|
|
{
|
|
public int Attack { get; private set; }
|
|
public int Damage { get; private set; }
|
|
|
|
private readonly int startPrice; // Represents the price this is worth without upgrades - for price calculation
|
|
public ItemWeapon(string name, string iconName, int pbasePrice,int pAttack, int pDamage, string descr = "", ItemRarity rarity = ItemRarity.Common) : base(name, iconName, pbasePrice, descr,rarity)
|
|
{
|
|
Attack = pAttack;
|
|
Damage = pDamage;
|
|
startPrice = basePrice;
|
|
}
|
|
|
|
public override ItemType GetItemType()
|
|
{
|
|
return ItemType.Weapon;
|
|
}
|
|
|
|
public override string GetStats()
|
|
{
|
|
return "Attack: " + Attack + "\tDamage: " + Damage; // Empty placeholder
|
|
}
|
|
|
|
public override void Upgrade(float upgradeFactor)
|
|
{
|
|
Attack = (int) (Attack * upgradeFactor); // Don't wanna randomise upgrades for now, to be honest
|
|
Damage = (int) (Damage * 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) - startPrice));
|
|
}
|
|
}
|
|
|