A character/one-shot generator for KOBOLDS IN SPACE!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

koboldgen.py 6.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. import random as r
  2. import sys
  3. beg = ["a","e","i","o","u","ba","be","bi","bo","bu","by","y","da","de","di","do","du","dy","fa","fi","fo","fe","fu","ga","ge","gi","go","gu","ka","ke","ki","ko","ku","ky","ma","me","mi","mo","mu","na","ne","ni","no","nu","pa","pe","pi","po","pu","ra","re","ri","ro","ru","ry","sa","se","si","so","su","ta","te","ti","to","tu","ty","wa","we","wi","wo","wy","za","ze","zi","zo","zu","zy"]
  4. mid = beg + ["l","x","n","r"]
  5. def gen_name(n=None):
  6. if n == None:
  7. lgt = r.randint(3,9)
  8. else:
  9. lgt = n
  10. morae = []
  11. while len("".join(morae)) < lgt:
  12. if len(morae) == 0:
  13. mora = r.choice(beg)
  14. morae.append(mora[0].upper() + mora[1:])
  15. else:
  16. mora = r.choice(mid)
  17. if morae[-1] == mora:
  18. mora = r.choice(mid)
  19. morae.append(mora)
  20. return "".join(morae)
  21. def gen_stats(n):
  22. if n < 4:
  23. print("Too few stat points!")
  24. return [0,0,0,0]
  25. stats = [1,1,1,1]
  26. points = n - 4
  27. slots = [0,1,2,3]
  28. for _ in range(points):
  29. tgl = False
  30. while tgl == False:
  31. slt = r.choice(slots)
  32. if stats[slt] == 6:
  33. continue
  34. if stats[slt] == 5:
  35. if r.randint(0,1) == 1:
  36. continue
  37. stats[slt] += 1
  38. tgl = True
  39. return stats
  40. def gen_career():
  41. return r.choice(["Soldier/Guard","Pilot","Medic","Mechanic","Politician","Spellcaster","Performer","Historian","Spy","Cook","Cartographer"])
  42. def gen_plot():
  43. loc1 = ["a friendly","a hostile","a derelict","an airless","a poison-filled/covered","an overgrown","a looted","a burning","a frozen","a haunted","an infested"]
  44. loc2 = ["asteroid","moon","space station","spaceship","ringworld","Dyson sphere","planet","Space Whale","pocket of folded space","time vortex","Reroll"]
  45. miss = ["to explore!","to loot everything not bolted down too securely","to find the last group of kobolds who came here","to find a rumored secret weapon","to find a way to break someone else’s secret weapon","to claim this place in the name of the Kobold Empire!","to make friends!","to rediscover lost technology","to find lost magical items","to find and defeat a powerful enemy","Reroll"]
  46. prob = ["an army of undead","a rival band of kobolds","a detachment from the Elf Armada","refugees with parasites. Big parasites","an artificial intelligence bent on multi-world domination","robot spiders","semi-intelligent metal eating slime","a living asteroid that intends to follow the kobolds home like the largest puppy","an old lich that wants everyone to stay off of their “lawn”","elder gods hailing from the dark spaces between the stars","Reroll"]
  47. cl1 = r.choice(loc1)
  48. cl2 = r.choice(loc2)
  49. cm = r.choice(miss)
  50. cp = r.choice(prob)
  51. if cl2 == "Reroll":
  52. cl2p = r.choice(loc2[:-1])
  53. if cl2p == "Asteroid":
  54. cl2 = "battlefield on an asteroid"
  55. else:
  56. cl2 = "battlefield on a " + cl2p
  57. if cm == "Reroll":
  58. cm = "to ...well, the kobolds weren't paying attention, so don't tell them, but they're supposed to " + r.choice(miss[:-1])
  59. if cp == "Reroll":
  60. cp = "a Floating Brain Monster and its minion, " + r.choice(prob[:-1])
  61. return [cl1, cl2, cm, cp]
  62. def gen_transpo():
  63. name1 = ["Red","Orange","Yellow","Green","Blue","Violet","Dark","Light","Frenzied","Maniacal","Ancient"]
  64. name2 = ["Moon","Comet","Star","Saber","World-Eater","Dancer","Looter","Phlogiston","Fireball","Mecha","Raptor"]
  65. prop1 = ["is stealthy & unarmored","is speedy & unarmored","is maneuverable & unarmored","is always repairable","is self-repairing","is flamboyant & speedy","is slow & armored","is flamboyant & armored","is hard to maneuver & armored","has Too Many Weapons!","has a prototype hyperdrive"]
  66. prop2 = ["has an annoying AI","has inconveniently crossed circuits","has an unpredictable power source","drifts to the right","is haunted","was recently 'found' so the kobolds are unused to it","is too cold","has a constant odd smell","its interior design... changes","its water pressure shifts between slow drip and power wash","it leaves a visible smoke trail"]
  67. return [r.choice(name1), r.choice(name2), r.choice(prop1), r.choice(prop2)]
  68. class Character:
  69. def __init__(self):
  70. self.name = ""
  71. self.career = ""
  72. self.stats = []
  73. def generate(self):
  74. self.gen_name()
  75. self.gen_stats()
  76. self.gen_career()
  77. def gen_name(self):
  78. self.name = gen_name()
  79. def gen_stats(self):
  80. self.stats = gen_stats(12)
  81. def gen_career(self):
  82. self.career = gen_career()
  83. def print(self):
  84. print(f"Name: {self.name} (Kobold {self.career})")
  85. print(f"Order: {self.stats[0]}")
  86. print(f"Chaos: {self.stats[1]}")
  87. print(f"Brain: {self.stats[2]}")
  88. print(f"Body: {self.stats[3]}")
  89. if __name__ == "__main__":
  90. args = sys.argv[1:]
  91. if "--campaign" in args or "-c" in args:
  92. cs = []
  93. for _ in range(6):
  94. c = Character()
  95. c.generate()
  96. cs.append(c)
  97. parameters = gen_plot()
  98. ship = gen_transpo()
  99. art = "an" if parameters[1] == "Asteroid" else "a"
  100. print(f"The Kobolds of the {ship[0]} {ship[1]}")
  101. print(f"have been sent out to {art} {parameters[0]} {parameters[1]}")
  102. print(f"in order {parameters[2]}")
  103. print(f"but they're challenged by {parameters[3]}!")
  104. print()
  105. print(f"The {ship[0]} {ship[1]} {ship[2]}, but {ship[3]}.")
  106. print()
  107. print("The kobolds:")
  108. for k in cs:
  109. k.print()
  110. else:
  111. if len(args) == 0:
  112. c = Character()
  113. c.generate()
  114. c.print()
  115. else:
  116. try:
  117. num = int(args[0])
  118. for _ in range(num):
  119. c = Character()
  120. c.generate()
  121. c.print()
  122. except:
  123. print(f"Invalid arguments: {', '.join(args)}")
  124. c = Character()
  125. c.generate()
  126. c.print()