From 174bceb49ee1c9ac526ebb54e1c792a648a7e00e Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 2 Mar 2024 15:42:07 -0600 Subject: [PATCH] combat bug fix --- src/engine/objects/Mine.java | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/engine/objects/Mine.java b/src/engine/objects/Mine.java index 1940c588..38c63b1c 100644 --- a/src/engine/objects/Mine.java +++ b/src/engine/objects/Mine.java @@ -695,8 +695,10 @@ public class Mine extends AbstractGameObject { // ***For debugging // Logger.info("PlayerMemory for ", this.getCityName() + ": " + _playerMemory.size()); } + boolean updated = false; try { - onExitZerg(currentPlayers); + //updated = onExitZerg(currentPlayers); + updated = onExit(currentPlayers); } catch (Exception e) { Logger.error(e.getMessage()); } @@ -737,7 +739,23 @@ public class Mine extends AbstractGameObject { } //} } - + private Boolean onExit(HashSet currentPlayers){ + ArrayList purge = new ArrayList<>(); + for(int id : this._playerMemory){ + PlayerCharacter player = PlayerCharacter.getPlayerCharacter(id); + if(currentPlayers.contains(player) == false){ + purge.add(id); + player.ZergMultiplier = 1.0f; + ChatManager.chatSystemInfo(player,"Left Mine, Multiplier: " + player.ZergMultiplier); + } + } + if(purge.size() > 0) { + this._playerMemory.removeAll(purge); + return true; + } else{ + return false; + } + } private Boolean onExitZerg(HashSet currentPlayers) { PlayerCharacter player; @@ -774,6 +792,9 @@ public class Mine extends AbstractGameObject { } for(Integer id : purge){ this._recentMemory.remove(id); + this._playerMemory.remove(id); + PlayerCharacter.getPlayerCharacter(playerUUID).mineAppliedID = 0; + PlayerCharacter.getPlayerCharacter(playerUUID).ZergMultiplier = 1.0f; } if(toRemove.isEmpty()){ return false;