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

Template:Rp/LastRclIndex/doc: Difference between revisions

From MafiaWiki
Jump to navigation Jump to search
(document and test Rp/LastRclIndex)
 
(line break fix when this is transcluded)
 
Line 1: Line 1:
<includeonly>----</includeonly>
{{Template
{{Template
|Name=Rp/LastRclIndex
|Name=Rp/LastRclIndex
Line 5: Line 4:
|Sub=Yes
|Sub=Yes
|Designer=callforjudgement}}
|Designer=callforjudgement}}
<includeonly>----</includeonly>
The {{tl|Rp/LastRclIndex}} template finds the last role component of a given classification in a role string. It's used to split up a role string between passives, general restrictions, and actives.
The {{tl|Rp/LastRclIndex}} template finds the last role component of a given classification in a role string. It's used to split up a role string between passives, general restrictions, and actives.



Latest revision as of 20:10, 27 May 2018

Name:
  • Rp/LastRclIndex
Type:
Sub-Template:
  • Yes
Designer:

The {{Rp/LastRclIndex}} template finds the last role component of a given classification in a role string. It's used to split up a role string between passives, general restrictions, and actives.

The first parameter is the role string to split. The second parameter is the {{rcl}} value to search for (p by default, so that the template is looking for the end of the passives section). If no copies of the given role component are found, the template returns 1 (which means that splitting up the role string in the way envisaged by this template will produce a blank section, which is likely the desired outcome).

Test cases

Town
1
Mafia
1
Town/Cop
1
Town/Bulletproof
2
Mafia/Loyal/Jailkeeper
1
Mafia/Bulletproof/Jailkeeper
2
Mafia/Multitasking/Jailkeeper
1
Mafia/Ninja
1
Town/Cop/Doctor
1
Town/Bulletproof/Enabler
3
Town/Odd Night/Doctor/Enabler
4
Town/Bulletproof/Activated
1
Town/Ascetic/Bulletproof
3
Town/Ascetic/Bulletproof/Enabler
4
Town/Cop/Odd Night/Doctor
1
Town/Even Night/Cop/Odd Night/Doctor
1
Mafia/Ascetic/Multitasking/Even Night/Cop/Odd Night/Doctor
2
Town/Loud/Multitasking/Jack of All Trades/Cop/Weak/Doctor/Innocent Child/Activated
1
Serial Killer/Even Night/Ascetic/2-shot/Loud/Ninja/Weak/Rolecop/Odd Night/Doctor
3