Browse Source

bane mechanic thread finalized

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

21
src/engine/objects/Bane.java

@ -728,7 +728,7 @@ public final class Bane { @@ -728,7 +728,7 @@ public final class Bane {
ArrayList<Integer> defenders = new ArrayList<>();
Guild attackNation = this.getOwner().getGuild().getNation();
Guild defendNation = this.getCity().getGuild().getNation();
for(int uuid : city.baneAttendees.keySet()){
for(int uuid : city._playerMemory){
PlayerCharacter player = PlayerCharacter.getPlayerCharacter(uuid);
if(player == null)
continue;
@ -739,12 +739,25 @@ public final class Bane { @@ -739,12 +739,25 @@ public final class Bane {
else if(playerNation.equals(attackNation))
attackers.add(uuid);
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
float attackerMultiplier = ZergManager.getCurrentMultiplier(attackers.size(),this.capSize);
float defenderMultiplier = ZergManager.getCurrentMultiplier(defenders.size(),this.capSize);
float attackerMultiplier = ZergManager.getCurrentMultiplier(attackerSize,this.capSize);
float defenderMultiplier = ZergManager.getCurrentMultiplier(defenderSize,this.capSize);
for(int uuid : attackers){
if(city._playerMemory.contains(uuid)) //player is still physically here, needs updated multiplier
PlayerCharacter.getPlayerCharacter(uuid).ZergMultiplier = attackerMultiplier;

16
src/engine/objects/City.java

@ -1012,7 +1012,7 @@ public class City extends AbstractWorldObject { @@ -1012,7 +1012,7 @@ public class City extends AbstractWorldObject {
// 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<>();
for (AbstractWorldObject playerObject : currentPlayers) {
@ -1062,19 +1062,19 @@ public class City extends AbstractWorldObject { @@ -1062,19 +1062,19 @@ public class City extends AbstractWorldObject {
}
private void onExitBane() {
ArrayList<Integer> toRemove = new ArrayList<>();
for(int uuid : this.baneAttendees.keySet()){
Iterator<Integer> iterator = this.baneAttendees.keySet().iterator();
while (iterator.hasNext()) {
Integer uuid = iterator.next();
if (!_playerMemory.contains(uuid)) {
if(System.currentTimeMillis() - this.baneAttendees.get(uuid) > 180000){
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) {
PlayerCharacter player;

Loading…
Cancel
Save