Browse Source

Moved validation check to before asset creation.

master
MagicBot 2 years ago
parent
commit
2643be456e
  1. 23
      src/engine/net/client/handlers/PlaceAssetMsgHandler.java

23
src/engine/net/client/handlers/PlaceAssetMsgHandler.java

@ -371,7 +371,13 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { @@ -371,7 +371,13 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
}
// cant place siege equipment off city zone.
// If there is a bane placed, we limit placement to 2x the stone rank's worth of attacker assets
// and 1x the tree rank for defenders
if (validateSiegeLimits(player, origin, serverCity.getBane()) == false)
return true;
// Create the siege Building
siegeBuilding = createStructure(player, msg.getFirstPlacementInfo(), serverZone);
@ -380,20 +386,9 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { @@ -380,20 +386,9 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
if (siegeBuilding == null)
return false;
// If there is a bane placed, we limit placement to 2x the stone rank's worth of attacker assets
// and 1x the tree rank for defenders
if (validateSiegeLimits(player, origin, serverCity.getBane()) == false)
return true;
// passes validation: can assign auto-protection to war asset
if (serverCity.getBane() != null)
if (serverCity.isLocationOnCityGrid(siegeBuilding.getBounds()))
if (player.getGuild().equals(serverCity.getBane().getOwner().getGuild()))
return true;
siegeBuilding.setProtectionState(ProtectionState.PROTECTED);
// No bane placed. We're done!
@ -434,10 +429,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { @@ -434,10 +429,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
if (!building.getGuild().equals(serverCity.getGuild()) && !building.getGuild().equals(serverCity.getBane().getOwner().getGuild()))
continue;
// Only count auto protected buildings
if (building.getProtectionState() != ProtectionState.PROTECTED)
continue;
if (building.getGuild().equals(serverCity.getGuild()))
defenderBuildings.add(building);

Loading…
Cancel
Save