Implements #13 and #14

Removes deaths and time as separate game-modes, and instead always tracks records.
Adds two proper game-modes. One inverts the player's controls, and the other randomly inverts the player's controls every 7 seconds.
Saves cleared status and records for each game-mode separately
Only allows 0-1 for the horizontal velocity
Requires arenas in arena groups to be cleared in sequence on all game-modes, not just the default one.
This commit is contained in:
2023-03-30 14:59:44 +02:00
parent 572bb980c1
commit f9008ca050
14 changed files with 258 additions and 108 deletions

View File

@ -120,7 +120,7 @@ public class EditArenaCommand implements CommandExecutor {
}
// If outside bonds, choose the most extreme value
return Math.min(Math.max(-1, velocity), 1);
return Math.min(Math.max(0.1f, velocity), 1);
}
/**

View File

@ -76,9 +76,10 @@ public class JoinArenaCommand implements CommandExecutor {
return false;
}
// Make sure the player has beaten the arena once before playing a challenge mode
if (gameMode != ArenaGameMode.DEFAULT && specifiedArena.getData().hasNotCompleted(player)) {
player.sendMessage("You must complete this arena in normal mode before starting a challenge!");
// Make sure the player has beaten the arena once in normal mode before playing another mode
if (gameMode != ArenaGameMode.DEFAULT &&
specifiedArena.getData().hasNotCompleted(ArenaGameMode.DEFAULT, player)) {
player.sendMessage("You must complete this arena in normal mode first!");
return false;
}
@ -112,18 +113,20 @@ public class JoinArenaCommand implements CommandExecutor {
*/
private boolean doGroupChecks(@NotNull DropperArena dropperArena, @NotNull DropperArenaGroup arenaGroup,
@NotNull ArenaGameMode arenaGameMode, @NotNull Player player) {
if (arenaGameMode == ArenaGameMode.DEFAULT) {
if (!arenaGroup.canPlay(player, dropperArena.getArenaId())) {
player.sendMessage("You have not yet beaten the previous arena!");
return false;
}
} else {
if (arenaGroup.hasBeatenAll(player)) {
// Require that players beat all arenas in the group in the normal game-mode before trying challenge modes
if (arenaGameMode != ArenaGameMode.DEFAULT) {
if (!arenaGroup.hasBeatenAll(ArenaGameMode.DEFAULT, player)) {
player.sendMessage("You have not yet beaten all arenas in this group!");
return false;
}
}
// Require that the player has beaten the previous arena on the same game-mode before trying this one
if (!arenaGroup.canPlay(arenaGameMode, player, dropperArena.getArenaId())) {
player.sendMessage("You have not yet beaten the previous arena!");
return false;
}
return true;
}

View File

@ -23,8 +23,8 @@ public class JoinArenaTabCompleter implements TabCompleter {
} else if (arguments.length == 2) {
List<String> gameModes = new ArrayList<>();
gameModes.add("default");
gameModes.add("deaths");
gameModes.add("time");
gameModes.add("inverted");
gameModes.add("random");
return gameModes;
} else {
return new ArrayList<>();