Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 32 additions & 39 deletions NPC-generator.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# start_up abilities mannerisms interactions bond flaw talents appearance ideal race file write

# - human names

OUTPUT_FOLDER = "NPCs"
Expand All @@ -10,7 +8,7 @@



# import random

# roll between 0-6, split randomly between strength and weaknesses
d4 = [1, 2, 3, 4]
d3 = [1, 2, 3]
Expand All @@ -19,48 +17,64 @@
abilities = True
strengthnum = 0
weaknessnum = 0
strengths = {}
weaknesses = {}
# print(strweaknum)
strength = False
weakness = False
strength = True
weakness = True

while abilities:
if strweaknum is 0:
abilities = False
else:
strweak = random.choice(Flip)
if strweak is 1:
strengthnum +=1
strength = True
elif strweak is 0:
weaknessnum +=1
weakness = True
strweaknum -=1

# print(strengthnum)
# print(weaknessnum)

possibleability = {'Str', 'Dex', 'Con', 'Wis', 'Int', 'Cha'}
strengths = possibleability
strengths = {'Str', 'Dex', 'Con', 'Wis', 'Int', 'Cha'}

print(possibleability)
print(strengths)

while strength:
if strengthnum is 0:
strengths = strengths - possibleability
# print('in set strengths')
# print(strengths)
strengths -= possibleability
strength = False
else:
possibleability.pop()
strengthnum -=1

weaknesses = possibleability
# possibleability -= strengths
# print('strengths')
print(strengths)
# print('remaining possibilities')
# print(possibleability)

weaknesses = {'Str', 'Dex', 'Con', 'Wis', 'Int', 'Cha'} - strengths

# print('weakness possibilities')
# print(weaknesses)
# print('possible abilities')
# print(possibleability)


while weakness:
if weaknessnum is 0:
weaknesses = weaknesses - possibleability
weaknesses -= possibleability
weakness = False
else:
possibleability.pop()
weaknessnum -=1

# print('weaknesses')
print(weaknesses)

talent = random.choice(info.talent_list)

Expand Down Expand Up @@ -113,29 +127,13 @@

race = random.choice(list(info.racelist.keys()))

"""
if race is 'dwarf':
Race = info.dwarf
elif race is 'elf':
Race = info.elf
elif race is 'halfling':
Race = info.halfling
elif race is 'human':
Race = info.human
elif race is 'dragonborn':
Race = info.dragonborn
elif race is 'gnome':
Race = info.gnome
elif race is 'half-elf':
Race = info.half_elf
elif race is 'half-orc':
Race = info.half_orc
elif race is 'tiefling':
Race = info.tiefling
"""
Race = info.racelist[race]

if Race.name is 'Half-Elf':
if Race.name is not 'Half-Elf':
Male = Race.M
Female = Race.F
Lastname = Race.L
elif Race.name is 'Half-Elf':
roll = random.choice(Flip)
if roll is 1:
Male = info.human.M
Expand All @@ -145,11 +143,6 @@
Male = info.elf.M
Female = info.elf.F
Lastname = info.elf.L
else:
Male = Race.M
Female = Race.F
Lastname = Race.L


if sex is 'male':
Fname = random.choice(Male)
Expand Down