mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 13:36:33 +01:00
Add GAME_GOAL game rule
This commit is contained in:
parent
c6454057f4
commit
49b94f8c82
@ -63,6 +63,10 @@ public class GameRule<V> {
|
||||
* If the Lobby is disabled. This applies only to Dungeons that have to be solved alone and where there are no classes to choose from.
|
||||
*/
|
||||
public static final GameRule<Boolean> IS_LOBBY_DISABLED = new GameRule<>(Boolean.class, "isLobbyDisabled", false);
|
||||
/**
|
||||
* The goal of the game that defines what makes it end.
|
||||
*/
|
||||
public static final GameRule<GameGoal> GAME_GOAL = new GameRule<>(GameGoal.class, "gameGoal", GameGoal.END);
|
||||
/**
|
||||
* The game mode.
|
||||
*/
|
||||
|
@ -752,7 +752,8 @@ public class DGamePlayer extends DInstancePlayer implements GamePlayer {
|
||||
event.setDeathMessage(null);
|
||||
}
|
||||
|
||||
if (game.getRules().getState(GameRule.KEEP_INVENTORY_ON_DEATH)) {
|
||||
GameRuleContainer rules = game.getRules();
|
||||
if (rules.getState(GameRule.KEEP_INVENTORY_ON_DEATH)) {
|
||||
event.setKeepInventory(true);
|
||||
event.getDrops().clear();
|
||||
event.setKeepLevel(true);
|
||||
@ -792,12 +793,9 @@ public class DGamePlayer extends DInstancePlayer implements GamePlayer {
|
||||
kill();
|
||||
}
|
||||
|
||||
GameType gameType = game.getType();
|
||||
if (gameType != null && gameType != GameTypeDefault.CUSTOM) {
|
||||
if (gameType.getGameGoal() == GameGoal.LAST_MAN_STANDING) {
|
||||
if (game.getGroups().size() == 1) {
|
||||
((DGroup) game.getGroups().get(0)).winGame();
|
||||
}
|
||||
if (rules.getState(GameRule.GAME_GOAL) == GameGoal.LAST_MAN_STANDING) {
|
||||
if (game.getGroups().size() == 1) {
|
||||
((DGroup) game.getGroups().get(0)).winGame();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user