From 8ab97a1b36451047ee82f69b1f9fdcab460f6c25 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 29 Dec 2024 21:19:20 -0600 Subject: [PATCH] bane zerg mechanics enabled --- src/engine/gameManager/SimulationManager.java | 6 +++ src/engine/objects/Bane.java | 37 +++++++++++++++++++ src/engine/objects/City.java | 1 - 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/engine/gameManager/SimulationManager.java b/src/engine/gameManager/SimulationManager.java index 3d00bf0b..d68c02d5 100644 --- a/src/engine/gameManager/SimulationManager.java +++ b/src/engine/gameManager/SimulationManager.java @@ -204,6 +204,12 @@ public enum SimulationManager { if(mine != null && mine.isActive) mine.onEnter(); } + for(int baneId : Bane.banes.keySet()){ + Bane bane = Bane.banes.get(baneId); + if(bane.getSiegePhase().equals(Enum.SiegePhase.WAR)){ + bane.applyZergBuffs(); + } + } _cityPulseTime = System.currentTimeMillis() + CITY_PULSE; } diff --git a/src/engine/objects/Bane.java b/src/engine/objects/Bane.java index c691ae23..82508e63 100644 --- a/src/engine/objects/Bane.java +++ b/src/engine/objects/Bane.java @@ -683,4 +683,41 @@ public final class Bane { return cityUUID; } + public void applyZergBuffs(){ + City city = this.getCity(); + if(city == null) + return; + + ArrayList attackers = new ArrayList<>(); + ArrayList defenders = new ArrayList<>(); + ArrayList crashers = new ArrayList<>(); + for(int uuid : city.baneAttendees.keySet()){ + PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid); + if(player == null) + continue; + + //separate the players into categories + if(player.guild.getNation().equals(city.getGuild().getNation())) + defenders.add(uuid); + else if(player.guild.getNation().equals(this.getOwner().getGuild().getNation())) + attackers.add(uuid); + else + player.teleport(player.bindLoc); + } + + //apply zerg mechanic for attackers + float attackerMultiplier = ZergManager.getCurrentMultiplier(attackers.size(),this.capSize); + float defenderMultiplier = ZergManager.getCurrentMultiplier(defenders.size(),this.capSize); + for(int uuid : attackers){ + if(city._playerMemory.contains(uuid)) //player is still physically here, needs updated multiplier + PlayerCharacter.getPlayerCharacter(uuid).ZergMultiplier = attackerMultiplier; + } + + for(int uuid : defenders){ + if(city._playerMemory.contains(uuid)) //player is still physically here, needs updated multiplier + PlayerCharacter.getPlayerCharacter(uuid).ZergMultiplier = defenderMultiplier; + } + + } + } diff --git a/src/engine/objects/City.java b/src/engine/objects/City.java index 5b2a43db..f2f4db34 100644 --- a/src/engine/objects/City.java +++ b/src/engine/objects/City.java @@ -1055,7 +1055,6 @@ public class City extends AbstractWorldObject { } catch (Exception e) { Logger.error(e.getMessage()); } - } private void onExitBane(){