|
|
@ -23,6 +23,7 @@ import engine.objects.*; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import engine.server.MBServerStatics; |
|
|
|
import org.joda.time.DateTime; |
|
|
|
import org.joda.time.DateTime; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
import org.pmw.tinylog.Logger; |
|
|
|
|
|
|
|
import sun.util.calendar.ZoneInfo; |
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
@ -122,7 +123,6 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Let's now attempt to place the building
|
|
|
|
// Let's now attempt to place the building
|
|
|
|
|
|
|
|
|
|
|
|
buildingCreated = false; |
|
|
|
buildingCreated = false; |
|
|
|
|
|
|
|
|
|
|
|
// Many buildings have particular validation and
|
|
|
|
// Many buildings have particular validation and
|
|
|
@ -394,12 +394,11 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
// If there is an bane placed, we protect 2x the stone rank's worth of attacker assets
|
|
|
|
// If there is an bane placed, we protect 2x the stone rank's worth of attacker assets
|
|
|
|
|
|
|
|
|
|
|
|
// and 1x the tree rank's worth of assets automatically
|
|
|
|
// and 1x the tree rank's worth of assets automatically
|
|
|
|
|
|
|
|
|
|
|
|
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(serverCity, 1000, MBServerStatics.MASK_BUILDING); |
|
|
|
HashSet<AbstractWorldObject> awoList = WorldGrid.getObjectsInRangePartial(serverCity, 1000, MBServerStatics.MASK_BUILDING); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (AbstractWorldObject awo : awoList) { |
|
|
|
for (AbstractWorldObject awo : awoList) { |
|
|
|
Building building = (Building)awo; |
|
|
|
Building building = (Building)awo; |
|
|
|
|
|
|
|
|
|
|
@ -426,28 +425,44 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler { |
|
|
|
|
|
|
|
|
|
|
|
if (building.getGuild().equals(serverCity.getGuild())) |
|
|
|
if (building.getGuild().equals(serverCity.getGuild())) |
|
|
|
numDefenderBuildings++; |
|
|
|
numDefenderBuildings++; |
|
|
|
else |
|
|
|
else if (building.getGuild().equals(serverCity.getBane().getOwner().getGuild())) |
|
|
|
if (building.getGuild().equals(serverCity.getBane().getOwner().getGuild())) |
|
|
|
|
|
|
|
numAttackerBuildings++; |
|
|
|
numAttackerBuildings++; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Validate bane limits on siege assets
|
|
|
|
} |
|
|
|
//if (serverCity.getBane() != null)
|
|
|
|
|
|
|
|
// if ((player.getGuild().equals(serverCity.getBane().getOwner().getGuild())) &&
|
|
|
|
// Validate bane limits on siege assets
|
|
|
|
// (numAttackerBuildings >= serverCity.getBane().getStone().getRank() * 2)) {
|
|
|
|
|
|
|
|
// return true;
|
|
|
|
if (serverCity.getBane() != null) |
|
|
|
// }
|
|
|
|
if ((player.getGuild().equals(serverCity.getBane().getOwner().getGuild())) && |
|
|
|
|
|
|
|
(numAttackerBuildings >= serverCity.getBane().getStone().getRank() * 2)) { |
|
|
|
//if ((player.getGuild().equals(serverCity.getGuild())) &&
|
|
|
|
|
|
|
|
// (numDefenderBuildings >= serverCity.getTOL().getRank())) {
|
|
|
|
|
|
|
|
// return true;
|
|
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
int maxAttackerAssets = serverCity.getBane().getStone().getRank() * 2; |
|
|
|
|
|
|
|
int maxDefenderAssets = serverCity.getRank(); |
|
|
|
|
|
|
|
if(player.getGuild() == serverCity.getGuild()){ |
|
|
|
|
|
|
|
//defender attempting to place asset
|
|
|
|
|
|
|
|
if(numDefenderBuildings == maxDefenderAssets){ |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else if(player.getGuild() == serverCity.getBane().getStone().getGuild()){ |
|
|
|
|
|
|
|
//attacker attempting to place asset
|
|
|
|
|
|
|
|
if(numAttackerBuildings == maxAttackerAssets){ |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
|
|
//third party attempting to place asset, early exit
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((player.getGuild().equals(serverCity.getGuild())) && |
|
|
|
|
|
|
|
(numDefenderBuildings >= serverCity.getTOL().getRank())) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// passes validation: can assign auto-protection to war asset
|
|
|
|
// passes validation: can assign auto-protection to war asset
|
|
|
|
|
|
|
|
|
|
|
|
if (serverCity.getBane() != null) |
|
|
|
if (serverCity.getBane() != null) |
|
|
|