diff --git a/src/engine/gameManager/ZergManager.java b/src/engine/gameManager/ZergManager.java index 5274eaf3..337bc4ed 100644 --- a/src/engine/gameManager/ZergManager.java +++ b/src/engine/gameManager/ZergManager.java @@ -1,7 +1,19 @@ package engine.gameManager; +import engine.objects.Guild; + public class ZergManager { + public static int getBaneCap(Guild guild){ + if(guild.getOwnedCity().getTOL().getRank() == 8) + return 20; + + if(guild.getNation().getSubGuildList().size() + 1 <= 4) + return 10; + + return 20; + } + public static float getMultiplier3Man(int count){ float multiplier = 1.0f; diff --git a/src/engine/objects/Bane.java b/src/engine/objects/Bane.java index 2be53ca0..32ac9690 100644 --- a/src/engine/objects/Bane.java +++ b/src/engine/objects/Bane.java @@ -106,12 +106,7 @@ public final class Bane { if (this.liveDate == null) setDefaultTime(); - if(this.getCity().getTOL().getRank() == 8) - this.capSize = 40; - else - this.capSize = 20; - - this.getCity().setSiegesWithstood(this.capSize); + this.capSize = ZergManager.getBaneCap(this.getCity().getGuild()); } public static boolean summonBanestone(PlayerCharacter player, ClientConnection origin, int rank) { diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index 1a92017a..99f74311 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -321,16 +321,7 @@ public class City extends AbstractWorldObject { writer.putFloat(city.location.x); writer.putFloat(city.location.y); writer.putFloat(city.location.z); - - //writer.putInt(city.siegesWithstood); - if(city.getBane() != null) { - writer.putInt(city.siegesWithstood); - } else{ - if(city.getTOL().getRank() == 8) - writer.putInt(40); - else - writer.putInt(20); - } + writer.putInt(ZergManager.getBaneCap(city.getGuild())); writer.put((byte) 1); writer.put((byte) 0); writer.putInt(0x64); diff --git a/src/engine/workthreads/ZergMechanicThread.java b/src/engine/workthreads/ZergMechanicThread.java index bbc14fe8..58e6231e 100644 --- a/src/engine/workthreads/ZergMechanicThread.java +++ b/src/engine/workthreads/ZergMechanicThread.java @@ -158,21 +158,27 @@ public ArrayList affectedPlayers = new ArrayList<>(); defenders.add(pc); } - int treeRank = bane.getCity().getTOL().getRank(); + //int treeRank = bane.getCity().getTOL().getRank(); for (PlayerCharacter pc : attackers) { - if (treeRank == 8) { - pc.ZergMultiplier = ZergManager.getMultiplier40Man(attackers.size()); - } else { - pc.ZergMultiplier = ZergManager.getMultiplier20Man(attackers.size()); + switch(bane.capSize){ + case 10: + pc.ZergMultiplier = ZergManager.getMultiplier10Man(attackers.size()); + break; + case 20: + pc.ZergMultiplier = ZergManager.getMultiplier20Man(attackers.size()); + break; } } for (PlayerCharacter pc : defenders) { - if (treeRank == 8) { - pc.ZergMultiplier = ZergManager.getMultiplier40Man(defenders.size()); - } else { - pc.ZergMultiplier = ZergManager.getMultiplier20Man(defenders.size()); + switch(bane.capSize){ + case 10: + pc.ZergMultiplier = ZergManager.getMultiplier10Man(defenders.size()); + break; + case 20: + pc.ZergMultiplier = ZergManager.getMultiplier20Man(defenders.size()); + break; } } }