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 { @@ -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 { @@ -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<Item> toRemove = new ArrayList<>();

12
src/engine/gameManager/ItemManager.java

@ -2,7 +2,6 @@ package engine.gameManager; @@ -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 { @@ -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);
}
}

Loading…
Cancel
Save