42 lines
806 B
C#
42 lines
806 B
C#
public class Stat
|
|
{
|
|
public string Name { get; set; }
|
|
public float Value { get; set; }
|
|
public double Price { get; set; }
|
|
public double Quantity { get; set; }
|
|
|
|
public Stat(string name, float startValue)
|
|
{
|
|
Name = name;
|
|
Value = startValue;
|
|
}
|
|
|
|
public Stat(string name, float price, float quantity)
|
|
{
|
|
Name = name;
|
|
Price = price;
|
|
Quantity = quantity;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
}
|