Alpha wolf fixes

- Correctly logic out bite interacting with harlot, immunized, and lycan:
- A harlot that isn't home does not get bit and refunds the bite unless
  they visit a wolfteam member or visit the unprotected wolves' victim
  (in either of those cases, they get bit instead of dying)
- A lycan or someone with a lycanthropy totem that gets bitten
  immediately turns to wolf and refunds the bite. The regular wolf kill
  still happens too, so this is essentially a freebie for alpha wolf.
- An immunized target dies per normal, but the death from the bite does
  not stack with the death from a normal wolf kill for the purposes of
  protection (meaning a single protection will guard against both).
- Fix nightdone check so that night doesn't end prematurely if alpha
  would be eligible to bite but has already done so previously in the
  game.
This commit is contained in:
skizzerz 2015-10-20 22:26:37 -05:00
parent 8995ec5815
commit 5a97397cd9

View File

@ -4009,34 +4009,46 @@ def transition_day(cli, gameid=0):
# also being killed by wolves, make the kill not apply # also being killed by wolves, make the kill not apply
# note that we cannot bite visiting harlots unless they are visiting a wolf, # note that we cannot bite visiting harlots unless they are visiting a wolf,
# and lycans/immunized people turn/die instead of being bitten, so keep the kills valid on those # and lycans/immunized people turn/die instead of being bitten, so keep the kills valid on those
got_bit = False
hvisit = var.HVISITED.get(target) hvisit = var.HVISITED.get(target)
if (target in onlybywolves if ((target not in var.ROLES["harlot"]
and (target not in var.ROLES["harlot"] or not hvisit or var.get_role(hvisit) not in var.WOLFCHAT_ROLES or not hvisit
or var.get_role(hvisit) in var.WOLFCHAT_ROLES
or (hvisit in bywolves and hvisit not in protected)) or (hvisit in bywolves and hvisit not in protected))
and target not in var.ROLES["lycan"] and target not in var.ROLES["lycan"]
and target not in var.LYCANTHROPES and target not in var.LYCANTHROPES
and target not in var.IMMUNIZED): and target not in var.IMMUNIZED):
victims.remove(target) # mark them as bitten
bywolves.remove(target) got_bit = True
onlybywolves.remove(target) # if they were also being killed by wolves, undo that
killers[target].remove("@wolves") if target in bywolves:
if target not in victims: victims.remove(target)
victims_set.discard(target) bywolves.discard(target)
onlybywolves.discard(target)
killers[target].remove("@wolves")
if target not in victims:
victims_set.discard(target)
if target in victims_set: if target in victims_set:
# bite was unsuccessful # bite was unsuccessful due to someone else killing them
var.ALPHA_WOLVES.remove(alpha) var.ALPHA_WOLVES.remove(alpha)
elif target in var.IMMUNIZED: elif target in var.IMMUNIZED or target in var.ROLES["lycan"] or target in var.LYCANTHROPES:
# target immunized, kill them instead and refund the bite # target immunized or a lycan, kill them instead and refund the bite
# (for lycans, this effectively gives alpha a free kill on top of regular wolf kill, deal with it)
var.ALPHA_WOLVES.remove(alpha) var.ALPHA_WOLVES.remove(alpha)
if target not in victims: if target not in victims:
onlybywolves.add(target) onlybywolves.add(target)
victims.append(target) if target not in bywolves:
# don't count this as 2 separate kills for the purposes of protection if wolves already targeted this person
victims.append(target)
victims_set.add(target) victims_set.add(target)
bywolves.add(target) bywolves.add(target)
else: elif got_bit:
var.BITTEN[target] = var.ALPHA_WOLF_NIGHTS var.BITTEN[target] = var.ALPHA_WOLF_NIGHTS
bitten.append(target) bitten.append(target)
else:
# bite failed due to some other reason (namely harlot)
var.ALPHA_WOLVES.remove(alpha)
if alpha in var.ALPHA_WOLVES: if alpha in var.ALPHA_WOLVES:
pm(cli, alpha, "You have bitten \u0002{0}\u0002.".format(target)) pm(cli, alpha, "You have bitten \u0002{0}\u0002.".format(target))
@ -4491,8 +4503,8 @@ def chk_nightdone(cli):
if var.DISEASED_WOLVES: if var.DISEASED_WOLVES:
nightroles = [p for p in nightroles if p not in var.list_players(var.WOLF_ROLES - {"wolf cub", "werecrow"})] nightroles = [p for p in nightroles if p not in var.list_players(var.WOLF_ROLES - {"wolf cub", "werecrow"})]
elif var.ALPHA_ENABLED: elif var.ALPHA_ENABLED:
# don't re-add alphas here since they can only kill *or* bite, not both # add in alphas that have bitten (note an alpha can kill or bite, but not both)
actedcount += len([p for p in var.ALPHA_WOLVES if p in var.ROLES["alpha wolf"]]) actedcount += len([p for p in var.BITE_PREFERENCES if p in var.ROLES["alpha wolf"]])
for p in var.HUNTERS: for p in var.HUNTERS:
# only remove one instance of their name if they have used hunter ability, in case they have templates # only remove one instance of their name if they have used hunter ability, in case they have templates