increase likelihood of default-like rolesets, make rapid/drunkfire and amnesia only picked from a majority of the votes

This commit is contained in:
jacob1 2014-11-29 14:17:19 -05:00
parent 193ead22aa
commit 9e83ac941c
2 changed files with 20 additions and 19 deletions

View File

@ -4874,7 +4874,7 @@ def start(cli, nick, chann_, rest):
else: else:
possiblegamemodes = [] possiblegamemodes = []
for gamemode in var.GAME_MODES.keys(): for gamemode in var.GAME_MODES.keys():
if len(villagers) >= var.GAME_MODES[gamemode][1] and len(villagers) <= var.GAME_MODES[gamemode][2]: if len(villagers) >= var.GAME_MODES[gamemode][1] and len(villagers) <= var.GAME_MODES[gamemode][2] and var.GAME_MODES[gamemode][3] > 0:
possiblegamemodes += [gamemode]*(var.GAME_MODES[gamemode][3]+votes.get(gamemode, 0)*7) possiblegamemodes += [gamemode]*(var.GAME_MODES[gamemode][3]+votes.get(gamemode, 0)*7)
cgamemode(cli, random.choice(possiblegamemodes)) cgamemode(cli, random.choice(possiblegamemodes))
@ -5945,7 +5945,7 @@ def game(cli, nick, chan, rest):
gamemode = rest.lower().split()[0] gamemode = rest.lower().split()[0]
else: else:
gamemodes = ", ".join(["\002{}\002".format(gamemode) if len(var.list_players()) in range(var.GAME_MODES[gamemode][1], gamemodes = ", ".join(["\002{}\002".format(gamemode) if len(var.list_players()) in range(var.GAME_MODES[gamemode][1],
var.GAME_MODES[gamemode][2]+1) else gamemode for gamemode in var.GAME_MODES.keys() if var.GAME_MODES[gamemode][3] > 0]) var.GAME_MODES[gamemode][2]+1) else gamemode for gamemode in var.GAME_MODES.keys() if gamemode != "roles"])
cli.notice(nick, "No game mode specified. Available game modes: " + gamemodes) cli.notice(nick, "No game mode specified. Available game modes: " + gamemodes)
return return
@ -5953,9 +5953,9 @@ def game(cli, nick, chan, rest):
#players can vote by only using partial name #players can vote by only using partial name
matches = 0 matches = 0
possiblegamemode = gamemode possiblegamemode = gamemode
for gamemode in var.GAME_MODES.keys(): for mode in var.GAME_MODES.keys():
if gamemode.startswith(gamemode) and var.GAME_MODES[gamemode][3] > 0: if mode.startswith(gamemode) and mode != "roles":
possiblegamemode = gamemode possiblegamemode = mode
matches += 1 matches += 1
if matches != 1: if matches != 1:
cli.notice(nick, "\002{0}\002 is not a valid game mode.".format(gamemode)) cli.notice(nick, "\002{0}\002 is not a valid game mode.".format(gamemode))
@ -5963,7 +5963,7 @@ def game(cli, nick, chan, rest):
else: else:
gamemode = possiblegamemode gamemode = possiblegamemode
if var.GAME_MODES[gamemode][3] > 0: if gamemode != "roles":
var.GAMEMODE_VOTES[cloak] = gamemode var.GAMEMODE_VOTES[cloak] = gamemode
cli.msg(chan, "\002{0}\002 votes for the \002{1}\002 game mode.".format(nick, gamemode)) cli.msg(chan, "\002{0}\002 votes for the \002{1}\002 game mode.".format(nick, gamemode))
else: else:
@ -5972,7 +5972,7 @@ def game(cli, nick, chan, rest):
def game_help(args=''): def game_help(args=''):
return "Votes to make a specific game mode more likely. Available game mode setters: " +\ return "Votes to make a specific game mode more likely. Available game mode setters: " +\
", ".join(["\002{}\002".format(gamemode) if len(var.list_players()) in range(var.GAME_MODES[gamemode][1], var.GAME_MODES[gamemode][2]+1) ", ".join(["\002{}\002".format(gamemode) if len(var.list_players()) in range(var.GAME_MODES[gamemode][1], var.GAME_MODES[gamemode][2]+1)
else gamemode for gamemode in var.GAME_MODES.keys() if var.GAME_MODES[gamemode][3] > 0]) else gamemode for gamemode in var.GAME_MODES.keys() if gamemode != "roles"])
game.__doc__ = game_help game.__doc__ = game_help
@cmd("fpull", admin_only=True) @cmd("fpull", admin_only=True)

View File

