Disallow lynching yourself

This commit is contained in:
Eitan Adler 2013-04-13 17:41:30 -04:00
parent 1bb3f2aefb
commit eef1d2cd95

View File

@ -1443,6 +1443,7 @@ def vote(cli, nick, chann_, rest):
cli.msg(chan, ("{0}: You are wounded and resting, "+
"thus you are unable to vote for the day.").format(nick))
return
pl = var.list_players()
pl_l = [x.strip().lower() for x in pl]
rest = re.split(" +",rest)[0].strip().lower()
@ -1465,6 +1466,11 @@ def vote(cli, nick, chann_, rest):
return
voted = pl[pl_l.index(target)]
if nick == voted:
cli.notice(nick, "You may not vote for yourself.")
return
lcandidates = list(var.VOTES.keys())
for voters in lcandidates: # remove previous vote
if nick in var.VOTES[voters]: