Add per-arena setting `clear-wave-leeway`.

Introduces a new arena setting that changes the "emptiness check" for 
`clear-wave-before-next`, `clear-wave-before-boss`, and the final wave 
check, allowing for a customizable _leeway_.

By default, the leeway is 0, which means the monster set has to be
completely empty for the checks to pass. With a value of 2, the set
may contain up to two monsters for the checks to pass, and so on.

The leeway should help alleviate some of the issues some people have
with their arena sessions when monsters "disappear" behind terrain or
end up in hard-to-reach areas. This is by no means a real "solution"
to the underlying problem, since the build-up of monsters in longer
sessions will just result in the issue being pushed to later waves.

We'll see if the setting leaves any additional customization to be
desired and perhaps defer any such requests to the Sessions Rework.

Closes #706
This commit is contained in:
Ghmmy 2022-02-12 16:57:47 +01:00 committed by GitHub
parent be6be4bb98
commit d5ea15fa08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -16,6 +16,7 @@ These changes will (most likely) be included in the next version.
- Husks, drowned, piglins, hoglins, and zoglins can now be spawned in their baby versions using the `baby` prefix seen on other monster types (e.g. `baby-zombie`).
- Pet names are now per-class configurable via the optional `pet-name` property, which defaults to `<display-name>'s pet` (the `<player-name>` variable is also supported).
- New per-arena setting `auto-leave-on-end` can be used to automatically "kick" spectators when the current session ends.
- New per-arena setting `clear-wave-leeway` allows for tweaking the number of mobs allowed to be alive before the next wave spawns. The setting affects `clear-wave-before-next`, `clear-wave-before-boss`, and the final wave check, and it defaults to 0.
- Added boss abilities `disorient-all`, `fetch-all`, `pull-all`, and `throw-all`. These abilities work like their target-specific and distance-based counterparts, but affect all players in the arena.
- (API) MobArena's internal command handler now supports registering pre-instantiated subcommand instances. This should make it easier for extensions to avoid the Singleton anti-pattern for command dependencies.
- (API) MobArena now fires MobArenaPreReloadEvent and MobArenaReloadEvent before and after, respectively, reloading its config-file. This should allow extensions and other plugins to better respond to configuration changes.

View File

@ -42,6 +42,7 @@ public class MASpawnThread implements Runnable
private int playerCount, monsterLimit;
private boolean waveClear, bossClear, preBossClear, wavesAsLevel;
private int clearLeeway;
private int waveInterval;
private int nextWaveDelay;
@ -76,6 +77,7 @@ public class MASpawnThread implements Runnable
waveClear = arena.getSettings().getBoolean("clear-wave-before-next", false);
bossClear = arena.getSettings().getBoolean("clear-boss-before-next", false);
preBossClear = arena.getSettings().getBoolean("clear-wave-before-boss", false);
clearLeeway = arena.getSettings().getInt("clear-wave-leeway", 0);
wavesAsLevel = arena.getSettings().getBoolean("display-waves-as-level", false);
waveInterval = arena.getSettings().getInt("wave-interval", 3);
nextWaveDelay = arena.getSettings().getInt("next-wave-delay", 0);
@ -308,18 +310,18 @@ public class MASpawnThread implements Runnable
return false;
}
// Check for wave and pre boss clear
if (waveClear && !monsterManager.getMonsters().isEmpty()) {
// Check for wave clear
if (waveClear && monsterManager.getMonsters().size() > clearLeeway) {
return false;
}
// Check for pre boss clear
if (preBossClear && waveManager.getNext().getType() == WaveType.BOSS && !monsterManager.getMonsters().isEmpty()) {
if (preBossClear && waveManager.getNext().getType() == WaveType.BOSS && monsterManager.getMonsters().size() > clearLeeway) {
return false;
}
// Check for final wave
if (!monsterManager.getMonsters().isEmpty() && waveManager.getWaveNumber() == waveManager.getFinalWave()) {
if (monsterManager.getMonsters().size() > clearLeeway && waveManager.getWaveNumber() == waveManager.getFinalWave()) {
return false;
}

View File

@ -7,6 +7,7 @@ default-class: ''
clear-wave-before-next: false
clear-boss-before-next: false
clear-wave-before-boss: false
clear-wave-leeway: 0
soft-restore: false
soft-restore-drops: false
require-empty-inv-join: false