jacob614

updated randomized roles script

Jul 20th, 2014
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.27 KB | None | 0 0
  1. #!/usr/bin/env python3
  2.  
  3. import random
  4. import sys
  5.  
  6. REQUIRED_ROLES = ['wolf']
  7. WOLF_ROLES = ['wolf', 'werecrow', 'wolf cub', 'traitor', 'hag', 'sorcerer']
  8. NEUTRAL_ROLES = ['fool', 'monster', 'crazed shaman', 'vengeful ghost', 'clone', 'minion', 'cultist'] #minion and cultist aren't really neutral, but work better here
  9. SAFE_ROLES = ['village drunk', 'harlot', 'matchmaker', 'hunter', 'shaman']
  10. VILLAGER_ROLES = ['seer', 'oracle', 'augur', 'detective', 'village drunk',
  11.                   'harlot', 'guardian angel', 'bodyguard', 'village elder',
  12.                   'time lord', 'mad scientist', 'matchmaker', 'hunter', 'shaman',
  13.                   'lycan']
  14.  
  15. TEMPLATES = ['cursed villager', 'gunner', 'mayor', 'assassin', 'amnesiac', 'bureaucrat']
  16.  
  17. players = int(sys.argv[1])
  18.  
  19.  
  20. roles = REQUIRED_ROLES
  21. wolves = int(random.randint(25,35)/100*players+.5)-1
  22. safes = int(random.randint(15,45)/100*players+.5)-1
  23. neutrals = int(random.randint(0,15)/100*players+.5)
  24. templates = int(random.randint(5,40)/100*players+.5)
  25.  
  26. roles += [random.choice(WOLF_ROLES) for i in range(wolves)]
  27. roles += [random.choice(NEUTRAL_ROLES) for i in range(neutrals)]
  28. roles += [random.choice(SAFE_ROLES)] + [random.choice(VILLAGER_ROLES) for i in range(safes)]
  29.  
  30. cursed = False
  31. gunner = False
  32. amnesiac = False
  33.  
  34. for role in roles:
  35.     if role not in ('seer', 'oracle', 'wolf', 'werecrow', 'wolf cub', 'mad scientist', 'monster', 'fool'):
  36.         cursed = True
  37.  
  38.     if role not in ('wolf', 'werecrow', 'wolf cub', 'cultist', 'minion',
  39.                     'traitor', 'hag', 'sorcerer', 'fool', 'lycan'):
  40.         gunner = True
  41.  
  42.     if role not in ('wolf', 'werecrow', 'wolf cub', 'villager',
  43.                     'village drunk', 'village elder', 'time lord', 'cultist',
  44.                     'minion', 'traitor', 'lycan', 'vengeful ghost', 'clone',
  45.                     'fool', 'monster', 'matchmaker'):
  46.         amnesiac = True
  47.  
  48. if cursed and "seer" in roles or "oracle" in roles:
  49.     TEMPLATES.remove('cursed villager')
  50.  
  51. if not gunner:
  52.     TEMPLATES.remove('gunner')
  53.  
  54. if not amnesiac:
  55.     TEMPLATES.remove('amnesiac')
  56.  
  57. roles += [random.choice(TEMPLATES) for i in range(templates)]
  58.  
  59. if 'gunner' in roles:
  60.     roles.append('sharpshooter')
  61.  
  62. print('!fgame roles=' + ','.join(role + ':1' for role in roles))
Advertisement
Add Comment
Please, Sign In to add comment