diff --git a/src/engine/gameManager/PowersManager.java b/src/engine/gameManager/PowersManager.java index 3d4aac1a..c2c17a4f 100644 --- a/src/engine/gameManager/PowersManager.java +++ b/src/engine/gameManager/PowersManager.java @@ -215,9 +215,60 @@ public enum PowersManager { + Integer.toHexString(msg.getPowerUsedID()) + " (" + msg.getPowerUsedID() + ')'); } + Boolean earlyExit = false; //Sending recycle message to player if died while casting. if (!playerCharacter.isAlive() && msg.getPowerUsedID() != 428589216) { //succor + earlyExit = true; + } + + if(msg.getPowerUsedID() == 430628895){ // group teleport + + Boolean activeBane = false; + + if(ZoneManager.getCityAtLocation(playerCharacter.loc) != null && ZoneManager.getCityAtLocation(playerCharacter.loc).getBane() != null) + activeBane = ZoneManager.getCityAtLocation(playerCharacter.loc).getBane().getSiegePhase().equals(SiegePhase.WAR); + + Zone currentZone = ZoneManager.findSmallestZone(playerCharacter.loc); + if(currentZone == null) + earlyExit = true; + + if(currentZone.isPlayerCity() && !activeBane) + earlyExit = true; + + if(currentZone.getName().contains("Mine") == true && currentZone.isPlayerCity() == false) { + for (Building building : currentZone.zoneBuildingSet) { + if (Mine.getMineFromTower(building.getObjectUUID()) != null) { + Mine currentMine = Mine.getMineFromTower(building.getObjectUUID()); + if (currentMine.isActive == false) { + earlyExit = true; + } + } + } + } + Vector3fImmutable endLoc = new Vector3fImmutable(msg.getTargetX(),msg.getTargetY(),msg.getTargetZ()); + currentZone = ZoneManager.findSmallestZone(endLoc); + + if(currentZone == null) + earlyExit = true; + + if(currentZone.isPlayerCity() && !activeBane) + earlyExit = true; + + if(currentZone.getName().contains("Mine") == true && currentZone.isPlayerCity() == false) { + for (Building building : currentZone.zoneBuildingSet) { + if (Mine.getMineFromTower(building.getObjectUUID()) != null) { + Mine currentMine = Mine.getMineFromTower(building.getObjectUUID()); + if (currentMine.isActive == false) { + earlyExit = true; + } + } + } + } + } + + if (earlyExit) { + RecyclePowerMsg recyclePowerMsg = new RecyclePowerMsg(msg.getPowerUsedID()); Dispatch dispatch = Dispatch.borrow(playerCharacter, recyclePowerMsg); DispatchMessage.dispatchMsgDispatch(dispatch, DispatchChannel.PRIMARY);