-
Notifications
You must be signed in to change notification settings - Fork 5
/
henchgenlib.py
224 lines (211 loc) · 14.8 KB
/
henchgenlib.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# henchgenlib.py
# ACKS henchman and hireling generator data and rules library
# v1.1, November 10th, 2018.
# This is open source code, feel free to use it for any purpose.
# Contact the author at [email protected].
#import modules
import random
import string
import stellagama
def attribute_modifier(attribute): #input ability score
"""
generates attribute modifier from attribute
"""
modlib=[0, -3, -3, -3, -2, -2, -1, -1, -1, 0, 0, 0, 0, 1, 1, 1, 2, 2, 3]
return modlib[attribute] #output ability modifier
def sex_gen():
"""
sex-generating function
"""
roll=stellagama.dice(1,6)
if roll in [1, 2, 3]:
return "male"
elif roll in [4, 5, 6]:
return "female"
else:
return "androgynous"
def race_gen(con, intel):
"""
race-generating function
"""
roll=stellagama.dice(1,6)
if roll in [1, 2, 3, 4]:
return "human"
elif roll==5 and intel>=9:
return "elf"
if roll==6 and con>=9:
return "dwarf"
else:
return "human"
def name_gen(sex): #input character sex
"""
randomly chooses a character name from a list
"""
name=""
if sex=="male":
return stellagama.random_line("malenames.txt") #output random male name
elif sex=="female":
return stellagama.random_line("femalenames.txt") #output random female name
else: #in case of wrong input
return "Tokay" #output placeholder
def charclass(STR, DEX, CON, INT, WIS, CHA, sex, race, level): #choses character class based on attributes, sex, and level
attribute_list=[STR, DEX, CON, INT, WIS, CHA]
profession="fighter"
if level==0:
profession=random.choice(["mercenary", "peasant", random.choice(["thug", "hunter", "soldier", "town guard", "savage", "highwayman", "petty noble"]), random.choice(["alchemist", "animal trainer", "armorer", "barber", "beggar", "blacksmith", "butcher", "cheesemaker", "cobbler", "conman", "cooper", "cutpurse", "fletcher", "folk healer", "fortune-teller", "gambler", "gravedigger", "herbalist", "jeweler", "locksmith", "lumberjack", "mariner", "mendicant", "merchant", "miller", "minstrel", "rope maker", "prostitute", "scribe", "shepherd", "tailor", "tax collector", "trapper", "village idiot", "urchin", "weaver"])])
else:
if race=="human":
if STR==max(attribute_list):
profession=random.choice(["fighter", "explorer"])
elif DEX==max(attribute_list):
profession=random.choice(["thief", "assassin"])
elif CON==max(attribute_list):
profession="fighter"
elif INT==max(attribute_list):
profession="mage"
elif WIS==max(attribute_list) and sex=="male":
profession="cleric"
elif WIS==max(attribute_list) and sex=="female":
random.choice(["bladedancer", "bladedancer", "cleric"])
elif CHA==max(attribute_list):
profession="bard"
else:
profession="fighter"
elif race=="dwarf":
if WIS==max(attribute_list):
profession="craftpriest"
else:
profession="vaultguard"
elif race=="elf":
if INT==max(attribute_list):
profession="spellsword"
else:
profession="nightblade"
else:
profession="fighter"
return profession #returns chosen class
def general_proficiency():
"""
generate general proficiencies
"""
return random.choice(["Alchemy", "Animal Husbandry", "Animal Training", "Art", "Bargaining", "Caving", "Collegiate Wizardry", "Craft", "Diplomacy", "Disguise", "Endurance", "Engineering", "Gambling", "Healing", "Intimidation", "Knowledge", "Labor", "Language", "Leadership", "Lip Reading", "Manual of Arms", "Mapping", "Military Strategy", "Mimicry", "Naturalism", "Navigation", "Performance", "Possession", "Riding", "Seafaring", "Seduction", "Siege Engineering", "Signalling", "Survival", "Theology", "Tracking", "Trapping"])
def genprofgen(level, intmod): #input level and intelligence modifier
"""
generates general proficiencies
"""
proflist=[]
if level==0:
for i in range (0, 4):
proflist.append(general_proficiency())
if intmod>=1:
for i in range (0, intmod):
proflist.append(general_proficiency())
else:
if intmod>=1:
for i in range (0, intmod+1):
proflist.append(general_proficiency())
else:
proflist=[general_proficiency()]
return proflist #output general proficiency list
def classprof(level, cclass): #input character level
"""
generate class proficiencies
"""
proflist=[]
if cclass=="assassin":
profs=["Acrobatics", "Alchemy", "Alertness", "Arcane Dabbling", "Blind Fighting", "Bribery", "Cat Burglary", "Climbing", "Combat Reflexes", "Combat Trickery (disarm)", "Combat Trickery (incapacitate)", "Contortionism", "Disguise", "Eavesdropping", "Fighting Style", "Gambling", "Intimidation", "Mimicry", "Precise Shooting", "Running", "Seduction", "Skirmishing", "Skulking", "Sniping", "Swashbuckling", "Trap Finding", "Weapon Finesse", "Weapon Focus"]
if cclass=="bard":
profs=["Acrobatics", "Alchemy", "Alertness", "Arcane Dabbling", "Blind Fighting", "Bribery", "Cat Burglary", "Climbing", "Combat Reflexes", "Combat Trickery (disarm)", "Command", "Diplomacy", "Eavesdropping", "Elven Bloodline", "Fighting Style", "Healing", "Knowledge", "Language", "Leadership", "Lip Reading", "Magical Engineering", "Magical Music", "Mimicry", "Mystic Aura", "Performance", "Precise Shooting", "Prestidigitation", "Running", "Seduction", "Skirmishing", "Swashbuckling", "Weapon Finesse", "Weapon Focus"]
if cclass=="bladedancer":
profs=["Acrobatics", "Apostasy", "Battle Magic", "Beast Friendship", "Combat Reflexes", "Combat Trickery (disarm)", "Combat Trickery (trip)", "Contemplation", "Diplomacy", "Divine Blessing", "Divine Health", "Fighting Style", "Laying on Hands", "Magical Music", "Martial Training", "Performance", "Prestidigitation", "Prophecy", "Quiet Magic", "Righteous Turning", "Running", "Seduction", "Skirmishing", "Swashbuckling", "Theology", "Unflappable Casting", "Weapon Finesse", "Weapon Focus"]
if cclass=="cleric":
profs=["Apostasy", "Battle Magic", "Beast Friendship", "Combat Trickery (force back)", "Combat Trickery (overrun)", "Combat Trickery (sunder)", "Command", "Contemplation", "Diplomacy", "Divine Blessing", "Divine Health", "Fighting Style", "Healing", "Knowledge (history)", "Laying on Hands", "Leadership", "Loremastery", "Magical Engineering", "Martial Training", "Prestidigitation", "Profession (judge)", "Prophecy", "Quiet Magic", "Righteous Turning", "Sensing Evil", "Sensing Power", "Theology", "Unflappable Casting", "Weapon Focus"]
if cclass=="explorer":
profs=["Alertness", "Ambushing", "Beast Friendship", "Blind Fighting", "Climbing", "Combat Reflexes", "Combat Trickery (disarm)", "Combat Trickery (knock down)", "Eavesdropping", "Endurance", "Fighting Style", "Land Surveying", "Mapping", "Mountaineering", "Naturalism", "Navigation", "Passing Without Trace", "Precise Shooting", "Riding", "Running", "Seafaring", "Skirmishing", "Sniping", "Survival", "Swashbuckling", "Trapping", "Weapon Finesse", "Weapon Focus"]
if cclass=="fighter":
profs=["Acrobatics", "Alertness", "Berserkergang", "Blind Fighting", "Combat Reflexes", "Combat Trickery (disarm)", "Combat Trickery (force back)", "Combat Trickery (knock down)", "Combat Trickery (sunder)", "Command", "Dungeon Bashing", "Endurance", "Fighting Style", "Gambling", "Intimidation", "Leadership", "Manual of Arms", "Military Strategy", "Precise Shooting", "Riding", "Running", "Siege Engineering", "Skirmishing", "Survival", "Swashbuckling", "Weapon Finesse", "Weapon Focus"]
if cclass=="mage":
profs=["Alchemy", "Battle Magic", "Beast Friendship", "Black Lore of Zahar", "Collegiate Wizardry", "Craft", "Diplomacy", "Elementalism", "Elven Bloodline", "Engineering", "Familiar", "Healing", "Illusion Resistance", "Knowledge", "Language", "Loremastery", "Magical Engineering", "Mapping", "Mystic Aura", "Naturalism", "Quiet Magic", "Performance", "Prestidigitation", "Profession", "Sensing Power", "Transmogrification", "Soothsaying", "Unflappable Casting"]
if cclass=="thief":
profs=["Acrobatics", "Alertness", "Arcane Dabbling", "Blind Fighting", "Bribery", "Cat Burglary", "Combat Reflexes", "Combat Trickery (disarm)", "Combat Trickery (incapacitate)", "contortionism", "Diplomacy", "Fighting Style", "Gambling", "Intimidation", "Lip Reading", "Lockpicking", "Mapping", "Precise Shooting", "Riding", "Running", "Seafaring", "Skirmishing", "Skulking", "Sniping", "Swashbuckling", "Trap Finding", "Weapon Finesse", "Weapon Focus"]
if cclass=="craftpriest":
profs=["Alchemy", "Art", "Battle Magic", "Caving", "Collegiate Wizardry", "Contemplation", "Craft", "Diplomacy", "Divine Blessing", "Divine Health", "Dwarven Brewing", "Endurance", "Engineering", "Fighting Style", "Goblin-Slaying", "Healing", "Illusion Resistance", "Knowledge", "Laying on Hands", "Loremastery", "Magical Engineering", "Mapping", "Performance (chanting)", "Prestidigitation", "Profession (judge)", "Prophecy", "Quiet Magic", "Righteous Turning", "Sensing Evil", "Siege Engineering", "Theology", "Unflappable Casting", "Weapon Focus"]
if cclass=="vaultguard":
profs=["Alertness", "Berserkergang", "Blind Fighting", "Caving", "Combat Reflexes", "Combat Trickery (force back)", "Combat Trickery (knock down)", "Combat Trickery (overrun)", "Combat Trickery (sunder)", "Combat Trickery (wrestle)", "Command", "Craft", "Dungeon Bashing", "Dwarven Brewing", "Endurance", "Engineering", "Fighting Style", "Gambling", "Goblin-Slaying", "Illusion Resistance", "Intimidation", "Land Surveying", "Leadership", "Mapping", "Manual of Arms", "Military Strategy", "Mountaineering", "Siege Engineering", "Weapon Focus"]
if cclass=="nightblade":
profs=["Alchemy", "Alertness", "Battle Magic", "Beast Friendship", "Black Lore of Zahar", "Blind Fighting", "Combat Reflexes", "Combat Trickery (disarm)", "Combat Trickery (incapacitate)", "Contortionism", "Elementalism", "Familiar", "Fighting Style", "Intimidation", "Magical Engineering", "Mystic Aura", "Passing Without Trace", "Precise Shooting", "Prestidigitation", "Quiet Magic", "Running", "Sensing Power", "Skirmishing", "Skulking", "Sniping", "Swashbuckling", "Unflappable Casting", "Trap Finding", "Wakefulness", "Weapon Focus", "Weapon Finesse"]
if cclass=="spellsword":
profs=["Acrobatics", "Alertness", "Battle Magic", "Beast Friendship", "Black Lore of Zahar", "Blind Fighting", "Combat Reflexes", "Combat Trickery (disarm)", "Combat Trickery (knock down)", "Command", "Elementalism", "Familiar", "Fighting Style", "Leadership", "Loremastery", "Magical Engineering", "Magical Music", "Mystic Aura", "Naturalism", "Passing Without Trace", "Quiet Magic", "Precise Shooting", "Prestidigitation", "Running", "Sensing Power", "Skirmishing", "Soothsaying", "Swashbuckler", "Unflappable Casting", "Wakefulness", "Weapon Focus", "Weapon Finesse"]
if level in [1,2] and cclass in ["assassin", "vaultguard", "spellsword", "explorer", "fighter"]:
proflist.append(random.choice(profs))
elif level in [1, 2, 3] and cclass not in ["assassin", "vaultguard", "spellsword", "explorer", "fighter"]:
proflist.append(random.choice(profs))
if level in [3, 4] and cclass in ["assassin", "vaultguard", "spellsword", "explorer", "fighter"]:
for i in range (0,2):
proflist.append(random.choice(profs))
elif level==4 and cclass not in ["assassin", "vaultguard", "spellsword", "explorer", "fighter"]:
for i in range (0,2):
proflist.append(random.choice(profs))
proficiencies=", ".join(proflist)
return proficiencies #returns a list of class proficiencies
def profgen(intmod, level, cclass): #input character's intelligence modifier, level, and character class
"""
generate proficiency list
"""
proflist=genprofgen(level, intmod)
proflist.append(classprof(level, cclass))
return proflist #output proficiency list
def hp_gen(cclass, conmod, level): #input character class, constitution modifier, and level
"""
hit point generator
"""
if level==0:
hp=stellagama.dice(1, 6)+conmod
else:
if cclass in ["fighter", "vaultguard"]:
hp=stellagama.dice(level, 8)+conmod
elif cclass in ["mage", "thief"]:
hp=stellagama.dice(level, 4)+conmod
elif cclass in ["assassin", "cleric", "bard", "bladedancer", "explorer", "craftpriest", "spellsword", "nightblade"]:
hp=stellagama.dice(level, 6)+conmod
else:
hp=1+conmod
if hp<1:
hp=1
return hp #output hit points
def weapon_gen (cclass): #input character class
"""
weapon generation
"""
if cclass in ["fighter", "spellsword"]:
return random.choice(["Battle Axe", "Great Axe", "Hand Axe","Arbalest", "Crossbow", "Composite Bow", "Longbow", "Shortbow", "Club", "Flail", "Mace", "Morning Star", "Warhammer", "Javelin", "Pole Arm", "Spear", "Dagger", "Short Sword", "Sword", "Two-Handed Sword", "Staff", "Whip"])
if cclass=="mage":
return random.choice(["Staff", "Club", "Dagger", "Dart"])
if cclass=="cleric":
return random.choice(["Warhammer", "Mace", "Club", "Morning Star", "Staff", "Sling"])
if cclass in ["thief", "bard", "explorer", "nightblade"]:
return random.choice(["Battle Axe", "Hand Axe", "Arbalest", "Crossbow", "Composite Bow", "Longbow", "Shortbow", "Club", "Flail", "Sap", "Mace", "Warhammer", "Javelin", "Spear", "Dagger", "Short Sword", "Sword", "Whip"])
if cclass=="assassin":
return random.choice(["Hand Axe", "Hand Axe", "Arbalest", "Crossbow", "Crossbow", "Composite Bow", "Longbow", "Shortbow", "Dagger", "Dagger", "Dagger", "Dagger", "Dagger", "Short Sword", "Short Sword", "Short Sword", "Sword"])
if cclass=="bladedancer":
return random.choice(["Battle Axe", "Great Axe", "Hand Axe", "Dagger", "Sword", "Sword", "Sword", "Shortsword", "Shortsword", "Two-Handed Sword", "Two-Handed Sword"])
if cclass=="vaultguard":
return random.choice(["Battle Axe", "Battle Axe", "Battle Axe", "Great Axe", "Great Axe", "Great Axe", "Hand Axe", "Hand Axe", "Hand Axe", "Hand Axe", "Arbalest", "Crossbow", "Composite Bow", "Shortbow", "Club", "Flail", "Mace", "Warhammer", "Warhammer", "Warhammer", "Javelin", "Spear", "Dagger", "Short Sword", "Short Sword", "Whip"])
if cclass=="craftpriest":
return random.choice(["Battle Axe", "Great Axe", "Hand Axe", "Flail", "Mace", "Morning Star", "Warhammer"])
else:
return random.choice(["Staff", "Staff", "Staff", "Staff", "Club", "Club", "Club", "Club", "Dagger", "Dagger", "Dagger", "Dagger", "Dart", "Dart", "Pitchfork", "Pitchfork", "Pitchfork", "Pitchfork", "Pitchfork", "Pitchfork", "Meat Cleaver", "Meat Cleaver", "Crowbar", "Crowbar", "Shovel", "A Really Heavy Bell"])
def armor_gen (cclass): #input character class
"""
armor generation
"""
if cclass in ["fighter", "spellsword", "cleric", "vaultguard", "craftpriest"]:
return random.choice(["Leather Armor", "Scale Mail", "Scale Mail", "Chain Mail", "Chain Mail", "Chain Mail", "Banded Plate"])
if cclass in ["thief", "bard", "assassin", "bladedancer", "nightblade"]:
return random.choice(["Clothes", "Clothes", "Hide Armor", "Leather Armor" ])
if cclass == "explorer":
return random.choice (["clothes", "Hide Armor", "Leather Armor", "Scale Mail", "Chain Mail"])
if cclass == "mage":
return "Robes"
else:
return "Clothes"