Browse Source

zerg mechanic work

lakebane-master
FatBoy-DOTC 7 months ago
parent
commit
e47430e61b
  1. 2
      src/engine/objects/Mine.java
  2. 22
      src/engine/workthreads/ZergMechanicThread.java

2
src/engine/objects/Mine.java

@ -582,7 +582,7 @@ public class Mine extends AbstractGameObject { @@ -582,7 +582,7 @@ public class Mine extends AbstractGameObject {
if(isAc) {
Thread zergMechanicThread = new Thread(new ZergMechanicThread(null, this));
zergMechanicThread.setName(this.zoneName + "Mine");
zergMechanicThread.setName(this.parentZone.getName() + "Mine");
zergMechanicThread.start();
}
}

22
src/engine/workthreads/ZergMechanicThread.java

@ -33,29 +33,22 @@ import static engine.server.MBServerStatics.MINE_LATE_WINDOW; @@ -33,29 +33,22 @@ import static engine.server.MBServerStatics.MINE_LATE_WINDOW;
public class ZergMechanicThread implements Runnable {
public Bane bane = null;
public Mine mine = null;
public boolean isMine = false;
public ZergMechanicThread(Bane b, Mine m) {
if(b != null){
this.isMine = false;
}
if(m != null){
this.isMine = true;
}
}
@Override
public void run() {
while(mine != null && mine.isActive)
if (mine != null)
RunMineMechanic();
while(bane != null && bane.getSiegePhase().equals(Enum.SiegePhase.WAR))
if (bane != null)
RunBaneMechanic();
}
public void RunMineMechanic(){
while(mine.isActive) {
HashSet<AbstractWorldObject> currentPlayers;
PlayerCharacter player;
@ -88,7 +81,8 @@ public boolean isMine = false; @@ -88,7 +81,8 @@ public boolean isMine = false;
mine.dividedPlayers = new HashMap<>();
for (Integer playerID : mine._playerMemory) {
player = PlayerCharacter.getFromCache(playerID);
Guild nation = player.getGuild().getNation(); Guild entry;
Guild nation = player.getGuild().getNation();
Guild entry;
if (mine.dividedPlayers.containsKey(nation)) {
mine.dividedPlayers.get(nation).add(playerID);
} else {
@ -122,8 +116,10 @@ public boolean isMine = false; @@ -122,8 +116,10 @@ public boolean isMine = false;
}
}
}
}
public void RunBaneMechanic(){
while(bane.getSiegePhase().equals(Enum.SiegePhase.WAR)) {
HashSet<AbstractWorldObject> currentPlayers;
currentPlayers = WorldGrid.getObjectsInRangePartial(bane.getCity().loc, Enum.CityBoundsType.GRID.extents * 2.0f, MBServerStatics.MASK_PLAYER);
@ -165,6 +161,6 @@ public boolean isMine = false; @@ -165,6 +161,6 @@ public boolean isMine = false;
pc.ZergMultiplier = ZergManager.getMultiplier20Man(defenders.size());
}
}
}
}
}

Loading…
Cancel
Save