Browse Source

Work on adding modifiers

combat-2
MagicBot 7 months ago
parent
commit
ac10b78d68
  1. 28
      src/engine/gameManager/ForgeManager.java
  2. 12
      src/engine/gameManager/ItemManager.java

28
src/engine/gameManager/ForgeManager.java

@ -275,14 +275,10 @@ public enum ForgeManager implements Runnable {
else else
forgedItem.suffixToken = workOrder.suffixToken; forgedItem.suffixToken = workOrder.suffixToken;
// Apple effects // Apply Item effects for Prefix and Suffix tokens
/*
if (forgedItem.prefixToken != 0) applyItemEffects(forgedItem);
ItemManager.applyPrefixOrSuffix(forgedItem, forgedItem.prefixToken);
if (forgedItem.suffixToken != 0)
ItemManager.applyPrefixOrSuffix(forgedItem, forgedItem.prefixToken);
*/
// Forged random rolled items are unidentified until completed // Forged random rolled items are unidentified until completed
if (workOrder.prefixToken == 0 && workOrder.suffixToken == 0) if (workOrder.prefixToken == 0 && workOrder.suffixToken == 0)
@ -291,6 +287,24 @@ public enum ForgeManager implements Runnable {
return forgedItem; 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) { public static void completeWorkOrderBatch(WorkOrder workOrder) {
ArrayList<Item> toRemove = new ArrayList<>(); ArrayList<Item> toRemove = new ArrayList<>();

12
src/engine/gameManager/ItemManager.java

@ -2,7 +2,6 @@ package engine.gameManager;
import engine.mbEnums; import engine.mbEnums;
import engine.objects.*; import engine.objects.*;
import engine.powers.EffectsBase;
import engine.powers.poweractions.AbstractPowerAction; import engine.powers.poweractions.AbstractPowerAction;
import org.pmw.tinylog.Logger; import org.pmw.tinylog.Logger;
@ -226,15 +225,14 @@ public enum ItemManager {
return true; return true;
} }
public static void applyPrefixOrSuffix(Item item, int token) { public static void applyPrefixOrSuffix(Item item, String powerAction) {
EffectsBase effectsBase = PowersManager.getEffectByToken(token); AbstractPowerAction abstractPowerAction = PowersManager.getPowerActionByIDString(powerAction);
AbstractPowerAction apa = PowersManager.getPowerActionByIDString(effectsBase.getIDString());
if (apa == null) if (abstractPowerAction == null)
return; return;
apa.applyEffectForItem(item, 0); abstractPowerAction.applyEffectForItem(item, 0);
item.getEffectNames().add(effectsBase.getIDString()); item.getEffectNames().add(powerAction);
} }
} }

Loading…
Cancel
Save