From 05809151501d5f58dd5b75936900b449770db7cd Mon Sep 17 00:00:00 2001 From: nyuszika7h Date: Mon, 24 Oct 2016 17:25:51 +0200 Subject: [PATCH] Allow specifying lover wins with fool in !fgame roles --- messages/en.json | 1 + src/gamemodes.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/messages/en.json b/messages/en.json index 979ecad..c6ba9fa 100644 --- a/messages/en.json +++ b/messages/en.json @@ -683,6 +683,7 @@ "invalid_reveal": "Did not recognize value \u0002{0}\u0002 for role reveal. Allowed values: on, off, team", "invalid_stats": "Did not recognize value \u0002{0}\u0002 for stats type. Allowed values: default, accurate, team, disabled", "invalid_abstain": "Did not recognize value \u0002{0}\u0002 for abstain. Allowed values: enabled, restricted, disabled", + "invalid_lover_wins_with_fool": "Did not recognize value \u0002{0}\u0002 for lover wins with fool. Allowed values: true, false", "lovers_win": "Game over! The remaining villagers through their inseparable love for each other have agreed to stop all of this senseless violence and coexist in peace forever more. All remaining players win.", "everyone_died_won": "Game over! Everyone is dead, and it is in death that they realize this is what they wanted all along. They remain in the village as joyful spirits ever since. Everyone wins.", "role_disabled": "The role \u0002{0}\u0002 has been disabled.", diff --git a/src/gamemodes.py b/src/gamemodes.py index 282bb31..e1e9284 100644 --- a/src/gamemodes.py +++ b/src/gamemodes.py @@ -92,6 +92,10 @@ class GameMode: self.LIMIT_ABSTAIN = True elif val == "disabled": self.ABSTAIN_ENABLED = False + elif key == "lover wins with fool": + if val not in ("true", "false"): + raise InvalidModeException(messages["invalid_lover_wins_with_fool"].format(val)) + self.LOVER_WINS_WITH_FOOL = True if val == "true" else False def startup(self): pass @@ -148,7 +152,7 @@ class ChangedRolesMode(GameMode): self.ROLE_GUIDE[role.lower()] = tuple([int(num)] * len(var.ROLE_INDEX)) elif role.lower() == "default" and num.lower() in self.ROLE_GUIDE: self.DEFAULT_ROLE = num.lower() - elif role.lower() in ("role reveal", "reveal roles", "stats type", "stats", "abstain"): + elif role.lower() in ("role reveal", "reveal roles", "stats type", "stats", "abstain", "lover wins with fool"): # handled in parent constructor pass else: