-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswordlore.py
1852 lines (1666 loc) · 83.4 KB
/
swordlore.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
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# coding=utf-8
# Imports~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import re
from BasicFunctions import *
from Language import *
# Classes~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Animal Classes~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
class Animal(object):
def __init__(self, names, bodyparts, covering):
self.names = names
self.bodyparts = bodyparts
self.covering = covering
class Bodypart(object):
def __init__(self, name, texture, count, shape):
self.name = name
self.texture = texture
self.count = count
self.shape = shape
def bodmod(self):
text_groups = {
'furry' : ['fire', 'straight', 'flame', 'stripe', 'curved', 'fluffy',
'boney', 'soft', 'furry', 'bright', 'dark', color()],
'feathery' : ['fire', 'straight', 'flame', 'stripe', 'spot', 'curved',
'round', 'boney', 'plume', 'bright', 'dark','boney', color()],
'scaly' : ['fire', 'straight', 'flame', 'wet','stripe','spot','rough', color()],
'organ' : ['fire', 'straight', 'flame', 'wet', color()],
'bone' : ['fire', 'straight', 'flame', 'stripe', 'curved', 'sharp',
'boney', 'soft', 'hard', color()]
}
shape_groups = {
#I know these shape names are not descriptive (Its really hard) so I've added examples above each one
# legs, necks and arms
'connector' : ['long', 'short', 'wide', 'thin', 'thick', 'slender'],
# heads, feet, hands
'end' : ['hammer', 'round', 'big', 'small','flat','smooth'],
# belly and back
'big' : ['armor','plate'],
# eyes, tongue and teeth
'small' : ['round', 'large', 'small', 'big', 'long', 'short']
}
return choose(text_groups[self.texture] + shape_groups[self.shape])
# Functions~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def animal(animal_class):
# Makes animals from an animal class
# I'll move this later on
defadj = ['aboreal', 'agile', 'alpine', 'barn', 'baron', 'bold', 'boreal', 'bowl', 'bronze', 'brook', 'burrowing', 'canyon', 'cave', 'cellar', 'chorus', 'cloud', 'cobweb', 'coffin', 'common', 'crested', 'desert', 'desert', 'domestic', 'dusky', 'dwarf', 'ebony', 'elegant', 'false', 'fire', 'flower', 'garden', 'garden', 'giant', 'goldenrod', 'goliath', 'grass', 'horned', 'house', 'huntsman', 'hybrid', 'imperial', 'ivory', 'king', 'labyrinth', 'lattice', 'marbled', 'marsh', 'midwife', 'mountain', 'orchard', 'ornamental', 'painted', 'pike', 'pool', 'pygmy', 'queen', 'regal', 'river', 'robber', 'rose', 'royal', 'skeleton', 'slender', 'smooth', 'spectal', 'spined', 'spotted', 'spring', 'steppe', 'stream', 'trapdoor', 'tree', 'wandering', 'water', pattern(), color()]
bodypart = choose(animal_class.bodyparts)
return choose([
bodypart.bodmod() + ' ' + addaned(bodypart.name),
choose(defadj),
choose([word('Discov')+ '\'s', land('demonym')])
]) + ' ' + choose(animal_class.names)
def color():
# this makes colors
def ish(color):
if color[-1] == 'e':
return color[:-1] + 'ish'
else:
return color + 'ish'
color = ['orange', 'red', 'crimson', 'purple', 'blue', 'green', 'yellow', 'black', 'white', 'grey', 'brown', 'gold']
return choose([boose(['bright ', 'dark ', 'pale ']) + choose(color), choose(color), ish(choose(color))])
def element():
# makes the name of an element
suffix = ['ite', 'ium', 'alt', 'sten', 'thril', 'yx', 'muth']
return word('met') + choose(suffix)
def normalmetal():
# returns an existing metal from a list
return choose(['iron', 'steel', 'brass', 'bronze', 'silver', 'gold', 'pewter', 'tungsten', 'cast iron', 'pig iron',
'titanium', 'copper', 'lodestone', 'bismuth', 'nickel', 'duralumin', 'billon', 'tombac', 'ormolu',
'electrum', 'hepatizon', 'sterling silver', 'mithril'])
def specificmetal():
# makes the name of a new metal
adjective = ['blood', 'ancient', 'red', 'black', 'white', 'astral', 'meteoric', 'rose', 'crucible',
word('Name') + "'s", 'cursed', 'spectral', 'solar', 'raw']
metal = ['iron', 'steel', 'silver', 'metal', 'brass', 'bronze']
return choose(adjective) + ' ' + choose(metal)
def loredmetal():
# makes metal with lore
# room for improvement
return choose([specificmetal(), normalmetal()]) + ' mined from ' + boose(['beneath ', 'under ']) + mountain()
def alloy():
#makes an alloy of two metals
metal1 = choose([element(), normalmetal(), specificmetal(), loredmetal()])
metal2 = choose([element(), normalmetal(), specificmetal(), loredmetal()])
return 'an alloy of ' + metal1 + ' and ' + metal2
def metal():
#This combines the above functions into one function
return choose([element(), normalmetal(), specificmetal(), loredmetal(), alloy()])
def professional(profession, plurality=None, dobject='none'):
# This makes a worker of a certain profession
if plurality is None:
plurality = choose(['singular','plural'])
basic_synonym = [
[
'gaffer',
'glassmith',
'glassblower'
],
[
'craftsman'
],
[
'smith',
'blacksmith',
'goldsmith',
'pewtersmith',
'coppersmith',
'silversmith',
dobject + 'smith'
],
[
'wizard',
wizardtype()
],
[
'hunter',
dobject + ' hunter'
]
]
if any(profession not in group for group in basic_synonym):
basic_synonym.append([profession])
profession_class = choose(choose([group for group in basic_synonym if profession in group]))
if randint(0,1) == 0:
profession_class = 'master ' + profession_class
name = word(capitalize(profession))
# RIP Akteerg the painter
epithettype = 'maker'
if profession == 'wizard':
epithettype = 'wizard'
singular = choose([
profession_class + ' ' + name,
name + ' the ' + profession_class,
name + ', '+ epithet(epithettype)
])
# TODO add aprenticeships
if plurality == 'singular':
return singular
template = choose([
'the # & of @',
'the & of @',
'the last great & of @',
'the first great & of @',
'# & from @',
'& from @',
'the ' + choose([
'disciples',
'followers',
'apprentices'
]) + ' of ' + singular
])
professional_class = choose([
choose(['dwarf', 'elf', 'man', 'gnome']),
choose(['dwarven', 'elven', 'human', 'gnomish']) + ' ' + profession_class
])
temp = template.replace('#', str(randint(2, 9)))
temp = temp.replace('&', plural(professional_class))
temp = temp.replace('@', capitalize(word('place')))
return temp
def mountain():
# creates the name of a mountain
# TODO: Move this out of the function
adjectives = ['lonely', 'icy', 'misty', 'red', 'golden', 'silver', 'frozen', 'ancient', 'cold', 'windy', 'cloudy',
'north', 'south', 'east', 'west', 'crying', 'burning', 'walking', 'wandering', 'howling', 'windswept',
'white', 'silver', 'sleepy', 'sleeping']
return choose(
['The ' + capitalize(choose(adjectives)) + ' Mountains', 'Mount ' + capitalize(word('mount'))])
def location(feature):
# This makes a natural location
# TODO: Move this out of the function
adjectives = ['lonely', 'icy', 'misty', 'red', 'golden', 'silver', 'frozen', 'ancient', 'cold', 'windy', 'cloudy',
'north', 'south', 'east', 'west', 'crying', 'burning', 'walking', 'wandering', 'howling', 'windswept',
'white', 'silver', 'sleepy', 'sleeping']
return choose(['the ' + capitalize(choose(adjectives)), word('Plaq')]) + ' ' + capitalize(feature)
def forge(dobject='none'):
# room for improvement
# templates = ['Halls of &', 'fires of &', 'flames of &', 'forges of &', 'Hearth of &', 'embers of &', '& caves',
# '& caverns']
# return choose(templates).replace('&', word('Forge', startseed))
return choose([
'the ' + choose([
'forges ',
'forge ',
'hearth '
]) + choose([
# make separate guild function
'of ' + choose([
choose([
professional('blacksmith', 'singular', dobject),
'the ' + professional('blacksmith', 'plural', dobject)
]),
land()
]),
choose([
'under ',
'beneath '
]) + mountain()
])
])
def land(type='country'):
# makes a country or a demonym
root = word('Land')
while root[-1] in list('aeiou') and len(root) > 1:
root = root[:-1]
root += choose(['ia', 'land'])
if type == 'country':
return root
else:
if root[-2:] == 'ia':
return root + 'n'
elif root[-4:] == 'land':
return choose([root + 'ic', root[:-4] + 'ish'])
def cavespawn():
# the cavespawn are a collection of ancient races that inhabit the darkest corners of the earth
# they are generally rather passive and appear in small groups
# they are mute but have elaborate writing systems and social orders
# kings have waged war with them over millennia but they still remain
lingtype = ['eye', 'ear', 'ghost', 'rock', 'bone', 'stone', 'wood', 'husk']
mantype = ['slug', 'snail', 'snake', 'bird', 'moth', 'worm', 'pig', 'wolf', 'bear', 'fish', 'pig', 'husk', 'lava',
'magma', 'rock', 'mail', 'olm', 'frog', 'lizard', 'leopard', 'dog']
return choose([choose(lingtype) + 'ling', choose(mantype) + 'man'])
def wizardtype():
# this makes wizard types
# this is not really a generator because it chooses from a predetermined list and doesn't mix up the parts
# there is room for improvement here
return choose(['wizard', 'sorcerer', 'mage', 'alchemist', 'warlock', choose(['necro', 'pyro', 'litho']) + 'mancer'])
def epithet(dobject, gender='male'):
# gives epithets to various things to add flavour
if gender == 'male':
genpronoun = 'son'
else:
genpronoun = 'daughter'
if dobject == 'beast':
simple_descriptor = choose([
'ghastly',
'undying',
'unspeakable',
'unseen',
'unheard',
'silent',
'ancient',
'relentless',
'hellish',
'hundred-eyed',
'thousand-eyed',
'immortal',
'unholy',
'howling',
'undead',
'festering',
'abominable',
'formidable',
'wretched',
'grusome',
'blind',
'dreadful',
'great'
]) + ' '
dominion = choose([
'orc',
'goblin',
'skeleton',
'skeletal warrior',
'demon',
'man',
'hobgoblin',
'demon',
'cyclops',
'giant',
'troll',
'knight',
'undead',
'ice giant',
'ghost',
cavespawn()
])
epithet_name = choose([
choose([
'reaper',
'eater',
'harvester',
'swallower',
'corrupter',
'defiler',
'reckoner',
'render',
'digester'
]) + ' of ' + choose([
'souls',
'minds',
'flesh',
'bone',
'the damned',
'blood'
]),
'the ' + simple_descriptor + choose([
'mind',
'overmind',
'beast',
'horror',
'terror',
'monster',
'evil',
'abomination',
'seer',
'overseer',
'priest',
'gatekeeper'
]),
choose([
choose([
'keeper',
'king',
'god',
'ruler',
'prince',
'master'
]) + ' of ' + choose([
'worms',
'maggots',
'the dead',
'the undead',
'bones',
'blood',
'souls',
'minds',
'snakes',
'fire',
'darkness',
'gold'
]), 'the ' + boose([
simple_descriptor
]) + choose([
'worm',
'maggot',
'snake',
'soul'
]) + ' ' + choose([
'keeper',
'eater',
'lord',
'god'
]),
choose([
'king',
'god',
'ruler',
'prince',
'master'
]) + ' of the ' + plural(dominion).replace('undeads', 'undead'), # TODO: plural function here
'the ' + boose([
simple_descriptor
]) + dominion + ' ' + choose([
'king',
'god',
'ruler',
'prince',
'master'
])
])
]).replace(' ', ' ')
elif dobject == 'hero':
# room for improvement
epithet_name = choose([
'the ' + choose([
'brave', 'strong', 'great', 'stoic', 'elder', 'younger', 'tall', 'short', 'powerful', 'adored', 'ox',
'boar', 'bull', 'mountain', 'rock', 'stoic', 'wise', 'peaceful', 'calm', 'fast', 'bear', 'wolf',
'fox','lion', 'thirsty', 'hungry', 'tired', 'gentle', 'giant', 'last', 'holy', 'divine', 'fearless',
'steadfast','enlightened', 'exalted'
]),
choose([
'lion', 'bear', 'wolf', 'kind', 'soft'
]) + '-hearted',genpronoun + ' of ' + word('Father'),
choose([
'ogre', 'undead', 'ghast', 'skeleton', 'serpent', cavespawn(), 'demon', 'bear', 'beast', 'lion',
'wyvern', 'goblin', 'orc', 'man', 'troll', 'giant', 'hobgoblin', 'lindworm', 'knight', 'worm',
'frost giant', 'dragon', 'cyclops', 'skeletal warrior', 'wolf', 'minotaur', choose(['the ', '']) +
dragon()
]) + ' ' + choose(['slayer', 'killer']),
'bane of '+plural(choose([
'ogre', 'undead', 'ghast', 'skeleton', 'serpent', cavespawn(), 'demon', 'bear', 'beast', 'lion', 'wyvern', 'goblin', 'orc', 'man', 'troll', 'giant', 'hobgoblin', 'lindworm', 'knight', 'worm', 'frost giant', 'dragon', 'cyclops', 'skeletal warrior', 'wolf', 'minotaur', 'arthropod'
]))
])
elif dobject == 'noble':
# room for improvement
romannumeral = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'X']
epithet_name = choose([', the ' + choose(
['fair', 'kind', 'noble', 'just', 'wise', 'great', 'cruel', 'terrible', 'horrible', 'rotten', 'foolish']),
', ' + genpronoun + ' of ' + land(), ' ' + choose(romannumeral)])
elif dobject == 'maker':
# room for improvement
epithet_name = choose(['the steady handed', 'the steady of hand', 'the craftsman', 'the fireproof',
'the iron ' + choose(['thumbed', 'fingered', 'skinned']), 'the careful',
'the sharp-eyed', 'fire bellied', 'the bloodless', 'the dirty', 'the soot covered'])
elif dobject == 'game':
# this generates epithets for use in the legendry_game function
# room for improvement
epithet_name = ' of ' + location(choose(['valley', 'plain', 'forest', 'woods', 'mountain']))
elif dobject == 'wizard':
# room for improvement
epithet_name = choose([' the ' + color(), ' the ' + wizardtype() + ' of ' + location(choose(
['valley', 'mountains', 'hills', 'caves', 'caverns', 'plains', 'plateau', 'island', 'desert', 'lake',
'swamp', 'forest', 'canyon', 'ravine', 'chasm', 'hollow']))])
else:
# in case I made a mistake
epithet_name = 'the forsaken'
return epithet_name
def legendary_game():
# creates the name of a legendary game animal
coloration = choose(['white', 'silver', 'black', 'golden'])
genus = choose(['elk', 'stag', 'ram', 'bison'])
return 'the ' + boose(['great ']) + coloration + ' ' + genus + ' ' + epithet('game')
def dragon():
# this makes the name for a type of dragon
# Not a specific dragon
# there is plenty room for improvement here
return choose(
['lind', 'grind', 'lode', 'blood', 'flesh', 'gore', 'grist', 'grit', 'stench', 'fester', 'bone', 'old', 'book',
'stone', 'husk']) + choose(['worm', 'wurm', 'wyrm'])
def worm():
# creates the name of a worm
classification = choose(
['blood', 'book', 'bone', 'flesh', 'mind', 'earth', 'stone', 'night', 'fire', 'lung', 'gut', 'mud', 'moss',
'wood', 'sludge', 'husk', 'book'])
basis = choose(['worm', 'maggot', 'crawler'])
return choose(['giant ', '']) + classification + basis
def beast():
# creates the name of an evil beast or creature
class_type = choose(
['dragon', 'minotaur', 'cyclops', 'ogre', 'ghast', 'beast', 'serpent', 'wolf', 'lion', 'bear', 'wyvern', 'worm',
'lindworm', 'frost giant', dragon()])
# TODO this was copy pasted from line 395, move outside functions
origin = location(choose(
['valley', 'mountains', 'hills', 'caves', 'caverns', 'plains', 'plateau', 'island', 'desert', 'lake', 'swamp',
'forest', 'canyon', 'ravine', 'chasm', 'hollow']))
name = capitalize(word('beast'))
Epithet = epithet('beast')
return choose([choose(['', name + ', ']) + 'the ' + class_type + ' of ' + origin, name + ', ' + Epithet])
def horde():
return choose([
'a horde of', 'an army of', choose([
'one thousand', 'ten thousand', 'five hundred', 'one hundred', 'fifty', 'forty', 'thirty'
])
]) + ' ' + boose([
'angry', 'unholy', 'demonic', 'ravenous', 'ghastly'
]) + ' ' + plural(choose([
'ogre', 'undead', 'ghast', 'skeleton', 'serpent', cavespawn(), 'demon', 'bear', 'beast', 'lion', 'wyvern',
'goblin', 'orc', 'man', 'troll', 'giant', 'hobgoblin', 'lindworm', 'knight', 'worm', 'frost giant', 'dragon',
'cyclops', 'skeletal warrior', 'wolf', 'minotaur'
]))
def hero():
# creates the name and title of a mythical hero
name = word('Hero')
epithet_name = epithet('hero')
return name + ', ' + epithet_name
def royalty():
# creates the name and title of a royal
name = word('King')
title = choose(
['King', 'Queen', 'Duke', 'Duchess', 'Grand Duke', 'Archduke', 'Lord', 'Lady', 'Prince', 'Princess', 'Marquess',
'Earl', 'Count', 'Countess', 'Baron', 'Baroness', 'Viscount', 'Viscountess']).lower()
if title in ['queen', 'duchess', 'lady', 'princess', 'countess', 'baroness', 'viscountess']:
gender = 'female'
else:
gender = 'male'
epithet_name = epithet('noble', gender)
return choose([capitalize(title) + ' ' + name + epithet_name, 'the ' + title + ' of ' + land()])
def spirit():
# please comment this
class_type = choose(['nymph', 'spirit', 'lady'])
origin = location(choose(['lake', 'pond', 'forest']))
return 'the ' + class_type + ' of ' + origin
def coral():
# makes coral
affix = ['fire', 'cloak', 'cactus', 'brain', 'ghost', 'cloud', 'rock', 'stone', color() + ' crust',
choose(['elk', 'bison', 'bull', 'deer', 'moose', 'stag']) + 'horn', land('demonym')]
return choose(affix) + ' coral'
def bone():
# makes bone
bsource = choose(['goblin', 'orc', 'human', 'dwarf', 'giant', 'troll', 'fish', 'deer', 'cow', cavespawn()])
classification = choose(['rib', 'bone', 'tooth', 'spine', 'jaw'])
lbsource = choose([beast()])
return choose([bsource + ' ' + classification, 'the ' + classification + ' of ' + lbsource + ','])
def wood():
# makes wood
wsource = choose(
['oak', 'spruce', 'cedar', 'birch', 'pine', 'fir', 'hemlock', 'ash', 'chestnut', 'beech', 'elm', 'mahogany',
'hickory', 'maple', 'stone'])
return wsource + ' wood'
def ivory():
# makes ivory
i_source = boose(['mammoth', 'walrus', 'whale', land('demonym')])
return i_source + ' ivory'
def biomaterial(size='small'):
# makes biological materials
# bone:
bsource = bone()
# wood:
wsource = wood()
# ivory:
isource = ivory()
# coral:
csource = coral()
if size == 'small':
return choose([bsource, wsource, isource, csource])
else:
return choose([wsource, isource, csource])
def strange_biomaterial():
# makes strange or unconventional biological materials
# there is room for improvement here
# crustacean based
reflist = {'': 954, 'blue ': 50, 'yellow ': 5, 'white ': 1}
coloration = woose(reflist)
crust = coloration + choose(['crab', 'lobster']) + ' ' + choose(['shell', 'chitin'])
# I can't think of anymore right now I'll add some later
return choose([crust])
def material(size='small'):
# makes materials
# mainly used for sword blades and hilts
biomat = biomaterial(size)
strangemat = strange_biomaterial()
inertmat = choose(['petrified', 'calcified', 'fossilized']) + ' ' + biomat
return choose([biomat, inertmat, strangemat])
def script():
# creates the name for a form of writing or alphabet
preprefix = choose([land('demonym') + ' ', choose(
['proto-', 'elvish ', 'goblin ', 'dwarven ', 'gnomish', 'demonic', cavespawn() + ' ', 'rudimentary ', 'ancient '])])
prefix = choose(['rune', 'glyph', 'old', 'stone', 'bone', 'dark', 'death', 'cipher ', 'cryptic ', 'sand'])
suffix = choose(['script', 'rune', 'glyph', 'scratch', 'form'])
if prefix == suffix:
prefix = choose(['old', 'stone', 'bone', 'dark', 'death', 'cipher ', 'cryptic '])
if prefix == 'cryptic ':
return prefix + boose([preprefix]) + suffix
return choose([preprefix, '']) + prefix + suffix
def council():
# creates the name of a council
variety = ['council', 'aldermen', 'senate', 'congress']
place_of_origin = land()
return 'the' + boose([' high', ' grand']) + ' ' + choose(variety) + ' of ' + place_of_origin
def age():
# creates the name of an age or era
var = choose(['age', 'era'])
time = choose([
choose([
'golden',
'silver',
'dark',
'bronze',
'brass',
'stone',
'ancient',
'ice',
choose([
'dwarven',
'elven',
'goblin',
'woadic'
])
]) + ' ' + var,
var + ' of ' + choose([
'fire',
'iron',
'steel',
'kings',
'lords',
'gods',
'darkness',
'the shadows',
'blood',
'filth',
'the ancients',
'monsters',
'conquest',
'empires',
'beasts',
'birds',
'magic',
'wizards',
'war',
'sand',
word('Ruler'),
plural(choose([
'orc',
'woad',
'goblin',
'troll',
'giant',
'cyclops',
'man',
'elf',
'dwarf',
'demon',
cavespawn()
]))
]),
choose([
'early',
'mid',
'late'
]) + ' ' + choose([ #TODO make this a function
'1st',
'2nd',
'3rd',
'4th',
'5th',
'6th',
'7th',
'8th',
'9th',
'10th',
'11th',
'12th',
'13th',
'14th',
'15th',
'16th'
]) + ' century'
])
return time.title()
def moonphase():
# a generator for special phases of the moon
# It does't really create new phases just picks from a list of existing ones
phase = choose(['full', 'new', 'blood', 'blue', 'harvest', 'hunter\'s' + ' moon'])
return phase
def moss():
# A generator for types of mosses
# https://en.wikipedia.org/wiki/List_of_the_mosses_of_Britain_and_Ireland
attribute = choose(
['soft', 'long', 'wide', 'smooth', 'fine', 'bent', 'thin', 'short', 'tiny', 'slender', 'round', 'many', 'thick',
color()]) + '-' + choose(['tufted', 'leafed', 'capped', 'stalked', 'fruited', 'tipped', 'capped'])
primary_adjective = [choose(
['calcareous', 'flagellate', 'bimous', 'sessile', 'glaucous', 'alpine', 'silvergreen', 'western', 'northern',
'eastern', 'southern', 'swamp', 'creeping', 'crawling', 'icy', 'pendulous', 'dark', 'bright', 'hanging',
'slender', 'arctic', 'spreading', 'bog', 'rusty', 'velvet', 'robust', 'ambiguous', 'bordered', 'spinose',
'mountain', 'sand', 'river', 'wall', 'pale', 'saltmarsh', 'twisting', 'cernuous', 'giant', 'fountain',
'smaller', 'tendril', 'compact', 'silky', 'field', 'common', 'dusky', 'spiral', 'ribbed', 'fringed', 'fuzzy',
'chalk', 'felted', 'shady', 'cordate', 'blunt', 'pretty', 'clustered', 'thin', 'hooded', 'starry', 'whorled',
'elegant', 'striated', 'fatfoot', 'tiny', 'curled', 'petty', 'dappled', 'dingy', 'polar', 'soft', 'snow',
'sparkling', 'feathery', 'snowy', 'woolly', 'bristly', 'tall']), word('Lord') + '\'s',
color(), land('demonym'), attribute]
secondary_adjective = ['pygmy', 'dwarf', 'hump', 'feather', 'yoke', 'fork', 'wood', 'beard', 'beardless', 'rock',
'thread', 'silver', 'earth', 'carrion', 'groove', 'apple', 'shield', 'spear', 'bow',
'rabbit', 'lattice', 'tree', 'helmet', 'hook', 'comb', 'cave', 'forklet', 'nut', 'flag',
'fox', 'extinguisher', 'cord', 'pocket', 'water', 'tufa', 'hoar', 'screw', 'brook', 'plait',
'silk', 'thatch', 'copper', 'thyme', 'flood', 'spur', 'bristle', 'fen', 'crisp', 'scorpion',
'fringe', 'streak', 'rose', 'ghost', 'turf', 'shaggy', 'dew', 'bark', 'club', 'ganite',
'umbrella', 'dung']
variety = woose({'moss': 8, 'peatmoss': 1, 'smoothcap': 1, 'bryum': 1, 'ditrichum': 1, 'grimmia': 1, 'pottia': 1,
'pincusion': 1, 'redshank': 1, 'quillwort': 1})
moss_name = (boose(primary_adjective) + ' ' + variety).replace(' moss', ' ' + boose(secondary_adjective) + '-moss')
moss_name = moss_name.replace(' -', ' ')
if not (not (moss_name[0] == ' ') or '-' in list(moss_name)): # DeMorgan's law
moss_name = choose(primary_adjective) + moss_name
elif moss_name[0] == ' ':
moss_name = moss_name[1:]
return moss_name
def pattern():
# This makes body patterns for animals (and maybe other things
# this is a pretty good function further implementation could benefit the program
modifier = ['long', 'short', 'wide', 'thin', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight']
base = ['band', 'spot', 'stripe']
return choose([choose(modifier), color()]) + ' ' + choose(base)
def spider():
# makes spiders
# https://en.wikipedia.org/wiki/List_of_spider_common_names
def weaver():
shape = ['orb', 'hammock', 'tent', 'dome', 'rob', 'net', 'tower', 'maze', 'labyrinth']
return choose(shape) + 'weaver'
# TODO Do something with the variables below
bodymodifier = ['long', 'feather', 'star', 'greater', 'tuft', 'fire', 'straight', 'flame', 'stripe', 'curved',
'hammer', 'thick', 'thin', 'slender', 'round']
bodypart = ['horned', 'legged', 'headed', 'bellied', 'kneed', 'toed', 'footed', 'jawed', 'backed', 'mouth',
'shouldered']
subvar = choose(
['cloud', 'crab', 'garden', 'cave', 'ornamental', 'house', 'wolf', 'bat', 'spotted', 'zebra', 'barn', 'baboon',
'canyon', 'marbled', 'lynx', 'cellar', 'cobweb', 'giant', 'rose', 'common', 'mahogany', 'slender', 'false',
'bowl', 'huntsman', 'desert', 'goliath', 'skeleton', 'domestic', 'baron', 'king', 'lattice', 'leafflitter',
'goldenrod', 'dewdrop', 'sand', 'bottle', 'diving', 'flower', 'humpbacked', 'ivory', 'borrowing', 'bold',
'water', 'bronze', 'spined', 'wall', 'ebony', 'trapdoor', 'ghost', 'pike', 'labyrinth', 'robber', 'coffin',
'grass', 'elegant', 'orchard'])
var = ['orbweaver', 'tarantula', 'meshweaver', 'jumper', 'birdeater', 'widow', weaver()]
subvar = choose([subvar, pattern()])
tempor = choose(['$', '%', '&', '$ %', '$ &', '% &', '$ % &']) + ' ' + choose([choose(var), 'spider'])
return tempor.replace('$', color()).replace('%', land('demonym')).replace('&', subvar)
def normalgem():
# A generator for real gemstones
# https://www.wikiwand.com/en/List_of_gemstone_species
# http://www.gemselect.com/other-info/gemstone-list.php
gem = ['alexandrite', 'andalusite', 'axinite', 'benitoite', 'beryl', 'aquamarine', 'bixbite', 'emerald',
'morganite', 'blood stone', 'cassiterite', 'celestite', 'chrysoberyl', "cat's eye", 'chrysocolla',
'clinohumite', 'cordierite', 'corundum', 'ruby', 'saphire', 'danburite', 'diamond', 'diopside', 'dioptase',
'dumortierite', 'feldspar', 'amazonite', 'labradorite', 'moonstone', 'sunstone', 'fluorite', 'garnet',
'hessonite', 'hambergite', 'hematitejade', 'jadeite', 'nephrite', 'jasper', 'kornerupine', 'kunzite',
'malachite', 'peridot', 'prehnite', 'pyrite', 'quartz', 'amethystcitrine', 'smokey quartz', "tiger's-eye",
'chalcedony', 'agate', 'aventurine', 'onyx', 'rhodochrosite', 'serandite', 'spinel', 'sugilite', 'topaz',
'turquoise', 'tourmaline', 'variscite', 'vesuviante', 'xenotime', 'zeolite', 'thomsonite', 'zircon',
'zoisite', 'tanzanite', 'thulite', 'amber', 'ammolite', 'copal', 'coral', 'pearl', 'lapis-lazuliobsidian',
'maw-sit-sit', 'unakite', 'ametrine', 'apatite', 'carnelian', 'diaspore', 'scapolite', 'opal', 'calcite',
'charoite', 'chrysoprase', 'clinohumite', 'enstatite', 'gaspeite', 'goshenite', 'hackmanite',
'hemimorphite','hiddenite', 'howlite', 'idocrase', 'iolite', 'kunzite', 'kyanite', 'larimar',
'lepidolite', 'melanite', 'andradite', 'moldavite', 'tektite', 'chrysolite', 'morganite', 'nuummite',
'orthoclase', 'pietersite', 'rhodonite', 'scapolite', 'serphinite', 'clinochlores', 'serpentine',
'smithsonite', 'sodalite', 'sphalerite', 'sphene', 'tanzanite', 'verdite']
return choose(gem)
def specificgem():
# This makes a gem that may or may not exist
adjective = ['mystic', 'cat\'s eye', 'andesine', 'color-change', 'dendritic', 'fire', 'star', 'pyrope', 'rainbow',
'rutile', 'rose', 'tashmarine', 'chrome', color()]
return choose(adjective) + ' ' + normalgem()
def gem():
# makes gems from the above functions
return choose([normalgem(), specificgem(), element()])
def normalglass():
# a generator for real types of glasses
# https://en.wikipedia.org/wiki/Category:Glass_types
# http://www.cmog.org/article/types-glass
# https://en.wikipedia.org/wiki/Category:Glass_compositions
glass = ['glass', 'beveled glass', 'plate glass', 'carnival glass', 'crown glass', 'depression glass',
'favrile glass', 'flat glass', 'float glass', 'vitrum flextile', 'flexible glass', 'frosted glass',
'fumed silica', 'pyrogenic silica', 'fused quartz', 'glass of antimony', 'goofus glass', 'ground glass',
'moss agate glass', 'rippled glass', 'sitall', 'starfire glass', 'tiffany glass', 'toughened glass',
'reinforced glass', 'tempered glass', 'photochromic glass', 'soda-lime glass', 'lead glass',
'cobalt glass', 'cranberry glass', 'dichroic glass', 'flint glass', 'jadeite', 'leaded glass',
'milk glass', 'opaline glass', 'reagent bottle', 'uranium glass', color() + ' glass',
color() + ' plate glass']
return choose(glass)
def specificglass():
# makes the name of a non-real type of glass
# room for improvement
return color() + ' glass'
def glass():
# makes glass from the above functions
return choose([normalglass(),specificglass()])
def dog():
# makes the name for a type of dog
adjective = ['alpine', 'great', 'king', 'lowland', 'highland', color()]
prey = ['fox', 'rabbit', 'sheep', 'deer', 'wolf', 'seal']
base = ['hound', 'shepherd', 'malamute', 'akita', 'mountain dog', 'bloodhound', 'setter', 'greyhound', 'sleddog',
'mastiff', choose(prey) + choose(['hound', 'dog'])]
return choose(adjective) + ' ' + choose(base)
def book():
# makes the title for a fictional book
# room for improvement
def epic():
# TODO Improve this, use people sometime
people = ['bard', 'king', 'knight', 'jester', 'man']
title = choose(['the tale of ' + word('Epic'), 'the fall of ' + word('Epic'),
'the epic of ' + word('Epic'), 'the myth of ' + word('Epic'),
word('Epic')])
return title
def contemporary():
first_person = ['The Old Man', 'A Man', 'The King', 'The Prince']
second_person = ['the Sea', 'His Dog', 'The Moon']
return choose(first_person) + ' and ' + choose(second_person)
return choose([epic(), contemporary()])
def academicbook():
# makes a non-fiction book title
academic = ['Physicist', 'Mathematician', 'Chemist', 'Alchemist', 'Scientist', 'Herpetologist', 'Herbologist',
'Entomologist', 'Philosopher', 'Logician', 'Economist', 'Engineer', 'Botanist', 'Zoologist',
'Pharmacologist', 'Geologist', 'Astronomer', 'Psychologist']
field = ['Physics', 'Mathematics', 'Chemistry', 'Alchemy', 'Science', 'Herpetology', 'Herbology', 'Entomology',
'Philosophy', 'Logic', 'Economics', 'Engineering', 'Botany', 'Zoology', 'Pharmacology', 'Geology',
'Astronomy', 'Psychology']
fieldadjective = ['Physical', 'Mathematical', 'Chemi cal', 'Alchemical', 'Scientific', 'Herpetologic', 'Herbologic',
'Entomological', 'Philosophic', 'Logical', 'Economic', 'Engineering', 'Botanical', 'Zoologic',
'Pharmacological', 'Geologic', 'Astronomic', 'Psychological']
# TODO use these some day
place = ['Plains', 'Savanna', 'Arctic', 'Tropics']
organism = ['Insects', 'Plants', 'Fungi', 'Birds', 'Fish', 'Reptiles', 'Mammals', 'Amphibians', 'Arachnids',
'Beetles']
title = ['Principles of ' + choose(field), precep(choose(academic)) + '\'s ' + choose(['Handbook', 'Guidebook']),
'A Guide to ' + choose(fieldadjective) + ' Principles', 'Mastering ' + choose(field),
'A ' + boose(['Brief ', 'Comprehensive ']) + 'History of ' + choose(field)]
return choose(title)
def enscript():
# Eamon's function
return '\t' + choose(['All that is gold does not glitter', 'Not all those who wander are lost',
'The old that is strong does not wither', 'Deep roots are not reached by the frost',
'From the ashes a fire shall be woken', 'A light from the shadows shall spring',
'Renewed shall be blade that was broken', 'The crownless again shall be king',
'All that is gold does not glitter,\nNot all those who wander are lost;\n'
'Deep roots are not reached by the frost.\nFrom the ashes a fire shall be woken,\n'
'A light from the shadows shall spring;\nRenewed shall be blade that was broken,\n'
'The crownless again shall be king',
'Three Rings for the Elven-kings under the sky,\n'
'Seven for the Dwarf-lords in their halls of stone,\nNine for Mortal Men doomed to die,\n'
'One for the Dark Lord on his dark throne\nIn the Land of Mordor where the Shadows lie.\n'
'One Ring to rule them all, One Ring to find them,\n'
'One Ring to bring them all and in the darkness bind them\n'
'In the Land of Mordor where the Shadows lie.',
'One Ring to rule them all, One Ring to find them,\n'
'One Ring to bring them all and in the darkness bind them',
'Do not go gently into that good night', 'Where is your god now', 'I hurt people']).replace(
'\n', '\n\t') + '\n'
def war():
state = random.getstate()
participant1 = land('demonym')
random.setstate(state)
participant1l = land()
participant2 = participant1
participant2l = participant1l
while participant1 == participant2:
state = random.getstate()
participant1 = land('demonym')
random.setstate(state)
participant1l = land()
return 'the ' + choose([
boose(['first', 'second', 'third']) + ' ' + participant1 + '-' + participant2 + ' war',
participant1 + ' civil war',
participant1 + choose([' invasion', ' conquest']) + ' of ' + participant2l
])
def amphibian(genus=None):
# makes amphibians
# https://en.wikipedia.org/wiki/List_of_amphibians_of_Europe
# http://www.californiaherps.com/allsalamanders.
# http://www.californiaherps.com/allfrogs.html
if genus is None:
genus = choose(['frog', 'salamander', 'toad', 'newt', 'spadefoot', 'bullfrog', 'eft', 'olm', 'axolotl',
'treefrog'])
bodymodifier = ['long', 'feather', 'star', 'greater', 'fire', 'straight', 'flame', 'stripe', 'curved', 'hammer',
'thick', 'thin', 'slender', 'round']
bodypart = ['legged', 'headed', 'bellied', 'kneed', 'toed', 'footed', 'backed', 'mouth', 'shouldered']
subvar = choose(
['cloud', 'common', 'water', 'crested', 'painted', 'tree', 'widwife', 'brook', 'alpine', 'stream', 'agile',
'fire', 'marbled', 'pool', 'hybrid', 'imperial', 'wood', 'smooth', 'ribbed', 'marsh', 'regal', 'royal',
'tiger', 'cloud', 'aboreal', 'wandering', 'mountain', 'garden', 'alpine', 'desert', 'river', 'brook', 'spring',
'dusky', 'pygmy', 'giant', 'slimy', 'boreal', 'spectal', 'king', 'queen', 'leopard', 'chorus', 'clawed'])
genera = ['frog', 'salamander', 'toad', 'newt', 'spadefoot', 'bullfrog', 'eft', 'olm', 'axolotl', 'treefrog']
subvar = choose([subvar, pattern()])
tempor = choose(['$', '%', '&', '$ %', '$ &', '% &', '$ % &']) + ' ' + genus
return tempor.replace('$', color()).replace('%', land('demonym')).replace('&', subvar)
def carving(epithets=True):
prey = choose(['fox', 'bear', 'moose', 'deer', 'stag', 'rabbit'])
royal = royalty()
if not epithets:
royal = royal.split(',')[0]
picture = choose([
boose([hero() + ' leading troops in ']) + battle(),
hero() + ', ' + choose([
'fighting',
'slaying',
'defeating',
'vanquishing'
]) + ' ' + choose([
beast(),
horde()
]),
choose([
'hunters',
'huntsmen',
'hounds',
'dogs',
plural(dog()),
'a ' + dog(),
professional('hunter', prey)
]) + ' ' + choose([
'hunting',
'chasing'
]) + ' ' + choose([
'a ' + boose([
'wild '
]) + prey,
plural(prey),
legendary_game()
]),
'a scene from ' + book(),
royal + '\'s ' + dog() + ' ' + word('Dog')
])
return 'a depiction of ' + picture
def stringthing():
# makes literal strings.
# like for bows and such.
mamsource = ['elk', 'deer', 'bison', 'moose', 'pig', 'cow']
return choose([choose(mamsource) + ' ' + choose(['sinew']), spider() + ' silk'])
def wool():
# This makes types of wool
# Possibly room for improvement
return (boose(['sheep', 'alpaca', 'llama', 'churro']) + ' ' + choose(['wool', 'cashmere'])).strip(' ')