Browse Source

bane mechanic thread finalized

lakebane2
FatBoy-DOTC 3 weeks ago
parent
commit
93025b72cd
  1. 21
      src/engine/objects/Bane.java
  2. 20
      src/engine/objects/City.java

21
src/engine/objects/Bane.java

@ -728,7 +728,7 @@ public final class Bane {
ArrayList<Integer> defenders = new ArrayList<>(); ArrayList<Integer> defenders = new ArrayList<>();
Guild attackNation = this.getOwner().getGuild().getNation(); Guild attackNation = this.getOwner().getGuild().getNation();
Guild defendNation = this.getCity().getGuild().getNation(); Guild defendNation = this.getCity().getGuild().getNation();
for(int uuid : city.baneAttendees.keySet()){ for(int uuid : city._playerMemory){
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid); PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid);
if(player == null) if(player == null)
continue; continue;
@ -739,12 +739,25 @@ public final class Bane {
else if(playerNation.equals(attackNation)) else if(playerNation.equals(attackNation))
attackers.add(uuid); attackers.add(uuid);
else else
MovementManager.translocate(player,player.bindLoc,Regions.GetRegionForTeleport(player.bindLoc)); if(city._playerMemory.contains(uuid))
MovementManager.translocate(player,new Vector3fImmutable(88853,32,45079),Regions.GetRegionForTeleport(player.bindLoc));
}
int attackerSize = 0;
int defenderSize = 0;
for(int uuid : city.baneAttendees.keySet()){
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid);
if(player == null)
continue;
if(player.guild.getNation().equals(defendNation))
defenderSize += 1;
else if(player.guild.getNation().equals(attackNation))
attackerSize += 1;
} }
this.capSize = 3;
//apply zerg mechanic for attackers //apply zerg mechanic for attackers
float attackerMultiplier = ZergManager.getCurrentMultiplier(attackers.size(),this.capSize); float attackerMultiplier = ZergManager.getCurrentMultiplier(attackerSize,this.capSize);
float defenderMultiplier = ZergManager.getCurrentMultiplier(defenders.size(),this.capSize); float defenderMultiplier = ZergManager.getCurrentMultiplier(defenderSize,this.capSize);
for(int uuid : attackers){ for(int uuid : attackers){
if(city._playerMemory.contains(uuid)) //player is still physically here, needs updated multiplier if(city._playerMemory.contains(uuid)) //player is still physically here, needs updated multiplier
PlayerCharacter.getPlayerCharacter(uuid).ZergMultiplier = attackerMultiplier; PlayerCharacter.getPlayerCharacter(uuid).ZergMultiplier = attackerMultiplier;

20
src/engine/objects/City.java

@ -1012,7 +1012,7 @@ public class City extends AbstractWorldObject {
// Gather current list of players within the zone bounds // Gather current list of players within the zone bounds
currentPlayers = WorldGrid.getObjectsInRangePartial(this.location, CityBoundsType.ZONE.extents, MBServerStatics.MASK_PLAYER); currentPlayers = WorldGrid.getObjectsInRangePartial(this.location, CityBoundsType.ZONE.extents * 2, MBServerStatics.MASK_PLAYER);
currentMemory = new HashSet<>(); currentMemory = new HashSet<>();
for (AbstractWorldObject playerObject : currentPlayers) { for (AbstractWorldObject playerObject : currentPlayers) {
@ -1061,20 +1061,20 @@ public class City extends AbstractWorldObject {
} }
} }
private void onExitBane(){ private void onExitBane() {
ArrayList<Integer> toRemove = new ArrayList<>(); Iterator<Integer> iterator = this.baneAttendees.keySet().iterator();
for(int uuid : this.baneAttendees.keySet()){ while (iterator.hasNext()) {
if(!_playerMemory.contains(uuid)){ Integer uuid = iterator.next();
if(System.currentTimeMillis() - this.baneAttendees.get(uuid) > 180000){ if (!_playerMemory.contains(uuid)) {
toRemove.add(uuid); long timeGone = System.currentTimeMillis() - this.baneAttendees.get(uuid).longValue();
if (timeGone > 180000) { // 3 minutes
iterator.remove();
} }
} }
} }
for(Integer uuid : toRemove){
this.baneAttendees.remove(uuid);
}
} }
private void onExit(HashSet<Integer> currentMemory) { private void onExit(HashSet<Integer> currentMemory) {
PlayerCharacter player; PlayerCharacter player;

Loading…
Cancel
Save