A character/one-shot generator for KOBOLDS IN SPACE!
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
4 лет назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. import random as r
  2. import argparse
  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(length=None, minimum=None, maximum=None):
  6. if length == None:
  7. minimum = 3 if minimum == None else minimum
  8. maximum = 9 if maximum == None else maximum
  9. lgt = r.randint(minimum,maximum)
  10. else:
  11. lgt = length
  12. morae = []
  13. while len("".join(morae)) < lgt:
  14. if len(morae) == 0:
  15. mora = r.choice(beg)
  16. morae.append(mora[0].upper() + mora[1:])
  17. else:
  18. mora = r.choice(mid)
  19. if morae[-1] == mora:
  20. mora = r.choice(mid)
  21. morae.append(mora)
  22. return "".join(morae)
  23. class Plot:
  24. loc1 = ["friendly","hostile","derelict","airless","poison-filled/covered","overgrown","looted","burning","frozen","haunted","infested"]
  25. loc2 = ["asteroid","moon","space station","spaceship","ringworld","Dyson sphere","planet","Space Whale","pocket of folded space","time vortex","Reroll"]
  26. 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"]
  27. prob = [
  28. {
  29. "id": 0,
  30. "name": "an Undead Sample Pack (swarm of zombies and skeletons)",
  31. "shortname": "undead",
  32. "stats": [0,5,2,6],
  33. },
  34. {
  35. "id": 1,
  36. "name": "a rival band of kobolds",
  37. "shortname": "kobolds",
  38. "stats": [3,3,4,4],
  39. },
  40. {
  41. "id": 2,
  42. "name": "a detachment from the Elf Armada",
  43. "shortname": "elves",
  44. "stats": [4,3,5,4],
  45. },
  46. {
  47. "id": 3,
  48. "name": "refugees with parasites. Big parasites",
  49. "shortname": "refugees",
  50. "stats": [2,4,0,0],
  51. },
  52. {
  53. "id": 4,
  54. "name": "an artificial intelligence bent on multi-world domination",
  55. "shortname": "AI",
  56. "stats": [4,1,6,3],
  57. },
  58. {
  59. "id": 5,
  60. "name": "robot spiders",
  61. "shortname": "spiders",
  62. "stats": [3,3,2,4],
  63. },
  64. {
  65. "id": 6,
  66. "name": "semi-intelligent metal eating slime",
  67. "shortname": "slime",
  68. "stats": [0,2,1,5],
  69. },
  70. {
  71. "id": 7,
  72. "name": "a living asteroid that intends to follow the kobolds home like the largest puppy",
  73. "shortname": "asteroid",
  74. "stats": [2,3,1,6],
  75. },
  76. {
  77. "id": 8,
  78. "name": "an old lich that wants everyone to stay off of their 'lawn'",
  79. "shortname": "lich",
  80. "stats": [5,2,6,3],
  81. },
  82. {
  83. "id": 9,
  84. "name": "elder gods hailing from the dark spaces between the stars",
  85. "shortname": "gods",
  86. "stats": [6,6,6,6],
  87. },
  88. {
  89. "id": 10,
  90. "name": "a Flying Brain Monster",
  91. "shortname": "Flying Brain Monster",
  92. "stats": [2,3,6,1],
  93. },
  94. ]
  95. def __init__(self):
  96. self.loc_desc = Plot.loc1[r.randint(0, len(Plot.loc1)-1)]
  97. self.locIndex = r.randint(0, len(Plot.loc2)-1)
  98. if self.locIndex == len(Plot.loc2) - 1:
  99. self.location = "battlefield on "
  100. self.locIndex = r.randint(0, len(Plot.loc2)-2)
  101. self.mainLocation = Plot.loc2[self.locIndex]
  102. if self.mainLocation[0].lower() in ["a","e","i","o","u"]:
  103. self.location += "an "
  104. else:
  105. self.location += "a "
  106. self.location += self.mainLocation
  107. else:
  108. self.location = Plot.loc2[self.locIndex]
  109. self.missIndex = r.randint(0, len(Plot.miss)-1)
  110. self.oops = r.randint(1,12)
  111. self.mission = ""
  112. if self.oops == 12:
  113. self.mission += "...well, they weren't paying attention, so don't tell them, but they're supposed "
  114. self.mission += Plot.miss[r.randint(0, len(Plot.miss)-1)]
  115. self.probIndex = r.randint(0, len(Plot.prob)-1)
  116. self.problem = Plot.prob[self.probIndex]
  117. self.secProblem = None
  118. self.thirdProblem = None
  119. if self.problem["id"] in [1,2]:
  120. self.problem["name"] += " led by " + gen_name()
  121. if self.problem["id"] in [4,7,8,10]:
  122. self.problem["name"] += " named " + gen_name(minimum=5, maximum=12)
  123. if self.problem["id"] == 3:
  124. self.secProblem = {"name": "Parasites", "shortname": "parasites", "stats": [3,4,2,3]}
  125. if self.problem["id"] == 10:
  126. self.secProbIndex = r.randint(0, len(Plot.prob)-2)
  127. self.secProblem = Plot.prob[self.secProbIndex]
  128. if self.secProbIndex == 3:
  129. self.thirdProblem = {"name": "Parasites", "shortname": "parasites", "stats": [3,4,2,3]}
  130. self.fullProblem = self.problem["name"]
  131. if self.secProblem and self.secProblem["name"] != "Parasites":
  132. self.fullProblem += " and its minion, " + self.secProblem["name"]
  133. class Character:
  134. def __init__(self):
  135. self.name = ""
  136. self.career = ""
  137. self.stats = []
  138. def generate(self):
  139. self.gen_name()
  140. self.gen_stats()
  141. self.gen_career()
  142. def gen_name(self):
  143. self.name = gen_name()
  144. def gen_stats(self, n=12):
  145. if n < 0:
  146. print("Too few stat points!")
  147. return [0,0,0,0]
  148. stats = [0,0,0,0]
  149. points = n
  150. slots = [0,1,2,3]
  151. for _ in range(points):
  152. tgl = False
  153. while tgl == False:
  154. slt = r.choice(slots)
  155. if slt <= 1:
  156. if stats[slt] == 6: continue
  157. if stats[slt] == 5 and r.randint(0,1) != 1: continue
  158. else:
  159. if stats[slt] == 6: continue
  160. if stats[slt] > 2 and r.randint(0,stats[slt]-2) != 1: continue
  161. stats[slt] += 1
  162. tgl = True
  163. stats[3] = stats[3] + 2
  164. if stats[3] > 6:
  165. stats[3] = 6
  166. stats[2] = stats[2] + 2
  167. if stats[2] > 6:
  168. stats[2] = 6
  169. self.stats = stats
  170. def gen_career(self):
  171. self.career = r.choice(["Soldier/Guard","Pilot","Medic","Mechanic","Politician","Spellcaster","Performer","Historian","Spy","Cook","Cartographer","Inventor","Merchant"])
  172. def print_name(self):
  173. print(f"Name: {self.name} (Kobold {self.career})")
  174. def print(self):
  175. self.print_name()
  176. print(f"Order: {self.stats[0]}")
  177. print(f"Chaos: {self.stats[1]}")
  178. print(f"Brain: {self.stats[2]}")
  179. print(f"Body: {self.stats[3]}")
  180. class Ship:
  181. def __init__(self):
  182. self.name1 = r.choice(["Red","Orange","Yellow","Green","Blue","Violet","Dark","Light","Frenzied","Maniacal","Ancient"])
  183. self.name2 = r.choice(["Moon","Comet","Star","Saber","World-Eater","Dancer","Looter","Phlogiston","Fireball","Mecha","Raptor"])
  184. self.gqual = r.choice(["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"])
  185. self.bqual = r.choice(["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"])
  186. self.fullname = f"{self.name1} {self.name2}"
  187. def print(self):
  188. print(f"The {self.fullname} {self.gqual}, but {self.bqual}.")
  189. print()
  190. class Campaign:
  191. def __init__(self, n=None, makeChars=True):
  192. n = 6 if n == None else n
  193. self.ship = Ship()
  194. self.params = Plot()
  195. if makeChars:
  196. self.characters = []
  197. for _ in range(n):
  198. c = Character()
  199. c.generate()
  200. self.characters.append(c)
  201. self.art = "an" if self.params.loc_desc[0] in ["a","e","i","o","u"] else "a"
  202. def print_params(self, endc=""):
  203. st = ["Order:", "Chaos:", "Brains:", "Body:"]
  204. print(f"The Kobolds of the {self.ship.fullname} ", end=endc)
  205. print(f"have been sent out to {self.art} {self.params.loc_desc} {self.params.location} ", end=endc)
  206. print(f"in order {self.params.mission} ", end=endc)
  207. print(f"-- but they're challenged by {self.params.fullProblem}!")
  208. cst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.problem["stats"]]))])
  209. print(f"The stats of the {self.params.problem['shortname']}: {cst}")
  210. if self.params.secProblem:
  211. mst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.secProblem["stats"]]))])
  212. print(f"- The stats of the {self.params.secProblem['shortname']}: {mst}")
  213. if self.params.thirdProblem:
  214. pst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.thirdProblem["stats"]]))])
  215. print(f"- - The stats of the {self.params.thirdProblem['shortname']}: {pst}")
  216. print()
  217. self.ship.print()
  218. def print_chars(self):
  219. print("The kobolds:")
  220. for k in self.characters:
  221. k.print()
  222. if __name__ == "__main__":
  223. parser = argparse.ArgumentParser()
  224. group = parser.add_mutually_exclusive_group()
  225. group.add_argument("-c", "--campaign", help="print a full campaign block with N kobolds (default 6)", nargs="?", const=6, type=int, metavar="N")
  226. group.add_argument("-k", "--kobolds", help="print N kobolds", type=int, nargs="?", const=1, default=1, metavar="N")
  227. group.add_argument("-n", "--names", help="print N kobolds without stat blocks", nargs="?", const=1, type=int, metavar="N")
  228. group.add_argument("-p", "--params", help="print only the parameters of a campaign", action="store_true")
  229. group.add_argument("-s", "--ship", help="print only the ship name and description", action="store_true")
  230. args = parser.parse_args()
  231. # print(args)
  232. if args.campaign:
  233. cmp = Campaign(args.campaign)
  234. cmp.print_params()
  235. cmp.print_chars()
  236. elif args.params:
  237. cmp = Campaign(makeChars=False)
  238. cmp.print_params()
  239. elif args.ship:
  240. ship = Ship()
  241. ship.print()
  242. elif args.names:
  243. for _ in range(args.names):
  244. c = Character()
  245. c.generate()
  246. c.print_name()
  247. else:
  248. for _ in range(args.kobolds):
  249. c = Character()
  250. c.generate()
  251. c.print()