def immunize(var, wrapper, message): """Immunize a player, preventing them from turning into a wolf.""" if not DOCTORS[wrapper.source]: wrapper.pm(messages["doctor_fail"]) return target = get_target(var, wrapper, re.split(" +", message)[0], allow_self=True) if not target: return evt = Event("targeted_command", {"target": target, "misdirection": True, "exchange": True}) if not evt.dispatch(var, wrapper.source, target): return target = evt.data["target"] doctor_evt = Event("doctor_immunize", {"message": "villager_immunized"}) doctor_evt.dispatch(var, wrapper.source, target) wrapper.pm(messages["doctor_success"].format(target)) target.send(messages["immunization_success"].format(messages[doctor_evt.data["message"]])) IMMUNIZED.add(target) DOCTORS[wrapper.source] -= 1 status.remove_lycanthropy(var, target) status.remove_disease(var, target) debuglog("{0} (doctor) IMMUNIZE: {1} ({2})".format(wrapper.source, target, get_main_role(target)))
def immunize(var, wrapper, message): """Immunize a player, preventing them from turning into a wolf.""" if not DOCTORS[wrapper.source]: wrapper.pm(messages["doctor_fail"]) return target = get_target(var, wrapper, re.split(" +", message)[0], allow_self=True) if not target: return target = try_misdirection(var, wrapper.source, target) if try_exchange(var, wrapper.source, target): return doctor_evt = Event("doctor_immunize", {"message": "villager_immunized"}) doctor_evt.dispatch(var, wrapper.source, target) wrapper.pm(messages["doctor_success"].format(target)) target.send(messages["immunization_success"].format(messages[doctor_evt.data["message"]])) IMMUNIZED.add(target) DOCTORS[wrapper.source] -= 1 remove_lycanthropy(var, target) remove_disease(var, target) debuglog("{0} (doctor) IMMUNIZE: {1} ({2})".format(wrapper.source, target, get_main_role(target)))
def on_new_role(evt, var, user, old_role): if old_role == "lycan" and evt.data["role"] != "lycan": remove_lycanthropy(var, user)
def on_new_role(evt, var, user, old_role): if old_role == "lycan" and evt.data["role"] != "lycan": remove_lycanthropy( var, user ) # FIXME: We might be a lycanthrope from more than just the lycan role