45 lines
897 B
C#
45 lines
897 B
C#
public class Stat
|
|
{
|
|
public string Name { get; set; }
|
|
public float Value { get; set; }
|
|
public float Price { get; set; }
|
|
public float Quantity { get; set; }
|
|
public float MaxValue { get; set; }
|
|
|
|
public Stat(string name, float startValue, float maxValue)
|
|
{
|
|
Name = name;
|
|
Value = startValue;
|
|
MaxValue = maxValue;
|
|
}
|
|
|
|
public Stat(string name, float price, float quantity, float maxValue)
|
|
{
|
|
Name = name;
|
|
Price = price;
|
|
Quantity = quantity;
|
|
MaxValue = maxValue;
|
|
}
|
|
|
|
public void increase(float byAmount)
|
|
{
|
|
Value += byAmount;
|
|
}
|
|
|
|
public bool deduct(float amount)
|
|
{
|
|
if (Value >= amount)
|
|
{
|
|
Value -= amount;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void forceDeduct(float amount)
|
|
{
|
|
Value -= amount;
|
|
}
|
|
|
|
}
|