From 8665011457f9e9b73c3214b2431fae4330d25402 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 5 Jun 2022 16:56:54 -0500 Subject: [PATCH] can no longer delete building during active bane --- .../client/handlers/DestroyBuildingHandler.java | 17 +++++++---------- src/engine/objects/City.java | 1 - 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/engine/net/client/handlers/DestroyBuildingHandler.java b/src/engine/net/client/handlers/DestroyBuildingHandler.java index 7e53d1be..ed58c0fd 100644 --- a/src/engine/net/client/handlers/DestroyBuildingHandler.java +++ b/src/engine/net/client/handlers/DestroyBuildingHandler.java @@ -8,10 +8,7 @@ import engine.gameManager.BuildingManager; import engine.net.client.ClientConnection; import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.DestroyBuildingMsg; -import engine.objects.Blueprint; -import engine.objects.Building; -import engine.objects.City; -import engine.objects.PlayerCharacter; +import engine.objects.*; /* * @Author: @@ -43,7 +40,7 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler { Blueprint blueprint; blueprint = building.getBlueprint(); - + City city = building.getCity(); // Can't destroy buildings without a blueprint. if (blueprint == null) @@ -57,7 +54,10 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler { if (!BuildingManager.PlayerCanControlNotOwner(building, pc)) return true; - +Bane bane = city.getBane(); +if(bane.getSiegePhase() == Enum.SiegePhase.WAR && bane != null) { + return true; +} // Can't destroy a tree of life if (blueprint.getBuildingGroup() == BuildingGroup.TOL) return true; @@ -71,15 +71,12 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler { if (blueprint.getBuildingGroup() == BuildingGroup.RUNEGATE) return true; - +//stop if active siege // Turn off spire if destoying if (blueprint.getBuildingGroup() == BuildingGroup.SPIRE) building.disableSpire(true); if (blueprint.getBuildingGroup() == BuildingGroup.WAREHOUSE) { - - City city = building.getCity(); - if (city != null) city.setWarehouseBuildingID(0); } diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index 87788ef6..09a13bd2 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -1019,7 +1019,6 @@ public class City extends AbstractWorldObject { if (!this.isLocationOnCityZone(player.getLoc())) continue; - // Apply safehold affect to player if needed if ((this.isSafeHold == 1))