diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 680c8fce..5d27a91c 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -60,6 +60,19 @@ public enum PowersManager { public static String[] siegeBuffs = new String[]{"ART-004A","ARM-112A"}; public static String[] siegeDeBuffs = new String[]{"ACM-003A","WRT-003A"}; + public static ArrayList static_power_que = new ArrayList<>(); + + public static class PowerQueObject{ + public PowerQueObject(PerformActionMsg inmsg,ClientConnection inorigin,boolean insendCastToSelf){ + this.msg = inmsg; + this.origin = inorigin; + this.sendCastToSelf = insendCastToSelf; + } + public PerformActionMsg msg; + public ClientConnection origin; + public boolean sendCastToSelf; + } + private PowersManager() { } diff --git a/src/engine/net/client/ClientMessagePump.java b/src/engine/net/client/ClientMessagePump.java index 46db6e0f..13cef490 100644 --- a/src/engine/net/client/ClientMessagePump.java +++ b/src/engine/net/client/ClientMessagePump.java @@ -1921,7 +1921,8 @@ public class ClientMessagePump implements NetMsgHandler { } break; case POWER: - PowersManager.usePower((PerformActionMsg) msg, origin, false); + //PowersManager.usePower((PerformActionMsg) msg, origin, false); + PowersManager.static_power_que.add(new PowersManager.PowerQueObject((PerformActionMsg) msg, origin, false)); break; case REQUESTMELEEATTACK: CombatManager.setAttackTarget((AttackCmdMsg) msg, origin); diff --git a/src/engine/workthreads/PowersThread.java b/src/engine/workthreads/PowersThread.java new file mode 100644 index 00000000..97794f99 --- /dev/null +++ b/src/engine/workthreads/PowersThread.java @@ -0,0 +1,24 @@ +package engine.workthreads; + +import engine.gameManager.PowersManager; + +import java.util.ArrayList; + +public class PowersThread implements Runnable { + + public PowersThread(){ + + } + + @Override + public void run() { + while(true){ + ArrayList purge = new ArrayList<>(); + for(PowersManager.PowerQueObject pqo : PowersManager.static_power_que){ + purge.add(pqo); + PowersManager.usePower(pqo.msg,pqo.origin,pqo.sendCastToSelf); + } + PowersManager.static_power_que.removeAll(purge); + } + } +}