Browse Source

can no longer delete building during active bane

pull/13/head
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; @@ -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 { @@ -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 { @@ -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 { @@ -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);
}

1
src/engine/objects/City.java

@ -1019,7 +1019,6 @@ public class City extends AbstractWorldObject { @@ -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))

Loading…
Cancel
Save