item_value refactored to template

This commit is contained in:
2024-03-03 13:18:16 -05:00
parent 70f331d025
commit f11fcc535a
5 changed files with 20 additions and 32 deletions
+8 -9
View File
@@ -124,9 +124,8 @@ public class ItemFactory {
ConcurrentHashMap<ItemBase, Integer> resources = cityWarehouse.resources;
int buildingWithdraw = BuildingManager.GetWithdrawAmountForRolling(forge, ib.getBaseValue());
int overdraft = BuildingManager.GetOverdraft(forge, ib.getBaseValue());
int buildingWithdraw = BuildingManager.GetWithdrawAmountForRolling(forge, template.item_value);
int overdraft = BuildingManager.GetOverdraft(forge, template.item_value);
if (overdraft > 0 && !useWarehouse) {
if (pc != null)
ErrorPopupMsg.sendErrorMsg(pc, "Not enough gold in building strongbox." + " " + template.item_base_name);
@@ -308,7 +307,7 @@ public class ItemFactory {
if (prefixValue == null)
return null;
int baseCost = ib.getBaseValue();
int baseCost = template.item_value;
int effectCost = (int) prefixValue.getValue();
int total = baseCost * 10 + effectCost;
@@ -361,7 +360,7 @@ public class ItemFactory {
if (suffixValue == null)
return null;
suffixResourceCosts = suffix.getResourcesForEffect();
int baseCost = ib.getBaseValue();
int baseCost = template.item_value;
int effectCost = (int) suffixValue.getValue();
suffixCost = effectCost;
int total = baseCost * 10 + effectCost;
@@ -405,7 +404,7 @@ public class ItemFactory {
//Check if Total suffix and prefix costs + itemCost can be withdrawn.
int costToCreate = suffixCost + prefixCost + (ib.getBaseValue());
int costToCreate = suffixCost + prefixCost + template.item_value;
int buildingWithdraw = BuildingManager.GetWithdrawAmountForRolling(forge, costToCreate);
int overdraft = BuildingManager.GetOverdraft(forge, costToCreate);
@@ -510,7 +509,7 @@ public class ItemFactory {
if (prefix == null && suffix == null) {
int baseCost = ib.getBaseValue();
int baseCost = template.item_value;
int total = (int) (baseCost + baseCost * (float) .10);
buildingWithdraw = BuildingManager.GetWithdrawAmountForRolling(forge, total);
@@ -889,7 +888,7 @@ public class ItemFactory {
ItemBase goldIB = ItemBase.getGoldItemBase();
int baseCost = ib.getBaseValue();
int baseCost = template.item_value;
int total = (int) (baseCost + baseCost * .10);
EffectsBase suffix = null;
@@ -903,7 +902,7 @@ public class ItemFactory {
//calculate gold costs and remove from the warehouse
if (prefix != null || suffix != null) {
int costToCreate = (int) (ib.getBaseValue() + ib.getBaseValue() * .10f);
int costToCreate = (int) (template.item_value + template.item_value * .10f);
int buildingWithdraw = BuildingManager.GetWithdrawAmountForRolling(forge, costToCreate);
int overdraft = BuildingManager.GetOverdraft(forge, costToCreate);