-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerators.py
More file actions
74 lines (66 loc) · 2.81 KB
/
Generators.py
File metadata and controls
74 lines (66 loc) · 2.81 KB
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
import random
def generate_name(max_length=10):
vowels = ['a', 'e', 'i', 'o', 'u', 'y']
consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y',
'z']
repeat = ['b', 'd', 'e', 'f', 'g', 'l', 'm', 'o', 'p', 's', 't']
special = [['r','n'], ['b','l'], ['c','l'], ['c','r'], ['f','l'], ['s','m'], ['t','r'], ['s','p'], ['s','n'], ['d','r']]
if random.randint(1, 3) == 1:
name = [random.choice(vowels)]
else:
name = [random.choice(consonants)]
repeating = False
length = 1
gen = True
while gen:
if (random.randint(1, length) > 1 or length == 1) and (length<max_length or name[-1] == 'q'):
if name[-1] == 'q':
name.append('u')
name.append(random.choices(vowels, weights=[1, 1, 1, 1, 0, 0])[0])
length += 2
repeating = False
elif name[-1] in vowels and random.randint(1, 4) > 1:
name.extend(random.choice(special))
length += 2
repeating = False
elif (name[-1] in repeat and random.randint(1, 15) == 1) and repeating == False:
name.append(name[-1])
length += 1
repeating = True
elif (name[-1] == 't' and random.randint(1, 4) == 1) or (
name[-1] == 's' and random.randint(1, 10) == 1) or (
name[-1] == 'c' and random.randint(1, 6) == 1):
name.append('h')
length += 1
repeating = False
elif name[-1] == 'c' and random.randint(1, 15) == 1:
name.append('k')
length += 1
repeating = False
else:
if name[-1] in vowels:
if random.randint(1, 10) == 1:
name.append(random.choice(vowels))
else:
name.append(random.choice(consonants))
else:
name.append(random.choice(vowels))
length += 1
repeating = False
else:
if not name[-1] in vowels:
name.append(random.choice(vowels))
break
return ''.join(name).title()
def generate_relic():
relic1=['Lost','Holy','Mythical','Ancient','Infernal','Forgotten']
relic2=['Goblet','Crown','Sword','Armor','Totem','Scroll']
relic3 = ['Of Fire','Of Gold','Of Ruby','Of Chaos','Of Night',f'Of {generate_name(5)}']
part1 = random.choice(relic1)
part2 = random.choice(relic2)
part3check=random.choice(relic3)
part3 = part3check() if callable(part3check) else part3check
return 'The '+' '.join([part1,part2,part3])
if __name__ == "__main__":
for i in range(10):
print(generate_relic())