Skip to content

Commit

Permalink
reduce purge powerups, fix early purge wave end, try to fix airbase bug
Browse files Browse the repository at this point in the history
  • Loading branch information
GlennnM committed Nov 30, 2023
1 parent 62f5200 commit 88188f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
2 changes: 1 addition & 1 deletion flash.properties
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ SAS3.enabled=true
SAS3.port=8044
SAS3.mobcap=10000
SAS3.nio=true
SAS3.client=mspt=50;timeout=60000;in=(1024,16384);out=(1024,1024,locked)
SAS3.client=mspt=50;timeout=60000;in=(1024,16384);out=(1024,4096,locked)
#
CS.enabled=true
CS.port=7988
Expand Down
31 changes: 12 additions & 19 deletions src/java/xyz/hydar/flash/S3Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void onMessage(String m){
break;
}
msg.set(2, "" + cmd);
msg.set(3, "" + room.flashTime());
msg.set(3, "" + msg.get(6));
msg.set(4, "" + -1);
if (cmd == 4) {
this.ready = true;
Expand Down Expand Up @@ -282,14 +282,13 @@ public void run() {
+ "%" + room.waveTotal + "%\0");
room.flushAll();
if (room.mode == 1) {
Room.timer.schedule(new SpawnNestTask(room), 5000, TimeUnit.MILLISECONDS);
Room.timer.schedule(new PowerupTask(room), 7000, TimeUnit.MILLISECONDS);
Room.timer.schedule(new SpawnNestTask(room), 4000, TimeUnit.MILLISECONDS);
} else {
Room.timer.schedule(new SpawnTask(room), 5000, TimeUnit.MILLISECONDS);
Room.timer.schedule(new PowerupTask(room), 30000, TimeUnit.MILLISECONDS);
}
Room.timer.schedule(new PowerupTask(room), 30000, TimeUnit.MILLISECONDS);
room.init = true;
room.r = false;
room.r.set(false);
}
}
/**Spawns a set of mobs in a lobby when ran. If the wave changes while active, it will be cancelled.*/
Expand Down Expand Up @@ -374,6 +373,7 @@ public void run() {
return;
}
room.spawnNests();
room.p1++;
Room.timer.schedule(new SpawnTask(room), 1000,TimeUnit.MILLISECONDS);
}
}
Expand Down Expand Up @@ -448,10 +448,8 @@ public void run() {
};
player.doubleWrite("%xt%16%-1%" + 0 + "%" + loc7 + "%" + type + "%" + item + "%\0");
}
if (room.mode == 1) {
Room.timer.schedule(new PowerupTask(room), 15000,TimeUnit.MILLISECONDS);
return;
}
if (room.mode == 1)
Room.timer.schedule(new PowerupTask(room), 30000,TimeUnit.MILLISECONDS);
}
}
/**index is the type ID, weight and chance affect spawning, cap affects spawning as well as round ends.*/
Expand Down Expand Up @@ -503,7 +501,7 @@ class Room {
};
private static final int[][] POWERUP_LOCATIONS= {null,//map 0
{ 0, 1, 2, 3 },
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 },
{ 0, 1, 3, 4, 5, 6, 7, 8, 9, 10 },//location 2 excluded
{ 1, 3, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
28, 29, 30 },
{ 0, 2, 3, 6, 7, 12, 13, 14, 15, 17, 21, 26, 33, 35, 37, 38 },
Expand Down Expand Up @@ -554,7 +552,7 @@ static record Nest(Zombie z, int point) {}
public volatile boolean setup = false;
public volatile boolean init = false;
public volatile boolean alive = true;
public volatile boolean r = true;//ready for spawns
public final AtomicBoolean r=new AtomicBoolean(true);//ready for spawns
// SPAWNER ARGS
public volatile int p1 = 0;// §[D§
public volatile float p2 = 0f;// §]?§
Expand Down Expand Up @@ -748,7 +746,7 @@ public String spawnCmd(ZombieType z, int parent, int flashTime) {
// the locations are integers(found in the swf)
int znum=nextSpawnNum.incrementAndGet();
int target=targets.isEmpty() ? -1 : targets.get((parent>=0?parent:znum)%targets.size());
if(mode==1 && nests.isEmpty())return "";
if(mode==1 && parent==-1 && nests.isEmpty())return "";
int spawn = parent>=0?-1:(mode==1?nests.get(znum%nests.size()).point():
spawns[znum%spawns.length]);
zombies.put(znum, new Zombie(z, target, SBEmult));
Expand Down Expand Up @@ -858,10 +856,9 @@ public void parseDamage(String dmgStr, S3Client player) {
if (spawnCmd.length()>0) {
writeAll(spawnCmd.toString());
}
if (tryEndWave && mode!=1&&init && p1 >= p4 && !(bracket3(3)) && !r){
if (tryEndWave && init && (mode!=1 || nests.isEmpty()) && (p1 >= (mode==1?1:p4)) && !(bracket3(3)) && r.compareAndSet(false,true)){
if (S3Server.verbose)
System.out.println("||||||Wave end");
r = true;
endWave();
}
flushAll();
Expand Down Expand Up @@ -893,10 +890,6 @@ public void finishKill(Zombie zombie, int znum, StringBuilder spawnCmd) {
break;
case NEST:
nests.removeIf(x->x.z()==zombie);
if (nests.isEmpty()) {
r = true;
endWave();
}
break;
default:
break;
Expand All @@ -918,7 +911,7 @@ public void endWave() {
}
zombies.clear();
totalCapacity.reset();
nextSpawnNum.set(ThreadLocalRandom.current().nextInt(4));
nextSpawnNum.addAndGet(ThreadLocalRandom.current().nextInt(4));
hitCmd.deleteCharAt(hitCmd.length() - 1).append("%\0");
writeAll(hitCmd.toString());
flushAll();
Expand Down

0 comments on commit 88188f2

Please sign in to comment.