-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathprint_character.py
124 lines (117 loc) · 5.56 KB
/
print_character.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
"""
Extracted from the core generator.
This does nothing but call the character generator and print it locally.
"""
import argparse
import generator
parser = argparse.ArgumentParser(description='Get Game System')
parser.add_argument('-g', '--game_system', type=str, required=True,
choices=['bnt', 'bntx', 'dd', 'ddh', 'ddx', 'def', 'ham', 'm81', 'pla', 'rbh', 'rpt', 'tnu'],
help='The abbreviated Game System (bnt, bntx, def, dd, ddh, ddx, ham, m81, pla, rbh, rpt, tnu)')
parser.add_argument('-n', '--number_of_characters', type=int, action='store', default=1,
help='How many character to generate.')
parser.add_argument('-y', '--silly', action='store_true', help='Use the "silly" skill and item options.')
args = parser.parse_args()
supported_systems = [
'bnt', 'bntx', 'dd', 'ddh', 'ddx', 'def', 'ham', 'm81', 'pla', 'rbh', 'rpt', 'tnu'
]
def print_character(character):
if args.silly:
print("A new random SILLY character for " + str(character.system_fullname))
else:
print("A new random character for " + str(character.system_fullname))
print("-----------------------------------------------------")
# print("Raw Data Print: ", gen_data)
if character.system == 'tnu':
print("Profession: %s; Level: %s; Race: %s" % (character.long, str(character.lvl), character.race))
else:
print("Character Class: %s; Level: %s; Race: %s; Hit Dice: %sd%s; Max Hit Points: %s" %
(character.long, str(character.lvl), character.race, str(character.lvl), str(character.hd),
str(character.hd + character.stats[str(character.hps_mod)]['mod'])))
print("Alignment: %s; Age: %s; Looks: %s" % (character.align.title(), character.age, character.looks))
print("Trait: %s; Background: %s; Social Status: %s (%s)" %
(character.personality, character.background, character.soc_class, str(character.soc_mod)))
if character.system == 'tnu':
print("Disposition: %sd%s; Psychic Armour: %s" % (str(character.lvl), str(character.hd), str(character.pa)))
print("---------------")
print("\nAttribute Scores:")
print("-----------------")
for key, value in dict.items(character.stats):
if int(value['val']) < 10 and int(value['mod']) < 0:
print("%s: %s (%s): Affects %s" % (key, str(value['val']), str(value['mod']), str(character.affects[key])))
elif int(value['val']) < 10 and int(value['mod']) >= 0:
print("%s: %s (+%s): Affects %s" % (key, str(value['val']), str(value['mod']),
str(character.affects[key])))
elif int(value['val']) > 9 and int(value['mod']) >= 0:
print("%s: %s (+%s): Affects %s" % (key, str(value['val']), str(value['mod']), str(character.affects[key])))
else:
print("%s: %s (%s): Affects %s" % (key, str(value['val']), str(value['mod']), str(character.affects[key])))
if character.saves:
print("\nSaving Throws:")
print("--------------")
for key, value in dict.items(character.saves):
print("%s: %s" % (key, str(value)))
print("\nLanguages:")
print("----------")
for x in list(character.languages):
print(x)
if character.skills:
print("\nSkills:")
print("-------")
for x in list(character.skills):
print(x)
print("\nCombat Mods and Traits:")
print("-----------------------")
if character.system == 'ham':
print("# of Attack Dice: %sd20; Melee: %s; Ranged: %s; Hit Die: d%s; DEF: %s" %
(str(character.number_of_attacks), str(character.melee), str(character.range),
str(character.hd), str(character.ac)))
else:
print("Melee: %s; Ranged: %s; AC: %s" % (str(character.melee), str(character.range), str(character.ac)))
print("\nRestrictions:")
print("--------------------")
for x in list(character.restrictions):
print(x)
print("\nTraits and Abilities:")
print("--------------------")
for x in list(character.traits):
print(x)
print("\nMy Weapons:")
print("-----------")
for x in list(character.weapons):
print(x)
print("\nMy Armour:")
print("----------")
for x in list(character.armour):
print(x)
if character.encumbrance:
print("\nMy Gear: [Max Encumbrance: " + str(character.encumbrance) + "]")
else:
print("\nMy Gear:")
print("--------")
for x in list(character.gear):
print(x)
if character.caster:
print("\nSpells Known:")
print("-------------")
if character.num_spells <= 0:
print("I have no spells because I am the worst %s ever!" % character.long)
else:
for s in list(character.spells):
print(s)
print("--------------------")
if __name__ == "__main__":
game_sys = args.game_system
while game_sys not in supported_systems:
print("\nGame System choice is missing or invalid. Please enter one of the following systems:\n")
print("bnt = Blood & Treasure (1st Edition)")
print("bntx = Blood & Treasure 1st Edition with Expanded Monster Races")
print("dd = Dark Dungeons")
print("ddh = Dark Dungeons + HAMMERCRAWL!")
print("m81 = Microlite81")
print("ham = HAMMERCRAWL!")
print("tnu = The Nightmares Underneath")
print()
game_sys = input("Enter the system abbreviation from above: ")
for n in range(args.number_of_characters):
print_character(generator.generate(game_sys.lower(), args.silly))