@ -296,7 +296,7 @@ def reset_roles(index):
return newguide return newguide
# TODO: implement more game modes # TODO: implement more game modes
@game_mode("roles", 4, 35) @game_mode("roles", minp = 4, maxp = 35)
class ChangedRolesMode(object): class ChangedRolesMode(object):
"""Example: !fgame roles=wolf:1,seer:0,guardian angel:1""" """Example: !fgame roles=wolf:1,seer:0,guardian angel:1"""
@ -339,14 +339,14 @@ class ChangedRolesMode(object):
except ValueError: except ValueError:
raise InvalidModeException("A bad value was used in mode roles.") raise InvalidModeException("A bad value was used in mode roles.")
@game_mode("default", 4, 24, 7) @game_mode("default", minp = 4, maxp = 24, likelihood = 10)
class DefaultMode(object): class DefaultMode(object):
"""Default game mode.""" """Default game mode."""
def __init__(self): def __init__(self):
# No extra settings, just an explicit way to revert to default settings # No extra settings, just an explicit way to revert to default settings
pass pass
@game_mode("foolish", 8, 24, 3) @game_mode("foolish", minp = 8,maxp = 24, likelihood = 7)
class FoolishMode(object): class FoolishMode(object):
"""Contains the fool, be careful not to lynch them!""" """Contains the fool, be careful not to lynch them!"""
def __init__(self): def __init__(self):
@ -374,7 +374,7 @@ class FoolishMode(object):
"mayor" : ( 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 ), "mayor" : ( 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 ),
}) })
@game_mode("mad", 7, 22, 3) @game_mode("mad", minp = 7, maxp = 22, likelihood = 7)
class MadMode(object): class MadMode(object):
"""This game mode has mad scientist and many things that may kill you.""" """This game mode has mad scientist and many things that may kill you."""
def __init__(self): def __init__(self):
@ -404,7 +404,8 @@ class MadMode(object):
"assassin" : ( 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 ), "assassin" : ( 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 ),
}) })
@game_mode("evilvillage", 6, 18) # evilvillage is broken, disable for now
#@game_mode("evilvillage", minp = 6, maxp = 18)
class EvilVillageMode(object): class EvilVillageMode(object):
"""Majority of the village is wolf aligned, safes must secretly try to kill the wolves.""" """Majority of the village is wolf aligned, safes must secretly try to kill the wolves."""
def __init__(self): def __init__(self):
@ -425,7 +426,7 @@ class EvilVillageMode(object):
"fool" : ( 0 , 1 , 1 ), "fool" : ( 0 , 1 , 1 ),
}) })
@game_mode("classic", 4, 21, 3) @game_mode("classic", minp = 4, maxp = 21, likelihood = 4)
class ClassicMode(object): class ClassicMode(object):
"""Classic game mode from before all the changes.""" """Classic game mode from before all the changes."""
def __init__(self): def __init__(self):
@ -446,7 +447,7 @@ class ClassicMode(object):
"gunner" : ( 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 ), "gunner" : ( 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 , 1 ),
}) })
@game_mode("rapidfire", 6, 24, 2) @game_mode("rapidfire", minp = 6, maxp = 24, likelihood = 0)
class RapidFireMode(object): class RapidFireMode(object):
"""Many roles that lead to multiple chain deaths.""" """Many roles that lead to multiple chain deaths."""
def __init__(self): def __init__(self):
@ -478,7 +479,7 @@ class RapidFireMode(object):
"sharpshooter" : ( 0 , 0 , 1 , 1 , 1 , 1 , 1 ), "sharpshooter" : ( 0 , 0 , 1 , 1 , 1 , 1 , 1 ),
}) })
@game_mode("drunkfire", 8, 17, 1) @game_mode("drunkfire", minp = 8, maxp = 17, likelihood = 0)
class DrunkFireMode(object): class DrunkFireMode(object):
"""Most players get a gun, quickly shoot all the wolves!""" """Most players get a gun, quickly shoot all the wolves!"""
def __init__(self): def __init__(self):
@ -509,7 +510,7 @@ class DrunkFireMode(object):
"sharpshooter" : ( 2 , 2 , 3 , 3 , 4 ), "sharpshooter" : ( 2 , 2 , 3 , 3 , 4 ),
}) })
@game_mode("noreveal", 4, 21, 2) @game_mode("noreveal", minp = 4, maxp = 21, likelihood = 2)
class NoRevealMode(object): class NoRevealMode(object):
"""Roles are not revealed when players die.""" """Roles are not revealed when players die."""
def __init__(self): def __init__(self):
@ -537,7 +538,7 @@ class NoRevealMode(object):
"cursed villager" : ( 0 , 1 , 1 , 1 , 1 , 1 , 2 , 2 ), "cursed villager" : ( 0 , 1 , 1 , 1 , 1 , 1 , 2 , 2 ),
}) })
@game_mode("lycan", 7, 21, 2) @game_mode("lycan", minp = 7, maxp = 21, likelihood = 2)
class LycanMode(object): class LycanMode(object):
"""Many lycans will turn into wolves. Hunt them down before the wolves overpower the village.""" """Many lycans will turn into wolves. Hunt them down before the wolves overpower the village."""
def __init__(self): def __init__(self):
@ -562,7 +563,7 @@ class LycanMode(object):
"mayor" : ( 0 , 0 , 1 , 1 , 1 , 1 , 1 ), "mayor" : ( 0 , 0 , 1 , 1 , 1 , 1 , 1 ),
}) })
@game_mode("amnesia", 10, 24) @game_mode("amnesia", minp = 10, maxp = 24, likelihood = 0)
class AmnesiaMode(object): class AmnesiaMode(object):
"""Everyone gets assigned a random role on night 3.""" """Everyone gets assigned a random role on night 3."""
def __init__(self): def __init__(self):
@ -578,7 +579,7 @@ class AmnesiaMode(object):
# Credits to Metacity for designing and current name # Credits to Metacity for designing and current name
# Blame arkiwitect for the original name of KrabbyPatty # Blame arkiwitect for the original name of KrabbyPatty
@game_mode("aleatoire", 4, 24, 2) @game_mode("aleatoire", minp = 4, maxp = 24, likelihood = 2)
class AleatoireMode(object): class AleatoireMode(object):
"""Game mode created by Metacity and balanced by woffle.""" """Game mode created by Metacity and balanced by woffle."""
def __init__(self): def __init__(self):