Browse Source

added the player limit

master
jcao219 14 years ago
parent
commit
17fe145c93
  1. 3
      var.py
  2. 5
      wolfgame.py

3
var.py

@ -3,6 +3,7 @@ MINIMUM_WAIT = 60 # debug, change to 60 for normal @@ -3,6 +3,7 @@ MINIMUM_WAIT = 60 # debug, change to 60 for normal
EXTRA_WAIT = 20
MAXIMUM_WAITED = 2 # limit for amount of !wait's
MAX_SHOTS = 2
MAX_PLAYERS = 30
DRUNK_SHOTS_MULTIPLIER = 3
NIGHT_TIME_LIMIT = 90
DAY_TIME_LIMIT = 333
@ -15,6 +16,8 @@ GAME_COMMAND_ADMIN_ONLY = True @@ -15,6 +16,8 @@ GAME_COMMAND_ADMIN_ONLY = True
GUN_CHANCES = ( 5/7 , 1/7 , 1/7 )
DRUNK_GUN_CHANCES = ( 4/7 , 2/7 , 1/7 )
MANSLAUGHTER_CHANCE = 1/5
GUN_KILLS_WOLF_CHANCE = 1/2
GUARDIAN_ANGEL_DIES_CHANCE = 1/2
GAME_MODES = {}

5
wolfgame.py

@ -246,6 +246,7 @@ def fpinger(cli, nick, chan, rest): @@ -246,6 +246,7 @@ def fpinger(cli, nick, chan, rest):
@cmd("!join")
def join(cli, nick, chan, rest):
pl = var.list_players()
if var.PHASE == "none":
cli.mode(chan, "+v", nick, nick+"!*@*")
var.ROLES["person"].append(nick)
@ -255,8 +256,10 @@ def join(cli, nick, chan, rest): @@ -255,8 +256,10 @@ def join(cli, nick, chan, rest):
cli.msg(chan, ('\u0002{0}\u0002 has started a game of Werewolf. '+
'Type "!join" to join. Type "!start" to start the game. '+
'Type "!wait" to increase join wait time.').format(nick))
elif nick in var.list_players():
elif nick in pl:
cli.notice(nick, "You're already playing!")
elif len(pl) >= var.MAX_PLAYERS:
cli.notice(nick, "Too many players! Try again next time.")
elif var.PHASE != "join":
cli.notice(nick, "Sorry but the game is already running. Try again next time.")
else:

Loading…
Cancel
Save