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