From 4fa646ce94ec7a7eaf66fb06641a2b61593ca814 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Tue, 23 Apr 2024 15:05:03 -0400 Subject: [PATCH] New costmap data implemented --- src/engine/gameManager/ForgeManager.java | 6 ++---- src/engine/powers/EffectsBase.java | 24 ++++++++---------------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index a74cc200..b21a5eb7 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -218,14 +218,12 @@ public enum ForgeManager implements Runnable { if (workOrder.prefixToken != 0) { EffectsBase prefix = PowersManager.getEffectByToken(workOrder.prefixToken); - EffectsBase prefixValue = PowersManager.getEffectByIDString(prefix.getIDString() + 'A'); - production_cost.putAll(prefixValue.getResourcesForEffect()); + production_cost.putAll(PowersManager._effect_costMaps.get(prefix.getIDString())); } if (workOrder.suffixToken != 0) { EffectsBase suffix = PowersManager.getEffectByToken(workOrder.suffixToken); - EffectsBase suffixValue = PowersManager.getEffectByIDString(suffix.getIDString() + 'A'); - production_cost.putAll(suffixValue.getResourcesForEffect()); + production_cost.putAll(PowersManager._effect_costMaps.get(suffix.getIDString())); } return production_cost; diff --git a/src/engine/powers/EffectsBase.java b/src/engine/powers/EffectsBase.java index dc72873a..24043173 100644 --- a/src/engine/powers/EffectsBase.java +++ b/src/engine/powers/EffectsBase.java @@ -9,10 +9,6 @@ package engine.powers; -import engine.mbEnums; -import engine.mbEnums.EffectSourceType; -import engine.mbEnums.GameObjectType; -import engine.mbEnums.PowerFailCondition; import engine.gameManager.DbManager; import engine.gameManager.PowersManager; import engine.job.JobContainer; @@ -20,11 +16,18 @@ import engine.jobs.AbstractEffectJob; import engine.jobs.DamageOverTimeJob; import engine.jobs.FinishSpireEffectJob; import engine.jobs.NoTimeJob; +import engine.mbEnums; +import engine.mbEnums.EffectSourceType; +import engine.mbEnums.GameObjectType; +import engine.mbEnums.PowerFailCondition; import engine.net.Dispatch; import engine.net.DispatchMessage; import engine.net.client.ClientConnection; import engine.net.client.msg.ApplyEffectMsg; -import engine.objects.*; +import engine.objects.AbstractCharacter; +import engine.objects.AbstractWorldObject; +import engine.objects.Effect; +import engine.objects.PlayerCharacter; import engine.powers.effectmodifiers.AbstractEffectModifier; import engine.server.MBServerStatics; import org.pmw.tinylog.Logger; @@ -718,15 +721,4 @@ public class EffectsBase { this.value = Value; } - public ConcurrentHashMap getResourcesForEffect() { - if (this.resourceCosts.isEmpty()) { - ArrayList effectsCostList = DbManager.EffectsResourceCostsQueries.GET_ALL_EFFECT_RESOURCES(this.IDString); - for (EffectsResourceCosts erc : effectsCostList) { - this.resourceCosts.put(mbEnums.ResourceType.resourceLookup.get(erc.getResourceID()), erc.getAmount()); - } - } - return this.resourceCosts; - } - - }