Fix fool being lynched and begin shaman bonanza, most of the totems do nothing atm but it *should* theoretically work

This commit is contained in:
Skizzerz 2014-08-04 00:23:29 -05:00
parent b47ab14632
commit 2d331cdcd7
2 changed files with 117 additions and 11 deletions

View File

@ -771,8 +771,23 @@ def chk_decision(cli, force = ""):
avail = len(pl) - len(var.WOUNDED) - len(var.ASLEEP) avail = len(pl) - len(var.WOUNDED) - len(var.ASLEEP)
votesneeded = avail // 2 + 1 votesneeded = avail // 2 + 1
aftermessage = None aftermessage = None
for votee, voters in iter(var.VOTES.items()): for votee, voters in copy.copy(var.VOTES.items()):
numvotes = sum([var.BUREAUCRAT_VOTES if p in var.ROLES["bureaucrat"] else 1 for p in voters]) numvotes = 0
for v in var.IMPATIENT:
if v not in voters:
voters.append(v)
for v in voters:
weight = 1
imp_count = sum([1 if p == v else 0 for p in var.IMPATIENT])
pac_count = sum([1 if p == v else 0 for p in var.PACIFISTS])
if pac_count > imp_count:
weight = 0 # more pacifists than impatience totems
elif imp_count == pac_count and v not in var.VOTES[votee]:
weight = 0 # impatience and pacifist cancel each other out, so don't count impatience
if v in var.ROLES["bureaucrat"] or v in var.INFLUENTIAL: # the two do not stack
weight *= 2
numvotes += weight
if numvotes >= votesneeded or votee == force: if numvotes >= votesneeded or votee == force:
# roles that prevent any lynch from happening # roles that prevent any lynch from happening
if votee in var.ROLES["mayor"] and votee not in var.REVEALED_MAYORS: if votee in var.ROLES["mayor"] and votee not in var.REVEALED_MAYORS:
@ -802,7 +817,7 @@ def chk_decision(cli, force = ""):
# roles that end the game upon being lynched # roles that end the game upon being lynched
if votee in var.ROLES["fool"]: if votee in var.ROLES["fool"]:
# ends game immediately, with fool as only winner # ends game immediately, with fool as only winner
lmsg = random.choice(var.LYNCH_MESSAGES).format(votee, var.get_reveal_role(votee)) lmsg = random.choice(var.LYNCH_MESSAGES).format(votee, "", var.get_reveal_role(votee))
cli.msg(botconfig.CHANNEL, lmsg) cli.msg(botconfig.CHANNEL, lmsg)
var.LOGGER.logMessage(lmsg.replace("\02", "")) var.LOGGER.logMessage(lmsg.replace("\02", ""))
var.LOGGER.logBare(votee, "LYNCHED") var.LOGGER.logBare(votee, "LYNCHED")
@ -1803,6 +1818,42 @@ def on_nick(cli, prefix, nick):
if prefix in var.AMNESIACS: if prefix in var.AMNESIACS:
var.AMNESIACS.remove(prefix) var.AMNESIACS.remove(prefix)
var.AMNESIACS.append(nick) var.AMNESIACS.append(nick)
while prefix in var.IMPATIENT:
var.IMPATIENT.remove(prefix)
var.IMPATIENT.append(nick)
while prefix in var.PACIFISTS:
var.PACIFISTS.remove(prefix)
var.PACIFISTS.append(nick)
if prefix in var.INFLUENTIAL:
var.INFLUENTIAL.remove(prefix)
var.INFLUENTIAL.append(nick)
if prefix in var.LYCANTHROPES:
var.LYCANTHROPES.remove(prefix)
var.LYCANTHROPES.append(nick)
if prefix in var.TOBELYCANTHROPES:
var.TOBELYCANTHROPES.remove(prefix)
var.TOBELYCANTHROPES.append(nick)
if prefix in var.LUCKY:
var.LUCKY.remove(prefix)
var.LUCKY.append(nick)
if prefix in var.TOBELUCKY:
var.TOBELUCKY.remove(prefix)
var.TOBELUCKY.append(nick)
if prefix in var.DISEASED:
var.DISEASED.remove(prefix)
var.DISEASED.append(nick)
if prefix in var.TOBEDISEASED:
var.TOBEDISEASED.remove(prefix)
var.TOBEDISEASED.append(nick)
if prefix in var.RETRIBUTION:
var.RETRIBUTION.remove(prefix)
var.RETRIBUTION.append(nick)
if prefix in var.MISDIRECTED:
var.MISDIRECTED.remove(prefix)
var.MISDIRECTED.append(nick)
if prefix in var.TOBEMISDIRECTED:
var.TOBEMISDIRECTED.remove(prefix)
var.TOBEMISDIRECTED.append(nick)
with var.GRAVEYARD_LOCK: # to be safe with var.GRAVEYARD_LOCK: # to be safe
if prefix in var.LAST_SAID_TIME.keys(): if prefix in var.LAST_SAID_TIME.keys():
var.LAST_SAID_TIME[nick] = var.LAST_SAID_TIME.pop(prefix) var.LAST_SAID_TIME[nick] = var.LAST_SAID_TIME.pop(prefix)
@ -1940,6 +1991,10 @@ def begin_day(cli):
var.PASSED = [] # hunters that have opted not to kill var.PASSED = [] # hunters that have opted not to kill
var.STARTED_DAY_PLAYERS = len(var.list_players()) var.STARTED_DAY_PLAYERS = len(var.list_players())
var.SILENCED = copy.copy(var.TOBESILENCED) var.SILENCED = copy.copy(var.TOBESILENCED)
var.LYCANTHROPES = copy.copy(var.TOBELYCANTHROPES)
var.LUCKY = copy.copy(var.TOBELUCKY)
var.DISEASED = copy.copy(var.TOBEDISEASED)
var.MISDIRECTED = copy.copy(var.TOBEMISDIRECTED)
msg = ("The villagers must now vote for whom to lynch. "+ msg = ("The villagers must now vote for whom to lynch. "+
'Use "{0}lynch <nick>" to cast your vote. {1} votes '+ 'Use "{0}lynch <nick>" to cast your vote. {1} votes '+
@ -3576,6 +3631,14 @@ def transition_night(cli):
var.DESPERATE = [] var.DESPERATE = []
var.REVEALED = [] var.REVEALED = []
var.TOBESILENCED = [] var.TOBESILENCED = []
var.IMPATIENT = []
var.PACIFISTS = []
var.INFLUENTIAL = []
var.TOBELYCANTHROPES = []
var.TOBELUCKY = []
var.TOBEDISEASED = []
var.RETRIBUTION = []
var.TOBEMISDIRECTED = []
var.NIGHT_START_TIME = datetime.now() var.NIGHT_START_TIME = datetime.now()
var.NIGHT_COUNT += 1 var.NIGHT_COUNT += 1
var.FIRST_NIGHT = (var.NIGHT_COUNT == 1) var.FIRST_NIGHT = (var.NIGHT_COUNT == 1)
@ -3797,14 +3860,13 @@ def transition_night(cli):
for shaman in var.list_players(["shaman", "crazed shaman"]): for shaman in var.list_players(["shaman", "crazed shaman"]):
pl = ps[:] pl = ps[:]
random.shuffle(pl) random.shuffle(pl)
avail_totems = ("death", "protection", "revealing", "narcolepsy", "silence", "desperation")
role = var.get_role(shaman) role = var.get_role(shaman)
rand = random.random() rand = random.random()
target = 0 target = 0
for i in range(0, len(avail_totems)): for t, c in var.TOTEM_CHANCES.items():
target += var.TOTEM_CHANCES[i] target += var.TOTEM_CHANCES[t][c[0] if role == "shaman" else c[1]]
if rand <= target: if rand <= target:
var.TOTEMS[shaman] = avail_totems[i] var.TOTEMS[shaman] = t
break break
if shaman in var.PLAYERS and var.PLAYERS[shaman]["cloak"] not in var.SIMPLE_NOTIFY: if shaman in var.PLAYERS and var.PLAYERS[shaman]["cloak"] not in var.SIMPLE_NOTIFY:
cli.msg(shaman, ('You are a \u0002{0}\u0002. You can select a player to receive ' + cli.msg(shaman, ('You are a \u0002{0}\u0002. You can select a player to receive ' +
@ -3814,7 +3876,7 @@ def transition_night(cli):
totem = var.TOTEMS[shaman] totem = var.TOTEMS[shaman]
tmsg = 'You have the \u0002{0}\u0002 totem. '.format(totem) tmsg = 'You have the \u0002{0}\u0002 totem. '.format(totem)
if totem == "death": if totem == "death":
tmsg += 'The player who is given this totem will die tonight, unless they are being protected.' tmsg += 'The player who is given this totem will die tonight, even if they are being protected.'
elif totem == "protection": elif totem == "protection":
tmsg += 'The player who is given this totem is protected from dying tonight.' tmsg += 'The player who is given this totem is protected from dying tonight.'
elif totem == "revealing": elif totem == "revealing":
@ -3825,6 +3887,24 @@ def transition_night(cli):
tmsg += 'The player who is given this totem will be unable to use any special powers during the day tomorrow and the night after.' tmsg += 'The player who is given this totem will be unable to use any special powers during the day tomorrow and the night after.'
elif totem == "desperation": elif totem == "desperation":
tmsg += 'If the player who is given this totem is lynched, the last player to vote them will also die.' tmsg += 'If the player who is given this totem is lynched, the last player to vote them will also die.'
elif totem == "impatience":
tmsg += 'The player who is given this totem is counted as voting for everyone except themselves, even if they do not !vote.'
elif totem == "pacifism":
tmsg += 'Votes by the player who is given this totem do not count.'
elif totem == "influence":
tmsg += 'Votes by the player who is given this totem count twice.'
elif totem == "exchange":
tmsg += 'The first person to use a power on the player given this totem tomorrow night will have their role swapped with the recipient.'
elif totem == "lycanthropy":
tmsg += 'If the player who is given this totem is targeted by wolves tomorrow night, they will become a wolf.'
elif totem == "luck":
tmsg += 'If the player who is given this totem is targeted tomorrow night, one of the players adjacent to them will be targeted instead.'
elif totem == "pestilence":
tmsg += 'If the player who is given this totem is killed by wolves tomorrow night, the wolves will not be able to kill the night after.'
elif totem == "retribution":
tmsg += 'If the player who is given this totem will die tonight, they also kill anyone who killed them.'
elif totem == "misdirection":
tmsg += 'If the player who is given this totem attempts to use a power the following day or night, they will target a player adjacent to their intended target instead of the player they targeted.'
else: else:
tmsg += 'No description for this totem is available. This is a bug, so please report this to the admins.' tmsg += 'No description for this totem is available. This is a bug, so please report this to the admins.'
cli.msg(shaman, tmsg) cli.msg(shaman, tmsg)
@ -4153,6 +4233,18 @@ def start(cli, nick, chann_, rest):
var.ANGRY_WOLVES = False var.ANGRY_WOLVES = False
var.FINAL_ROLES = {} var.FINAL_ROLES = {}
var.ORIGINAL_LOVERS = {} var.ORIGINAL_LOVERS = {}
var.IMPATIENT = []
var.PACIFISTS = []
var.INFLUENTIAL = []
var.LYCANTHROPES = []
var.TOBELYCANTHROPES = []
var.LUCKY = []
var.TOBELUCKY = []
var.DISEASED = []
var.TOBEDISEASED = []
var.RETRIBUTION = []
var.MISDIRECTED = []
var.TOBEMISDIRECTED = []
for role, count in addroles.items(): for role, count in addroles.items():
if role in var.TEMPLATE_RESTRICTIONS.keys(): if role in var.TEMPLATE_RESTRICTIONS.keys():

View File

@ -73,10 +73,24 @@ DETECTIVE_REVEALED_CHANCE = 2/5
SHARPSHOOTER_CHANCE = 1/5 # if sharpshooter is enabled, chance that a gunner will become a sharpshooter instead SHARPSHOOTER_CHANCE = 1/5 # if sharpshooter is enabled, chance that a gunner will become a sharpshooter instead
AMNESIAC_NIGHTS = 3 # amnesiac gets to know their actual role on this night AMNESIAC_NIGHTS = 3 # amnesiac gets to know their actual role on this night
BUREAUCRAT_VOTES = 2 # bureaucrat votes count for this many normal votes
# DEATH PROTECTION REVEALING NARCOLEPSY SILENCE DESPERATION # SHAMAN CRAZED SHAMAN
TOTEM_CHANCES = ( 1/6 , 1/6 , 1/6 , 1/6 , 1/6 , 1/6 ) TOTEM_CHANCES = { "death": ( 1/8 , 1/15 ),
"protection": ( 1/8 , 1/15 ),
"silence": ( 1/8 , 1/15 ),
"revealing": ( 1/8 , 1/15 ),
"desperation": ( 1/8 , 1/15 ),
"impatience": ( 1/8 , 1/15 ),
"pacifism": ( 1/8 , 1/15 ),
"influence": ( 1/8 , 1/15 ),
"narcolepsy": ( 0 , 1/15 ),
"exchange": ( 0 , 1/15 ),
"lycanthropy": ( 0 , 1/15 ),
"luck": ( 0 , 1/15 ),
"pestilence": ( 0 , 1/15 ),
"retribution": ( 0 , 1/15 ),
"misdirection": ( 0 , 1/15 ),
}
GAME_MODES = {} GAME_MODES = {}
AWAY = ['services.', 'services.int'] # cloaks of people who are away. AWAY = ['services.', 'services.int'] # cloaks of people who are away.