Browse Source

combat bug fix

lakebane-master
FatBoy-DOTC 9 months ago
parent
commit
e3ec8d7737
  1. 23
      src/engine/objects/Mine.java

23
src/engine/objects/Mine.java

@ -56,7 +56,6 @@ public class Mine extends AbstractGameObject {
public final HashSet<Integer> _playerMemory = new HashSet<>(); public final HashSet<Integer> _playerMemory = new HashSet<>();
public final HashMap<Integer,Long> _recentMemory = new HashMap<>(); public final HashMap<Integer,Long> _recentMemory = new HashMap<>();
HashMap<Guild,ArrayList<Integer>> dividedPlayers; HashMap<Guild,ArrayList<Integer>> dividedPlayers;
public Integer totalPlayers;
public boolean hasProduced = false; public boolean hasProduced = false;
@ -674,8 +673,7 @@ public class Mine extends AbstractGameObject {
// Gather current list of players within the zone bounds // Gather current list of players within the zone bounds
Building tower = BuildingManager.getBuildingFromCache(this.buildingID); Building tower = BuildingManager.getBuildingFromCache(this.buildingID);
currentPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, Enum.CityBoundsType.GRID.extents, MBServerStatics.MASK_PLAYER); currentPlayers = WorldGrid.getObjectsInRangePartial(tower.loc, Enum.CityBoundsType.GRID.extents * 0.5f, MBServerStatics.MASK_PLAYER);
boolean updated = false;
for (AbstractWorldObject playerObject : currentPlayers) { for (AbstractWorldObject playerObject : currentPlayers) {
@ -685,23 +683,20 @@ public class Mine extends AbstractGameObject {
player = (PlayerCharacter) playerObject; player = (PlayerCharacter) playerObject;
// Player is already in our memory // Player is already in our memory
if (_recentMemory.containsKey(player.getObjectUUID())) if (this._recentMemory.containsKey(player.getObjectUUID()))
_recentMemory.remove(player.getObjectUUID()); this._recentMemory.remove(player.getObjectUUID());
if (_playerMemory.contains(player.getObjectUUID())) if (this._playerMemory.contains(player.getObjectUUID()))
continue; continue;
// Add player to our city's memory // Add player to our city's memory
_playerMemory.add(player.getObjectUUID()); this._playerMemory.add(player.getObjectUUID());
updated = true;
// ***For debugging // ***For debugging
// Logger.info("PlayerMemory for ", this.getCityName() + ": " + _playerMemory.size()); // Logger.info("PlayerMemory for ", this.getCityName() + ": " + _playerMemory.size());
} }
this.totalPlayers = this._playerMemory.size();
try { try {
updated = onExitZerg(currentPlayers); onExitZerg(currentPlayers);
} catch (Exception e) { } catch (Exception e) {
Logger.error(e.getMessage()); Logger.error(e.getMessage());
} }
@ -760,8 +755,8 @@ public class Mine extends AbstractGameObject {
continue; continue;
toRemove.add(playerUUID); toRemove.add(playerUUID);
if(_recentMemory.containsKey(playerUUID) == false) { if(this._recentMemory.containsKey(playerUUID) == false) {
_recentMemory.put(playerUUID, System.currentTimeMillis()); this._recentMemory.put(playerUUID, System.currentTimeMillis());
PlayerCharacter.getPlayerCharacter(playerUUID).mineAppliedID = 0; PlayerCharacter.getPlayerCharacter(playerUUID).mineAppliedID = 0;
PlayerCharacter.getPlayerCharacter(playerUUID).ZergMultiplier = 1.0f; PlayerCharacter.getPlayerCharacter(playerUUID).ZergMultiplier = 1.0f;
} }
@ -778,7 +773,7 @@ public class Mine extends AbstractGameObject {
} }
} }
for(Integer id : purge){ for(Integer id : purge){
_recentMemory.remove(id); this._recentMemory.remove(id);
} }
if(toRemove.isEmpty()){ if(toRemove.isEmpty()){
return false; return false;

Loading…
Cancel
Save