diff --git a/var.py b/var.py index 27b001e..5bf157f 100644 --- a/var.py +++ b/var.py @@ -17,14 +17,19 @@ MANSLAUGHTER_CHANCE = 1/5 GAME_MODES = {} -################################################################################################ -# ROLE INDEX: PLAYERS SEER WOLF CURSED DRUNK HARLOT TRAITOR GUNNER CROW # -ROLES_GUIDE = { 4 : ( 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 ), # - 6 : ( 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 ), # - 8 : ( 1 , 2 , 1 , 1 , 1 , 0 , 0 , 0 ), # - 10 : ( 1 , 2 , 1 , 1 , 1 , 1 , 1 , 0 ), # - None : ( 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 )} # -################################################################################################ +###################################################################################################### +# ROLE INDEX: PLAYERS SEER WOLF CURSED DRUNK HARLOT TRAITOR GUNNER CROW ANGEL ## +###################################################################################################### +ROLES_GUIDE = { 4 : ( 1 , 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0), ## + 6 : ( 1 , 1 , 1 , 1 , 0 , 0 , 0 , 0 , 0), ## + 8 : ( 1 , 2 , 1 , 1 , 1 , 0 , 0 , 0 , 0), ## + 10 : ( 1 , 2 , 1 , 1 , 1 , 1 , 1 , 0 , 0), ## + 11 : ( 1 , 2 , 1 , 1 , 1 , 1 , 1 , 0 , 1), ## + None : ( 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0)} ## +###################################################################################################### +# Notes: ## +###################################################################################################### + ROLE_INDICES = {0 : "seer", 1 : "wolf", @@ -33,7 +38,8 @@ ROLE_INDICES = {0 : "seer", 4 : "harlot", 5 : "traitor", 6 : "gunner", - 7 : "werecrow"} + 7 : "werecrow", + 8 : "guardian angel"} INDEX_OF_ROLE = dict((v,k) for k,v in ROLE_INDICES.items()) @@ -90,10 +96,17 @@ CHANGEABLE_ROLES = { "seers" : INDEX_OF_ROLE["seer"], "harlots" : INDEX_OF_ROLE["harlot"], "traitors" : INDEX_OF_ROLE["traitor"], "gunners" : INDEX_OF_ROLE["gunner"], - "werecrows" : INDEX_OF_ROLE["werecrow"]} + "werecrows" : INDEX_OF_ROLE["werecrow"], + "angels" : INDEX_OF_ROLE["guardian angel"]} + + -# !game roles=wolves:1 seers:0, x=1 +@game_mode("normal") +class Normal(object): + pass + +# Example !game roles=wolves:1,seers:0 # TODO: implement game modes @game_mode("roles") class ChangedRolesMode(object): diff --git a/wolfgame.py b/wolfgame.py index 4c013f5..a6a5735 100644 --- a/wolfgame.py +++ b/wolfgame.py @@ -607,7 +607,7 @@ cmd("!quit")(lambda cli, nick, *rest: leave(cli, "!quit", nick)) #Functions decorated with hook do not parse the nick by default hook("part")(lambda cli, nick, *rest: leave(cli, "part", parse_nick(nick)[0])) hook("quit")(lambda cli, nick, *rest: leave(cli, "quit", parse_nick(nick)[0])) -hook("kick")(lambda cli, nick, *rest: leave(cli, "kick", parse_nick(nick)[0])) +hook("kick")(lambda cli, nick, *rest: leave(cli, "kick", parse_nick(rest[1])[0])) @@ -616,6 +616,7 @@ def begin_day(cli): # Reset nighttime variables var.VICTIM = "" # nickname of kill victim + var.GUARDED = "" var.KILLER = "" # nickname of who chose the victim var.SEEN = [] # list of seers that have had visions var.OBSERVED = {} # those whom werecrows have observed @@ -635,6 +636,11 @@ def begin_day(cli): def transition_day(cli): var.PHASE = "day" chan = botconfig.CHANNEL + + if var.DAY_TIME_LIMIT > 0: # Time limit enabled + t = threading.Timer(var.DAY_TIME_LIMIT, hurry_up, [cli]) + var.TIMERS[1] = t + t.start() # Reset daytime variables var.VOTES = {} @@ -1040,6 +1046,7 @@ def transition_night(cli): # Reset nighttime variables var.VICTIM = "" # nickname of kill victim + var.GUARDED = "" var.KILLER = "" # nickname of who chose the victim var.SEEN = [] # list of seers that have had visions var.OBSERVED = {} # those whom werecrows have observed @@ -1109,6 +1116,15 @@ def transition_night(cli): 'you will die. Use !visit to visit a player.')) cli.msg(harlot, "Players: "+", ".join(pl)) + for g_angel in var.ROLES["guardian angel"]: + pl = ps[:] + pl.remove(g_angel) + cli.msg(g_angel, ('You are a \u0002guardian angel\u0002. '+ + 'It is your job to protect the villagers. If you guard a'+ + ' wolf, there is a 50/50 chance of you dying, if you guard '+ + 'a victim, they will live. Use !guard to guard a player.')); + cli.msg(g_angel, "Players: ", ", ".join(pl)) + for d in var.ROLES["village drunk"]: cli.msg(d, 'You have been drinking too much! You are the \u0002village drunk\u0002.')