Browse Source

can no longer delete building during active bane

master
FatBoy-DOTC 2 years ago
parent
commit
8665011457
  1. 17
      src/engine/net/client/handlers/DestroyBuildingHandler.java
  2. 1
      src/engine/objects/City.java

17
src/engine/net/client/handlers/DestroyBuildingHandler.java

@ -8,10 +8,7 @@ import engine.gameManager.BuildingManager;
import engine.net.client.ClientConnection; import engine.net.client.ClientConnection;
import engine.net.client.msg.ClientNetMsg; import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.DestroyBuildingMsg; import engine.net.client.msg.DestroyBuildingMsg;
import engine.objects.Blueprint; import engine.objects.*;
import engine.objects.Building;
import engine.objects.City;
import engine.objects.PlayerCharacter;
/* /*
* @Author: * @Author:
@ -43,7 +40,7 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
Blueprint blueprint; Blueprint blueprint;
blueprint = building.getBlueprint(); blueprint = building.getBlueprint();
City city = building.getCity();
// Can't destroy buildings without a blueprint. // Can't destroy buildings without a blueprint.
if (blueprint == null) if (blueprint == null)
@ -57,7 +54,10 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
if (!BuildingManager.PlayerCanControlNotOwner(building, pc)) if (!BuildingManager.PlayerCanControlNotOwner(building, pc))
return true; return true;
Bane bane = city.getBane();
if(bane.getSiegePhase() == Enum.SiegePhase.WAR && bane != null) {
return true;
}
// Can't destroy a tree of life // Can't destroy a tree of life
if (blueprint.getBuildingGroup() == BuildingGroup.TOL) if (blueprint.getBuildingGroup() == BuildingGroup.TOL)
return true; return true;
@ -71,15 +71,12 @@ public class DestroyBuildingHandler extends AbstractClientMsgHandler {
if (blueprint.getBuildingGroup() == BuildingGroup.RUNEGATE) if (blueprint.getBuildingGroup() == BuildingGroup.RUNEGATE)
return true; return true;
//stop if active siege
// Turn off spire if destoying // Turn off spire if destoying
if (blueprint.getBuildingGroup() == BuildingGroup.SPIRE) if (blueprint.getBuildingGroup() == BuildingGroup.SPIRE)
building.disableSpire(true); building.disableSpire(true);
if (blueprint.getBuildingGroup() == BuildingGroup.WAREHOUSE) { if (blueprint.getBuildingGroup() == BuildingGroup.WAREHOUSE) {
City city = building.getCity();
if (city != null) if (city != null)
city.setWarehouseBuildingID(0); city.setWarehouseBuildingID(0);
} }

1
src/engine/objects/City.java

@ -1019,7 +1019,6 @@ public class City extends AbstractWorldObject {
if (!this.isLocationOnCityZone(player.getLoc())) if (!this.isLocationOnCityZone(player.getLoc()))
continue; continue;
// Apply safehold affect to player if needed // Apply safehold affect to player if needed
if ((this.isSafeHold == 1)) if ((this.isSafeHold == 1))

Loading…
Cancel
Save