You are viewing the MafiaScum.net Wiki. To play the game, visit the forum.

Template:RoleParser/doc: Difference between revisions

From MafiaWiki
Jump to navigation Jump to search
(documentation/tests for RoleParser; this is work in progress, it'll likely get more arguments eventually)
 
(document Solo, Solo/Nightless)
 
(3 intermediate revisions by the same user not shown)
Line 9: Line 9:
The {{tl|RoleParser}} template is the main entry point for producing formatted [[Role PM]]s from [[MafiaWiki:RoleParser syntax|role strings]].
The {{tl|RoleParser}} template is the main entry point for producing formatted [[Role PM]]s from [[MafiaWiki:RoleParser syntax|role strings]].


The first argument is the role string to format. The second argument is a slash-separated list of special rules in use in the setup, e.g. "Nightless", "Compulsive" (nightkills), etc.; this can be empty. (The purpose of this argument is to make necessary modifications to the role PM, e.g. removing the factional kill from the Mafia in a Nightless setup.)
The first argument is the role string to format. The second argument is the special rules in use in the setup; this can be empty, if none apply. (The purpose of this argument is to make necessary modifications to the role PM, e.g. removing the factional kill from the Mafia in a Nightless setup.) Possible values if nonempty:
 
;Compulsive: Factional kills are [[compulsive]].
;Daytalk: Anti-town factions have [[daytalk]] in their factional communication threads.
;Daytalk/Compulsive: A combination of the previous two special rules.
;Nightless: Factional kills do not exist.
;Solo: Anti-town factions do not have factional communication or knowledge of their team-mates (likely due to having only a single member).
;Solo/Nightless: A combination of the previous two special rules.


There are also a few optional arguments. An argument with a name like <code>TownWincon</code>, <code>MafiaWincon</code>, etc., will override the [[win condition]] given in the role PM ''if'' the faction in the argument matches the faction of a role. This lets you specify the wincons for the various factions without having to parse the role string to see which faction matches. Finally, the <code>Test</code> argument is optional and rarely used, but will cause this template to dump out some of its internal state, making it possible to test it independently from the sub-templates it calls into.
There are also a few optional arguments. An argument with a name like <code>TownWincon</code>, <code>MafiaWincon</code>, etc., will override the [[win condition]] given in the role PM ''if'' the faction in the argument matches the faction of a role. This lets you specify the wincons for the various factions without having to parse the role string to see which faction matches. Finally, the <code>Test</code> argument is optional and rarely used, but will cause this template to dump out some of its internal state, making it possible to test it independently from the sub-templates it calls into.
Line 15: Line 22:
== Examples ==
== Examples ==


{{RoleStringTest|RoleParser|Test=Rp/Stage1}}
{{RoleStringTest|RoleParser|Test=Rp/Stage2}}


== Test of this template in isolation ==
== Test of this template in isolation ==
This test replaces the call to {{tl|Rp/Stage2}}, the template that does most of the actual work, with a list of its arguments instead.
These arguments are:
# The role string.
# The interaction modifier, if any (this could be blank).
# The general restriction, if any (this could be blank).
# The number of active abilities the role has (including a factional kill, if any).
# The list of indexes of ends of component groups (as output by {{tl|Rp/gei}}).
# The list of special rules to use in the setup.


{{RoleStringTest|RoleParser|Test=ShowArgs}}
{{RoleStringTest|RoleParser|Test=ShowArgs}}

Latest revision as of 03:37, 23 February 2019

Name:
  • RoleParser
Types:
Sub-Template:
  • No
Designer:


The {{RoleParser}} template is the main entry point for producing formatted Role PMs from role strings.

The first argument is the role string to format. The second argument is the special rules in use in the setup; this can be empty, if none apply. (The purpose of this argument is to make necessary modifications to the role PM, e.g. removing the factional kill from the Mafia in a Nightless setup.) Possible values if nonempty:

Compulsive
Factional kills are compulsive.
Daytalk
Anti-town factions have daytalk in their factional communication threads.
Daytalk/Compulsive
A combination of the previous two special rules.
Nightless
Factional kills do not exist.
Solo
Anti-town factions do not have factional communication or knowledge of their team-mates (likely due to having only a single member).
Solo/Nightless
A combination of the previous two special rules.

There are also a few optional arguments. An argument with a name like TownWincon, MafiaWincon, etc., will override the win condition given in the role PM if the faction in the argument matches the faction of a role. This lets you specify the wincons for the various factions without having to parse the role string to see which faction matches. Finally, the Test argument is optional and rarely used, but will cause this template to dump out some of its internal state, making it possible to test it independently from the sub-templates it calls into.

Examples

Town

Welcome to game! You are a Vanilla Townie.

You have no active abilities.

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Mafia

Welcome to game! You are a Mafia Goon.

Your team-mates are names. You may talk to them here during night phases and confirmations only.

You have the following active ability:

  • Each Night, if no other member of your faction is performing this action, you may target a player. Assuming no interference with your action, that player will die.

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Town/Cop

Welcome to game! You are a Town Cop.

You have the following active ability:

  • Each Night, you may target a player. Assuming no interference with your action, you will learn whether that player wins with Town. (You will get "no result" if this action is blocked.)

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Bulletproof

Welcome to game! You are a Bulletproof Townie.

You are protected from kills that target you.

You have no active abilities.

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Mafia/Loyal/Jailkeeper

Welcome to game! You are a Mafia Loyal Jailkeeper.

Your team-mates are names. You may talk to them here during night phases and confirmations only.

You have the following active abilities, but may use only one per Night:

  • Each Night, if no other member of your faction is performing this action, you may target a player. Assuming no interference with your action, that player will die.
  • Each Night, you may target a player. Assuming no interference with your action, that player will be protected from kills that night, but all their actions will be blocked that night. This action will be blocked if used on a player who does not belong to your faction.

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Mafia/Bulletproof/Jailkeeper

Welcome to game! You are a Bulletproof Mafia Jailkeeper.

Your team-mates are names. You may talk to them here during night phases and confirmations only.

You are protected from kills that target you.

You have the following active abilities, but may use only one per Night:

  • Each Night, if no other member of your faction is performing this action, you may target a player. Assuming no interference with your action, that player will die.
  • Each Night, you may target a player. Assuming no interference with your action, that player will be protected from kills that night, but all their actions will be blocked that night.

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Mafia/Multitasking/Jailkeeper

Welcome to game! You are a Mafia Multitasking Jailkeeper.

Your team-mates are names. You may talk to them here during night phases and confirmations only.

You have the following active abilities, and may use multiple different abilities in the same night if you wish:

  • Each Night, if no other member of your faction is performing this action, you may target a player. Assuming no interference with your action, that player will die.
  • Each Night, you may target a player. Assuming no interference with your action, that player will be protected from kills that night, but all their actions will be blocked that night.

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Mafia/Ninja

Welcome to game! You are a Mafioso.

Your team-mates are names. You may talk to them here during night phases and confirmations only.

You have the following active ability:

  • Each Night, if no other member of your faction is performing this action, you may target a player. Assuming no interference with your action, that player will die.

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Town/Cop/Doctor

Welcome to game! You are a Town Cop Doctor.

You have the following active abilities, but may use only one per Night:

  • Each Night, you may target a player. Assuming no interference with your action, you will learn whether that player wins with Town. (You will get "no result" if this action is blocked.)
  • Each Night, you may target a player. Assuming no interference with your action, that player will be protected from one kill that night.

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Bulletproof/Enabler

Welcome to game! You are a Town Bulletproof Enabler.

When you die, the role "Bulletproof" will cease to function for all players.

You have no active abilities.

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Odd Night/Doctor/Enabler

Welcome to game! You are a Town Odd Night Doctor Enabler.

When you Template:RoleFragment/ps/Doctor, the role "Doctor" will cease to function for all players.

You have no active abilities.

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Bulletproof/Activated

Welcome to game! You are a Town Activated Bulletproof.

You have the following active ability:

  • Each night, you may choose to gain the following ability for that night: "You are protected from kills that target you."

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Ascetic/Bulletproof

Welcome to game! You are an Ascetic Bulletproof Townie.

Actions that target you, other than kills, will fail as if roleblocked.

You are protected from kills that target you.

You have no active abilities.

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Ascetic/Bulletproof/Enabler

Welcome to game! You are an Ascetic Town Bulletproof Enabler.

Actions that target you, other than kills, will fail as if roleblocked.

When you die, the role "Bulletproof" will cease to function for all players.

You have no active abilities.

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Cop/Odd Night/Doctor

Welcome to game! You are a Town Cop Odd Night Doctor.

You have the following active abilities, but may use only one per Night:

  • Each Night, you may target a player. Assuming no interference with your action, you will learn whether that player wins with Town. (You will get "no result" if this action is blocked.)
  • On odd-numbered Nights, you may target a player. Assuming no interference with your action, that player will be protected from one kill that night.

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Even Night/Cop/Odd Night/Doctor

Welcome to game! You are a Town Even Night Cop Odd Night Doctor.

You have the following active abilities, but may use only one per Night:

  • On each even-numbered Night, you may target a player. Assuming no interference with your action, you will learn whether that player wins with Town. (You will get "no result" if this action is blocked.)
  • On odd-numbered Nights, you may target a player. Assuming no interference with your action, that player will be protected from one kill that night.

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Mafia/Ascetic/Multitasking/Even Night/Cop/Odd Night/Doctor

Welcome to game! You are an Ascetic Mafia Multitasking Even Night Cop Odd Night Doctor.

Your team-mates are names. You may talk to them here during night phases and confirmations only.

Actions that target you, other than kills, will fail as if roleblocked.

You have the following active abilities, and may use multiple different abilities in the same night if you wish:

  • Each Night, if no other member of your faction is performing this action, you may target a player. Assuming no interference with your action, that player will die.
  • On each even-numbered Night, you may target a player. Assuming no interference with your action, you will learn whether that player wins with Town. (You will get "no result" if this action is blocked.)
  • On odd-numbered Nights, you may target a player. Assuming no interference with your action, that player will be protected from one kill that night.

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Town/Loud/Multitasking/Jack of All Trades/Cop/Weak/Doctor/Innocent Child/Activated

Welcome to game! You are a Town Loud Multitasking Jack of All Trades Cop Weak Doctor Activated Innocent Child.

Whenever you perform a targeted action, your target will learn that you targeted them (but not what action you targeted them with).

You have the following active abilities, and may use multiple different abilities in the same night if you wish:

  • Once in the game at night, you may target a player. Assuming no interference with your action, you will learn whether that player wins with Town. (You will get "no result" if this action is blocked.)
  • Once in the game at night, you may target a player. Assuming no interference with your action, that player will be protected from one kill that night. If you use this action on a player who cannot win with the Town, you will die.
  • Once in the game at night, you may choose to gain the following ability for that night: "The moderator will confirm your alignment."

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Serial Killer/Even Night/Ascetic/2-shot/Loud/Ninja/Weak/Rolecop/Odd Night/Doctor

Welcome to game! You are an Even Night Ascetic Serial Killer 2-shot Loud Ninja Weak Rolecop Odd Night Doctor.

Actions that target you, other than kills, will fail as if roleblocked during even-numbered Nights.

You have the following active abilities, but may use only one per Night:

  • Each Night, you may target a player. Assuming no interference with your action, that player will die.
  • Twice in the game at Night, but only once per Night, you may target a player. Assuming no interference with your action, you will learn that player's role (but not their alignment). Your target will learn that you targeted them (but not what action you targeted them with). This action is not visible to Tracker-like and Watcher-like roles. If you use this action on a player who cannot win with the Town, you will die.
  • On odd-numbered Nights, you may target a player. Assuming no interference with your action, that player will be protected from one kill that night.

You win if you are the last player alive (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.


Test of this template in isolation

This test replaces the call to {{Rp/Stage2}}, the template that does most of the actual work, with a list of its arguments instead.

These arguments are:

  1. The role string.
  2. The interaction modifier, if any (this could be blank).
  3. The general restriction, if any (this could be blank).
  4. The number of active abilities the role has (including a factional kill, if any).
  5. The list of indexes of ends of component groups (as output by {{Rp/gei}}).
  6. The list of special rules to use in the setup.
Town

Welcome to game! You are a Vanilla Townie.

1=Town; 4=0; 5=1/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Mafia

Welcome to game! You are a Mafia Goon.

1=Mafia; 4=1; 5=1/

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Town/Cop

Welcome to game! You are a Town Cop.

1=Town/Cop; 4=1; 5=1/2/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Bulletproof

Welcome to game! You are a Bulletproof Townie.

1=Town/Bulletproof; 4=0; 5=1/2/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Mafia/Loyal/Jailkeeper

Welcome to game! You are a Mafia Loyal Jailkeeper.

1=Mafia/Loyal/Jailkeeper; 4=2; 5=1/3/

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Mafia/Bulletproof/Jailkeeper

Welcome to game! You are a Bulletproof Mafia Jailkeeper.

1=Mafia/Bulletproof/Jailkeeper; 4=2; 5=1/2/3/

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Mafia/Multitasking/Jailkeeper

Welcome to game! You are a Mafia Multitasking Jailkeeper.

1=Mafia/Multitasking/Jailkeeper; 2=Multitasking; 4=2; 5=1/2/3/

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Mafia/Ninja

Welcome to game! You are a Mafioso.

1=Mafia/Ninja; 4=1; 5=1/

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Town/Cop/Doctor

Welcome to game! You are a Town Cop Doctor.

1=Town/Cop/Doctor; 4=2; 5=1/2/3/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Bulletproof/Enabler

Welcome to game! You are a Town Bulletproof Enabler.

1=Town/Bulletproof/Enabler; 4=0; 5=1/3/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Odd Night/Doctor/Enabler

Welcome to game! You are a Town Odd Night Doctor Enabler.

1=Town/Odd Night/Doctor/Enabler; 4=0; 5=1/4/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Bulletproof/Activated

Welcome to game! You are a Town Activated Bulletproof.

1=Town/Bulletproof/Activated; 4=1; 5=1/3/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Ascetic/Bulletproof

Welcome to game! You are an Ascetic Bulletproof Townie.

1=Town/Ascetic/Bulletproof; 4=0; 5=1/2/3/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Ascetic/Bulletproof/Enabler

Welcome to game! You are an Ascetic Town Bulletproof Enabler.

1=Town/Ascetic/Bulletproof/Enabler; 4=0; 5=1/2/4/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Cop/Odd Night/Doctor

Welcome to game! You are a Town Cop Odd Night Doctor.

1=Town/Cop/Odd Night/Doctor; 4=2; 5=1/2/4/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Town/Even Night/Cop/Odd Night/Doctor

Welcome to game! You are a Town Even Night Cop Odd Night Doctor.

1=Town/Even Night/Cop/Odd Night/Doctor; 4=2; 5=1/3/5/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Mafia/Ascetic/Multitasking/Even Night/Cop/Odd Night/Doctor

Welcome to game! You are an Ascetic Mafia Multitasking Even Night Cop Odd Night Doctor.

1=Mafia/Ascetic/Multitasking/Even Night/Cop/Odd Night/Doctor; 2=Multitasking; 4=3; 5=1/2/3/5/7/

You win if at least one mafia member is alive and all other players are dead (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.

Town/Loud/Multitasking/Jack of All Trades/Cop/Weak/Doctor/Innocent Child/Activated

Welcome to game! You are a Town Loud Multitasking Jack of All Trades Cop Weak Doctor Activated Innocent Child.

1=Town/Loud/Multitasking/Jack of All Trades/Cop/Weak/Doctor/Innocent Child/Activated; 2=Multitasking; 3=Jack of All Trades; 4=3; 5=1/3/4/5/7/9/

You win if all threats to the town are eliminated and at least one town-aligned player is alive.

Confirm by replying to this PM with a summary of your role.

Serial Killer/Even Night/Ascetic/2-shot/Loud/Ninja/Weak/Rolecop/Odd Night/Doctor

Welcome to game! You are an Even Night Ascetic Serial Killer 2-shot Loud Ninja Weak Rolecop Odd Night Doctor.

1=Serial Killer/Even Night/Ascetic/2-shot/Loud/Ninja/Weak/Rolecop/Odd Night/Doctor; 4=3; 5=1/3/8/10/

You win if you are the last player alive (or if nothing can prevent the same).

Confirm by replying to this PM with a summary of your role.