-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathose_retainer_gen.py
421 lines (393 loc) · 17.6 KB
/
ose_retainer_gen.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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
#made by boombaklops. modify as you please, but gimme credit :)
from random import randint, choice
class Retainer():
def __init__(self):
#preparing lists for later use
races = [
'Half-Orc',
'Human'
]
jobs = [
'Fighter',
'Thief'
]
one_handed_weapons = [
'club 1d4',
'dagger 1d4',
'hand axe 1d6',
'javelin 1d4',
'mace 1d6',
'short sword 1d6',
'silver dagger 1d4',
'sling 1d4',
'spear 1d6',
'sword 1d8',
'war hammer 1d6'
]
two_handed_weapons = [
'battle axe 1d8',
'staff 1d4',
'two-handed sword 1d10',
'short bow 1d6',
'polearm 1d10',
'long bow 1d6',
'lance 1d6',
'crossbow 1d6'
]
armor = [
'leather armor AC 7 [12]',
'chain armor AC 5 [14]',
'plate armor AC 3 [16]'
]
#stats
self.strength = randint(1, 6) + randint(1, 6) + randint(1, 6)
self.intelligence = randint(1, 6) + randint(1, 6) + randint(1, 6)
self.wisdom = randint(1, 6) + randint(1, 6) + randint(1, 6)
self.dexterity = randint(1, 6) + randint(1, 6) + randint(1, 6)
self.constitution = randint(1, 6) + randint(1, 6) + randint(1, 6)
self.charisma = randint(1, 6) + randint(1, 6) + randint(1, 6)
#race selection
if self.intelligence >= 9:races.extend(['Drow', 'Elf'])
if self.intelligence >= 9 and self.constitution >= 9: races.extend(['Duergar', 'Gnome'])
if self.constitution >= 9: races.extend(['Dwarf', 'Svirfneblin'])
if self.charisma >= 9 and self.constitution >= 9: races.append('Half-Elf')
if self.dexterity >= 9 and self.constitution >= 9: races.append('Halfling')
#choose a race
self.race = choice(races)
#modify stats, then class eligibility checks
if self.race == 'Drow':
self.constitution = self.cap_stats(self.constitution - 1)
self.dexterity = self.cap_stats(self.dexterity + 1)
jobs.extend(["Acrobat","Assassin","Cleric","Magic-User"])
if self.constitution >= 9 and self.wisdom >= 9: jobs.append("Ranger")
if self.constitution >= 9 and self.dexterity >= 9: jobs.append("Knight")
if self.race == 'Duergar':
self.charisma = self.cap_stats(self.charisma - 1)
self.constitution = self.cap_stats(self.constitution + 1)
jobs.extend(['Assassin', 'Cleric'])
if self.race == 'Dwarf':
self.charisma = self.cap_stats(self.charisma - 1)
self.constitution = self.cap_stats(self.constitution + 1)
jobs.extend(['Assassin', 'Cleric'])
if self.race == 'Elf':
self.dexterity = self.cap_stats(self.dexterity + 1)
self.constitution = self.cap_stats(self.constitution - 1)
jobs.extend(["Acrobat","Assassin","Cleric","Druid","Magic-User"])
if self.constitution >= 9 and self.dexterity >= 9: jobs.append("Knight")
if self.constitution >= 9 and self.wisdom >= 9: jobs.append("Ranger")
if self.race == 'Gnome':
jobs.extend(["Assassin","Cleric"])
if self.dexterity >= 9: jobs.append("Illusionist")
if self.race == 'Half-Elf':
jobs.extend(["Acrobat","Assassin","Cleric","Magic-User"])
if self.dexterity >= 9 and self.intelligence >= 9: jobs.append("Bard")
if self.constitution >= 9 and self.wisdom >= 9: jobs.append("Ranger")
if self.charisma >= 9: jobs.append("Paladin")
if self.constitution >= 9 and self.dexterity >= 9: jobs.append("Knight")
if self.race == 'Halfling':
self.dexterity = self.cap_stats(self.dexterity + 1)
self.strength = self.cap_stats(self.strength - 1)
jobs.append('Druid')
if self.race == 'Half-Orc':
self.constitution = self.cap_stats(self.constitution + 1)
self.charisma = self.cap_stats(self.charisma - 2)
jobs.extend(['Acrobat', 'Assassin', 'Cleric'])
if self.race == 'Human':
jobs.extend(["Acrobat","Assassin","Cleric","Druid","Magic-User"])
if self.dexterity >= 9 and self.intelligence >= 9: jobs.append("Bard")
if self.dexterity >= 9: jobs.append("Barbarian")
if self.constitution >= 9 and self.wisdom >= 9: jobs.append("Ranger")
if self.charisma >= 9: jobs.append("Paladin")
if self.constitution >= 9 and self.dexterity >= 9: jobs.append("Knight")
if self.dexterity >= 9: jobs.append("Illusionist")
if self.race == 'Svirfneblin':
jobs.extend(["Assassin","Cleric","Druid","Magic-User"])
#cap stats
#choose class
self.job = choice(jobs)
#job-related generation
self.inventory = []
self.spells_known = []
if self.job == 'Acrobat':
self.hp = randint(1, 4) + self.get_conmod()
self.death_save = 13
self.wand_save = 14
self.paralysis_save = 13
self.breath_save = 16
self.spell_save = 15
self.alignment = choice(['Lawful', 'Neutral', 'Chaotic'])
self.inventory.append('leather armor AC 7 [12]')
self.inventory.append(choice([
'short bow 1d6',
'long bow 1d6',
'crossbow 1d6',
'dagger 1d4',
'sword 1d8',
'short sword 1d6',
'polearm 1d10',
'spear 1d6',
'staff 1d4'
]))
if self.job == 'Assassin':
self.hp = randint(1, 4) + self.get_conmod()
self.death_save = 13
self.wand_save = 14
self.paralysis_save = 13
self.breath_save = 16
self.spell_save = 15
self.alignment = choice(['Neutral', 'Chaotic'])
self.inventory.append('leather armor AC 7 [12]')
weapon = choice(two_handed_weapons + one_handed_weapons)
self.inventory.append(weapon)
if weapon not in two_handed_weapons and weapon != 'sling 1d4': self.inventory.append('shield AC +1')
if self.job == 'Barbarian':
self.hp = randint(1, 8) + self.get_conmod()
self.death_save = 10
self.wand_save = 13
self.paralysis_save = 12
self.breath_save = 15
self.spell_save = 16
self.alignment = choice(['Lawful', 'Neutral', 'Chaotic'])
self.inventory.append(choice(['leather armor AC 7 [12]', 'chain armor AC 5 [14]']))
weapon = choice(two_handed_weapons + one_handed_weapons)
self.inventory.append(weapon)
if weapon not in two_handed_weapons and weapon != 'sling 1d4': self.inventory.append('shield AC +1')
if self.job == 'Bard':
self.hp = randint(1, 6) + self.get_conmod()
self.death_save = 13
self.wand_save = 14
self.paralysis_save = 13
self.breath_save = 16
self.spell_save = 15
self.alignment = choice(['Lawful', 'Neutral', 'Chaotic'])
self.inventory.append(choice(['leather armor AC 7 [12]', 'chain armor AC 5 [14]']))
weapon = choice(['short bow 1d6', 'long bow 1d6', 'crossbow 1d6'] + one_handed_weapons)
self.inventory.append(weapon)
if self.job == 'Cleric':
self.hp = randint(1, 6) + self.get_conmod()
self.death_save = 11
self.wand_save = 12
self.paralysis_save = 14
self.breath_save = 16
self.spell_save = 15
self.alignment = choice(['Lawful', 'Neutral', 'Chaotic'])
self.inventory.append(choice(armor))
weapon = choice([
'club 1d4',
'mace 1d6',
'sling 1d4',
'war hammer 1d6',
'staff 1d4'
])
self.inventory.append(weapon)
if weapon not in two_handed_weapons and weapon != 'sling 1d4': self.inventory.append('shield AC +1')
if self.job == 'Druid':
self.hp = randint(1, 6) + self.get_conmod()
self.death_save = 11
self.wand_save = 12
self.paralysis_save = 14
self.breath_save = 16
self.spell_save = 15
self.alignment = 'Neutral'
self.inventory.append('leather armor AC 7 [12]')
weapon = choice([
'club 1d4',
'dagger 1d4',
'sling 1d4',
'spear 1d6',
'staff 1d4'
])
self.inventory.append(weapon)
if weapon not in two_handed_weapons and weapon != 'sling 1d4': self.inventory.append('shield AC +1')
druid_spells = [
'Animal Friendship',
'Detect Danger',
'Entangle',
'Faerie Fire',
'Invisibility to Animals',
'Locate Plant or Animal',
'Predict Weather',
'Speak with Animals'
]
self.spells_known.append(choice(druid_spells))
if self.job == 'Fighter':
self.hp = randint(1, 8) + self.get_conmod()
self.death_save = 12
self.wand_save = 13
self.paralysis_save = 14
self.breath_save = 15
self.spell_save = 16
self.alignment = choice(['Lawful', 'Neutral', 'Chaotic'])
self.inventory.append(choice(armor))
weapon = choice(two_handed_weapons + one_handed_weapons)
self.inventory.append(weapon)
if weapon not in two_handed_weapons and weapon != 'sling 1d4': self.inventory.append('shield AC +1')
if self.job == 'Illusionist':
self.hp = randint(1, 4) + self.get_conmod()
self.death_save = 13
self.wand_save = 14
self.paralysis_save = 13
self.breath_save = 16
self.spell_save = 15
self.alignment = choice(['Lawful', 'Neutral', 'Chaotic'])
self.inventory.append(choice(['dagger 1d4', 'staff 1d4']))
illusionist_spells = [
'Auditory Illusion',
'Chromatic Orb',
'Colour Spray',
'Dancing Lights',
'Detect Illusion',
'Glamour',
'Hypnotism',
'Light',
'Phantasmal Force',
'Read Magic',
'Wall of Fog',
'Spook'
]
self.spells_known.append(choice(illusionist_spells))
if self.job == 'Knight':
self.hp = randint(1, 8) + self.get_conmod()
self.death_save = 12
self.wand_save = 13
self.paralysis_save = 14
self.breath_save = 16
self.spell_save = 15
self.alignment = choice(['Lawful', 'Neutral', 'Chaotic'])
self.inventory.append(choice(['chain armor AC 5 [14]', 'plate armor AC 3 [16]']))
weapon = choice([
'club 1d4',
'dagger 1d4',
'hand axe 1d6',
'mace 1d6',
'short sword 1d6',
'silver dagger 1d4',
'spear 1d6',
'sword 1d8',
'war hammer 1d6'
'battle axe 1d8',
'staff 1d4',
'two-handed sword 1d10',
'polearm 1d10',
'lance 1d6'
])
self.inventory.append(weapon)
if weapon not in two_handed_weapons and weapon != 'sling 1d4': self.inventory.append('shield AC +1')
if self.job == 'Magic-User':
self.hp = randint(1, 4) + self.get_conmod()
self.death_save = 13
self.wand_save = 14
self.paralysis_save = 13
self.breath_save = 16
self.spell_save = 15
self.alignment = choice(['Lawful', 'Neutral', 'Chaotic'])
self.inventory.append(choice(['dagger 1d4', 'staff 1d4']))
magic_user_spells = [
'Charm Person',
'Detect Magic',
'Floating Disc',
'Hold Portal',
'Light',
'Magic Missile',
'Protection from Evil',
'Read Languages',
'Read Magic',
'Sleep',
'Shield',
'Ventriloquism'
]
self.spells_known.append(choice(magic_user_spells))
if self.job == 'Paladin':
self.hp = randint(1, 8) + self.get_conmod()
self.death_save = 10
self.wand_save = 11
self.paralysis_save = 12
self.breath_save = 13
self.spell_save = 14
self.alignment = 'Lawful'
self.inventory.append(choice(armor))
weapon = choice(two_handed_weapons + one_handed_weapons)
self.inventory.append(weapon)
if weapon not in two_handed_weapons and weapon != 'sling 1d4': self.inventory.append('shield AC +1')
if self.job == 'Ranger':
self.hp = randint(1, 8) + self.get_conmod()
self.death_save = 12
self.wand_save = 13
self.paralysis_save = 14
self.breath_save = 15
self.spell_save = 16
self.alignment = choice(['Lawful', 'Neutral'])
self.inventory.append(choice(['leather armor AC 7 [12]', 'chain armor AC 5 [14]']))
weapon = choice(two_handed_weapons + one_handed_weapons)
self.inventory.append(weapon)
if weapon not in two_handed_weapons and weapon != 'sling 1d4': self.inventory.append('shield AC +1')
if self.job == 'Thief':
self.hp = randint(1, 4) + self.get_conmod()
self.death_save = 13
self.wand_save = 14
self.paralysis_save = 13
self.breath_save = 16
self.spell_save = 15
self.alignment = choice(['Lawful', 'Neutral', 'Chaotic'])
self.inventory.append('leather armor AC 7 [12]')
weapon = choice(two_handed_weapons + one_handed_weapons)
self.inventory.append(weapon)
#hp check
if self.hp < 1: self.hp = 1
#figure out armor class
self.descending_armor_class = 9
self.ascending_armor_class = 10
if 'leather armor AC 7 [12]' in self.inventory:
self.descending_armor_class = 7
self.ascending_armor_class = 12
if 'chain armor AC 5 [14]' in self.inventory:
self.descending_armor_class = 5
self.ascending_armor_class = 14
if 'plate armor AC 3 [16]' in self.inventory:
self.descending_armor_class = 3
self.ascending_armor_class = 16
if 'shield AC +1' in self.inventory:
self.descending_armor_class -= 1
self.ascending_armor_class += 1
def cap_stats(self, number):
if number < 3: return 3
if number > 18: return 18
return number
def get_conmod(self):
if self.constitution == 3: conmod = -3
if self.constitution >= 4: conmod = -2
if self.constitution >= 6: conmod = -1
if self.constitution >= 9: conmod = 0
if self.constitution >= 13: conmod = 1
if self.constitution >= 16: conmod = 2
if self.constitution == 18: conmod = 3
return conmod
def get_dexmod(self):
if self.dexterity == 3: dexmod = -3
if self.dexterity >= 4: dexmod = -2
if self.dexterity >= 6: dexmod = -1
if self.dexterity >= 9: dexmod = 0
if self.dexterity >= 13: dexmod = 1
if self.dexterity >= 16: dexmod = 2
if self.dexterity == 18: dexmod = 3
return dexmod
def get_sheet(self):
inventory = ', '.join(self.inventory)
if len(self.spells_known) > 0:
spell_list = ', '.join(self.spells_known)
spells = f"Spells: {spell_list}"
return f"Level 1 {self.alignment} {self.race} {self.job}\n{self.hp} HP\nAC {self.descending_armor_class - self.get_dexmod()} [{self.ascending_armor_class + self.get_dexmod()}]\nTHAC0 19 (+0)\nSTR {self.strength} INT {self.intelligence} WIS {self.wisdom} DEX {self.dexterity} CON {self.constitution} CHA {self.charisma}\nD{self.death_save} W{self.wand_save} P{self.paralysis_save} B{self.breath_save} S{self.spell_save}\nEquipment: {inventory}\n{spells}"
else:
return f"Level 1 {self.alignment} {self.race} {self.job}\n{self.hp} HP\nAC {self.descending_armor_class - self.get_dexmod()} [{self.ascending_armor_class + self.get_dexmod()}]\nTHAC0 19 (+0)\nSTR {self.strength} INT {self.intelligence} WIS {self.wisdom} DEX {self.dexterity} CON {self.constitution} CHA {self.charisma}\nD{self.death_save} W{self.wand_save} P{self.paralysis_save} B{self.breath_save} S{self.spell_save}\nEquipment: {inventory}"
try:
quota = int(input("How many retainers to generate? Enter to exit.\n"))
print('')
except:
raise SystemExit
file = open('retainers.txt', 'a')
for x in range(quota):
retainer = Retainer()
print(retainer.get_sheet() + '\n')
file.write(retainer.get_sheet() + '\n\n')
file.close()
input('Retainers exported to "retainers.txt". Press Enter to exit.')