Browse Source

Group translocate not allowed outside active banes and mines

lakebane-master
FatBoy-DOTC 9 months ago
parent
commit
0c1b3d1460
  1. 51
      src/engine/gameManager/PowersManager.java

51
src/engine/gameManager/PowersManager.java

@ -215,9 +215,60 @@ public enum PowersManager { @@ -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);

Loading…
Cancel
Save