From ac10b78d68f118d2fd1806f51d25a42a9d994a7c Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 20 Apr 2024 08:54:28 -0400 Subject: [PATCH] Work on adding modifiers --- src/engine/gameManager/ForgeManager.java | 28 ++++++++++++++++++------ src/engine/gameManager/ItemManager.java | 12 +++++----- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/src/engine/gameManager/ForgeManager.java b/src/engine/gameManager/ForgeManager.java index 6bbce613..f475fc56 100644 --- a/src/engine/gameManager/ForgeManager.java +++ b/src/engine/gameManager/ForgeManager.java @@ -275,14 +275,10 @@ public enum ForgeManager implements Runnable { else forgedItem.suffixToken = workOrder.suffixToken; - // Apple effects -/* - if (forgedItem.prefixToken != 0) - ItemManager.applyPrefixOrSuffix(forgedItem, forgedItem.prefixToken); + // Apply Item effects for Prefix and Suffix tokens + + applyItemEffects(forgedItem); - if (forgedItem.suffixToken != 0) - ItemManager.applyPrefixOrSuffix(forgedItem, forgedItem.prefixToken); -*/ // Forged random rolled items are unidentified until completed if (workOrder.prefixToken == 0 && workOrder.suffixToken == 0) @@ -291,6 +287,24 @@ public enum ForgeManager implements Runnable { return forgedItem; } + private static void applyItemEffects(Item forgedItem) { + + String prefixString; + String suffixString; + + EffectsBase prefix = PowersManager.getEffectByToken(forgedItem.prefixToken); + EffectsBase prefixEffect = PowersManager.getEffectByIDString(prefix.getIDString() + 'A'); + + EffectsBase suffix = PowersManager.getEffectByToken(forgedItem.suffixToken); + EffectsBase suffixEffect = PowersManager.getEffectByIDString(suffix.getIDString() + 'A'); + + if (forgedItem.prefixToken != 0) +// ItemManager.applyPrefixOrSuffix(forgedItem, prefixEffect.ac); + + if (forgedItem.suffixToken != 0) + // ItemManager.applyPrefixOrSuffix(forgedItem, suffixEffect); + } + public static void completeWorkOrderBatch(WorkOrder workOrder) { ArrayList toRemove = new ArrayList<>(); diff --git a/src/engine/gameManager/ItemManager.java b/src/engine/gameManager/ItemManager.java index 6c8aeebb..e37a2a91 100644 --- a/src/engine/gameManager/ItemManager.java +++ b/src/engine/gameManager/ItemManager.java @@ -2,7 +2,6 @@ package engine.gameManager; import engine.mbEnums; import engine.objects.*; -import engine.powers.EffectsBase; import engine.powers.poweractions.AbstractPowerAction; import org.pmw.tinylog.Logger; @@ -226,15 +225,14 @@ public enum ItemManager { return true; } - public static void applyPrefixOrSuffix(Item item, int token) { + public static void applyPrefixOrSuffix(Item item, String powerAction) { - EffectsBase effectsBase = PowersManager.getEffectByToken(token); - AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effectsBase.getIDString()); + AbstractPowerAction abstractPowerAction = PowersManager.getPowerActionByIDString(powerAction); - if (apa == null) + if (abstractPowerAction == null) return; - apa.applyEffectForItem(item, 0); - item.getEffectNames().add(effectsBase.getIDString()); + abstractPowerAction.applyEffectForItem(item, 0); + item.getEffectNames().add(powerAction); } }