Last active
March 19, 2019 14:00
-
-
Save sgtsquiggs/1dca6b7b45dcef7afeef38b247cd9e80 to your computer and use it in GitHub Desktop.
Arkham Horror Investigator Randomizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import getopt | |
import random | |
def main(argv): | |
investigator_type = 'all' | |
full_team = False | |
pick_two = False | |
try: | |
opts, args = getopt.getopt(argv, '', ["type=", "team", "pick-two"]) | |
except getopt.GetoptError: | |
print("random_investigator --type=<type>") | |
sys.exit(2) | |
for opt, arg in opts: | |
if opt == "--type": | |
if arg in ['seeker', 'survivor', 'rogue', 'mystic', 'guardian', 'other']: | |
investigator_type = arg | |
else: | |
print("Invalid type: '" + arg + "'") | |
print("Valid types: seeker, survivor, rogue, mystic, guardian, other") | |
sys.exit(2) | |
if opt == "--team": | |
full_team = True | |
if opt == "--pick-two": | |
pick_two = True | |
seekers = ['Daisy Walker', 'Minh Thi Phan', 'Norman Withers', 'Rex Murphy', 'Ursula Downs', 'Joe Diamond'] | |
survivors = ['"Ashcan" Pete', 'Calvin Wright', 'Silas Marsh', 'Wendy Adams', 'Wiliam Yorick', 'Rita Young'] | |
rogues = ['"Skids" O\'Toole', 'Finn Edwards', 'Jenny Barnes', 'Sefina Rousseau', 'Preston Fairmont'] | |
mystics = ['Agnes Baker', 'Akachi Onyele', 'Father Mateo', 'Jim Culver', 'Marie Lambeau', 'Diana Stanley'] | |
guardians = ['Carolyn Fern', 'Leo Anderson', 'Mark Harrigan', 'Roland Banks', 'Zoey Samaras'] | |
other = ['Lola Hayes'] | |
investigators = seekers + survivors + rogues + mystics + guardians + other | |
if full_team: | |
type_map = {} | |
for i in seekers: | |
type_map[i] = 'seeker' | |
for i in survivors: | |
type_map[i] = 'survivor' | |
for i in rogues: | |
type_map[i] = 'rogue' | |
for i in mystics: | |
type_map[i] = 'mystic' | |
for i in guardians: | |
type_map[i] = 'guardian' | |
for i in other: | |
type_map[i] = 'other' | |
team = [] | |
while len(team) < 4: | |
continue_it = False | |
chosen = random.choice(investigators) | |
if chosen in team: | |
continue | |
for i in team: | |
if type_map[i] == type_map[chosen]: | |
continue_it = True | |
break | |
if continue_it: | |
continue | |
team.append(chosen) | |
if not pick_two: | |
for i in team: | |
print(i, "[" + type_map[i] + "]") | |
else: | |
if pick_two: | |
b_team = [] | |
while len(b_team) < 4: | |
continue_it = False | |
chosen = random.choice(investigators) | |
if chosen in team: | |
continue | |
if chosen in b_team: | |
continue | |
if type_map[team[len(b_team)]] == 'other': | |
for i in team: | |
if type_map[i] == type_map[chosen]: | |
continue_it = True | |
break | |
if continue_it: | |
continue | |
elif type_map[chosen] != type_map[team[len(b_team)]]: | |
continue | |
b_team.append(chosen) | |
for i in range(4): | |
print(f'{team[i]} [{type_map[team[i]]}] OR {b_team[i]} [{type_map[b_team[i]]}]') | |
else: | |
if investigator_type == 'seeker': | |
print("Random Seeker: " + random.choice(seekers)) | |
elif investigator_type == 'survivor': | |
print("Random Survivor: " + random.choice(survivors)) | |
elif investigator_type == 'rogue': | |
print("Random Rogue: " + random.choice(rogues)) | |
elif investigator_type == 'mystic': | |
print("Random Mystic: " + random.choice(mystics)) | |
elif investigator_type == 'guardian': | |
print("Random Guardian: " + random.choice(guardians)) | |
elif investigator_type == 'other': | |
print("Random Other: " + random.choice(other)) | |
else: | |
print("Random Investigator: " + random.choice(investigators)) | |
if __name__ == "__main__": | |
main(sys.argv[1:]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment