Refactor code

This commit is contained in:
Vladimir Koshevarov
2023-02-28 16:19:40 +02:00
parent dad45af7a9
commit b71fa6a9eb
13 changed files with 65 additions and 71 deletions
+41
View File
@@ -0,0 +1,41 @@
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;
}
}