lykoss / lykos

Werewolf, the popular detective/social party game (a theme of Mafia)
https://werewolf.chat
Other
127 stars 63 forks source link

Detectiv Role investigate offical does not work correctly #473

Closed svdermant closed 3 years ago

svdermant commented 3 years ago

Hello, I have created a copy of the original role Detectiv. And wanted to include a public investigation as everything worked so well. Errors only occur in the test run with fakenicks in debug mode.

What have I done:

  1. Create a copy of Detectiv.py
  2. A language variable investigate_official_detective created with the following content: "investigate_official_detective": "The \ u0002Detective\u0002 has found {1!role:article} {1!role:bold}.", This is located above the investigate_success.
  3. The following added in line 41 in the detective.py: channels.Main.send(messages["investigate_official_detective"].Format(target, targrole))
  4. restarted the bot in debug mode and started a game with !Fjoin 1 2 3 4 5 6 7 8 9.
  5. Using the !Force nick command. The fakenick of the detectiv role is executed by the check command.

But then there was an error the message was sent but an error was also triggered

  1. The error.log: https://pastebin.com/rSpEZHAt
  2. Debug.log: https://pastebin.com/zbxfsLQD
  3. Verbose.log: https://pastebin.com/vFY6V026

And here is the part of the errorline form the error.log

INVESTIGATED.add(wrapper.source)
channels.Main.send(messages["investigate_official_detective"].format(target, targrole))
wrapper.send(messages["investigate_success"].format(target, targrole))

if random.random() < var.DETECTIVE_REVEALED_CHANCE:  # a 2/5 chance (changeable in settings)
    # The detective's identity is compromised! Let the opposing team know
    if get_main_role(wrapper.source) in Wolfteam:
        to_notify = get_players(Safe)
    else:
        to_notify = get_players(get_wolfchat_roles(var))

So how can i fix it. thanks

svdermant commented 3 years ago

Okay, hopefully I seem to have found the error, can someone please confirm that

I have the following change at the beginning of detectiv.py is the following: from src.cats import Safe

I replaced this with the following: from src.cats import ( Wolf, Wolfchat, Safe, Wolfteam, Killer, Village, Neutral, Hidden, Wolf_Objective, Village_Objective, role_order )

I hope that fixed the problem. I'll do a second test run later.