Persisting effects in complete item

This commit is contained in:
2024-04-20 12:33:55 -04:00
parent cca4521c93
commit 98d03620bc
3 changed files with 35 additions and 26 deletions
+25
View File
@@ -1,5 +1,6 @@
package engine.gameManager;
import engine.loot.WorkOrder;
import engine.mbEnums;
import engine.objects.*;
import engine.powers.poweractions.AbstractPowerAction;
@@ -235,4 +236,28 @@ public enum ItemManager {
abstractPowerAction.applyEffectForItem(item, 0);
item.getEffectNames().add(powerAction);
}
public static int validate(WorkOrder workOrder) {
int validation_result = 0;
ItemTemplate template = ItemTemplate.templates.get(workOrder.templateID);
if (!workOrder.vendor.charItemManager.hasRoomInventory(template.item_wt))
return 30; //30: That person cannot carry that item
if (!workOrder.vendor.getItemModTable().contains((template.modTable)))
return 59; //59: This hireling does not have this formula
if (!Warehouse.calcCostOverrun(workOrder).isEmpty())
return 10; //18: You can't really afford that
// Forge must be protected in order to access warehouse.
if (ForgeManager.calcProductionCost(workOrder).size() > 1)
if (!workOrder.vendor.building.protectionState.equals(mbEnums.ProtectionState.PROTECTED))
return 193; //193: Production denied: This building must be protected to gain access to warehouse
return validation_result;
}
}