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 44KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929
  1. import random as r
  2. import argparse
  3. import sys
  4. import adversaries
  5. 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"]
  6. mid = beg + ["l","x","n","r"]
  7. def binarize(num, l=None):
  8. r = bin(num)[2:]
  9. try:
  10. l = int(l)
  11. except:
  12. l = None
  13. if l != None:
  14. while len(r) < l:
  15. r = "0" + r
  16. return r
  17. def gen_name(length=None, minimum=3):
  18. maximum = 8
  19. if length == None:
  20. lgt = r.randint(minimum,maximum)
  21. else:
  22. if length > maximum:
  23. length = maximum
  24. print("Maximum name length is 8.")
  25. lgt = length
  26. morae = []
  27. while len("".join(morae)) < lgt:
  28. if len(morae) == 0:
  29. mora = r.choice(beg)
  30. morae.append(mora[0].upper() + mora[1:])
  31. else:
  32. mora = r.choice(mid)
  33. if morae[-1] == mora:
  34. mora = r.choice(mid)
  35. morae.append(mora)
  36. fname = "".join(morae)[:lgt]
  37. return fname
  38. class Plot:
  39. loc1 = ["friendly","hostile","derelict","airless","poison-filled/covered","overgrown","looted","burning","frozen","haunted","infested"]
  40. loc2 = ["asteroid","moon","space station","spaceship","ringworld","Dyson sphere","planet","Space Whale","pocket of folded space","time vortex","Reroll"]
  41. miss = ["explore","loot everything not bolted down too securely","find the last group of kobolds who came here","find a rumored secret weapon","find a way to break someone else's secret weapon","claim this place in the name of the Kobold Empire","make friends","rediscover lost technology","find lost magical items","find and defeat a powerful enemy"]
  42. prob = adversaries.prob
  43. # [
  44. # {
  45. # "id": 0,
  46. # "name": "an Undead Sample Pack (swarm of zombies and skeletons)",
  47. # "shortname": "undead",
  48. # "stats": [0,5,2,6],
  49. # },
  50. # {
  51. # "id": 1,
  52. # "name": "a rival band of kobolds",
  53. # "shortname": "kobold rivals",
  54. # "stats": [3,3,4,4],
  55. # },
  56. # {
  57. # "id": 2,
  58. # "name": "a detachment from the Elf Armada",
  59. # "shortname": "elves",
  60. # "stats": [4,3,5,4],
  61. # },
  62. # {
  63. # "id": 3,
  64. # "name": "refugees with parasites. Big parasites",
  65. # "shortname": "refugees",
  66. # "stats": [2,4,0,0],
  67. # },
  68. # {
  69. # "id": 4,
  70. # "name": "an artificial intelligence bent on multi-world domination",
  71. # "shortname": "AI",
  72. # "stats": [4,1,6,3],
  73. # },
  74. # {
  75. # "id": 5,
  76. # "name": "robot spiders",
  77. # "shortname": "spiders",
  78. # "stats": [3,3,2,4],
  79. # },
  80. # {
  81. # "id": 6,
  82. # "name": "semi-intelligent metal eating slime",
  83. # "shortname": "slime",
  84. # "stats": [0,2,1,5],
  85. # },
  86. # {
  87. # "id": 7,
  88. # "name": "a living asteroid that intends to follow the kobolds home like the largest puppy",
  89. # "shortname": "asteroid",
  90. # "stats": [2,3,1,6],
  91. # },
  92. # {
  93. # "id": 8,
  94. # "name": "an old lich that wants everyone to stay off of their 'lawn'",
  95. # "shortname": "lich",
  96. # "stats": [5,2,6,3],
  97. # },
  98. # {
  99. # "id": 9,
  100. # "name": "elder gods hailing from the dark spaces between the stars",
  101. # "shortname": "gods",
  102. # "stats": [0,6,6,6],
  103. # },
  104. # {
  105. # "id": 10,
  106. # "name": "a Flying Brain Monster",
  107. # "shortname": "Flying Brain Monster",
  108. # "stats": [2,3,6,1],
  109. # },
  110. # ]
  111. def __init__(self, loc_desc=None, locIndex=None, battlefield=None, location=None, missIndex=None, oops=None, mission=None, probIndex=None, problem=None, probName=None, secProblem=None, thirdProblem=None):
  112. self.loc_desc = loc_desc if loc_desc != None else Plot.loc1[r.randint(0, len(Plot.loc1)-1)]
  113. self.locIndex = int(locIndex) if locIndex != None else r.randint(0, len(Plot.loc2)-1)
  114. self.battlefield = int(battlefield) if battlefield != None else 0
  115. self.location = location if location != None else Plot.loc2[self.locIndex]
  116. if locIndex == None and self.locIndex == len(Plot.loc2) - 2:
  117. if self.battlefield == 0:
  118. self.battlefield = 1
  119. self.locIndex = r.randint(0, len(Plot.loc2)-3)
  120. elif locIndex == None and self.locIndex != len(Plot.loc2) - 1:
  121. if self.location == "":
  122. self.location = Plot.loc2[self.locIndex]
  123. if self.location[0].lower() in ["a","e","i","o","u"]:
  124. self.locart = 1
  125. else:
  126. self.locart = 0
  127. self.missIndex = missIndex if missIndex != None else r.randint(0, len(Plot.miss)-1)
  128. self.oops = int(oops) if oops != None else r.randint(1,12)
  129. if self.oops != 1:
  130. self.oops = 0
  131. self.mission = Plot.miss[self.missIndex]
  132. self.probIndex = probIndex if probIndex != None else r.randint(0, len(Plot.prob)-1)
  133. self.problem = Plot.prob[self.probIndex]
  134. if type(self.problem["name"]) != str:
  135. self.problem["name"] = self.problem["name"]()
  136. if type(self.problem["note"]) != str:
  137. self.problem["note"] = self.problem["note"]()
  138. if self.problem["hasMinion"]:
  139. if secProblem != None:
  140. try:
  141. self.secProblem = Plot.prob[secProblem]
  142. except:
  143. self.secProblem = Plot.prob[r.choice(self.problem["potentialMinions"])]
  144. else:
  145. self.secProblem = Plot.prob[r.choice(self.problem["potentialMinions"])]
  146. if type(self.secProblem["name"]) != str:
  147. self.secProblem["name"] = self.secProblem["name"]()
  148. if type(self.secProblem["note"]) != str:
  149. self.secProblem["note"] = self.secProblem["note"]()
  150. self.fullProblem = ""
  151. if self.problem["needsName"]:
  152. self.problem["givenname"] = probName if probName != None else gen_name()
  153. self.fullProblem += self.problem["givenname"] + ", "
  154. if not self.problem["isPlural"] and self.problem["name"].split(" ")[0] != "Old":
  155. if self.problem["name"][0].lower() in ["a","e","i","o","u"]:
  156. self.fullProblem += "an "
  157. else:
  158. self.fullProblem += "a "
  159. self.fullProblem += self.problem["name"]
  160. if self.problem["hasMinion"]:
  161. self.fullProblem += " and its minion, "
  162. # if self.secProblem["name"][0].lower() in ["a","e","i","o","u"]:
  163. # self.fullProblem += "an "
  164. # else:
  165. # self.fullProblem += "a "
  166. self.fullProblem += self.secProblem["name"]
  167. class Character:
  168. # Remember to update gen_gadget() when you add gadgets
  169. GADGETS = [ {"id": 0, "name": "Awesome Dagger of Sneak(?) Attacks", "description": "Yell 'Sneak Attack!' to count a mixed-success Body attack as a success.", "reusable": True},
  170. {"id": 1, "name": "Button of Uselessness", "description": f"This large, red button can be stuck onto any flat surface, horizontal, vertical, or otherwise. A short time after it has been placed, any character (friend or foe) nearby must succeed a Brains roll to avoid pressing the button. Pressing the button does nothing, but this action takes the place of anything that might otherwise be done during an Event if the Brains roll is failed. The button can be pressed {r.randint(1,6)} times before it breaks and no longer compels others to press it.", "reusable": False},
  171. {"id": 2, "name": "Encyclopedia of Stuff I Totally Knew", "description": "Add 2 points to the target number of any uncontested Brains roll, or 1 point to the target number of a contested Brains roll.", "reusable": True},
  172. {"id": 3, "name": "Medkit", "description": "Make a Brains/Order roll to restore 2 lost Body points, or 1 on a Mixed Success. If the character has medical training, restored Body points may be doubled.", "reusable": False},
  173. {"id": 4, "name": "Potion of Healing", "description": "Restore 1 lost Body point. Using counts as an Event but no roll is needed unless it’s contested.", "reusable": False},
  174. {"id": 5, "name": "Tinfoil Helm of Shielding", "description": "Count any Brains damage as a mixed success. If you take Body damage, roll 1d6; on a 6, the Helm is useless until you take a nap.", "reusable": True},
  175. {"id": 6, "name": "Handy Toothbrush", "description": "Scrub the Space Gunk off whatever object you're interacting with to turn a mixed Order success to make that object work into a full success.", "reusable": True},
  176. {"id": 7, "name": "Jar of ... Something", "description": "Throw it (Body/Chaos) at another character to make them spend an Event cleaning it off, or throw it at the floor to make a ten-foot circle of difficult terrain.", "reusable": False},
  177. {"id": 8, "name": "Pocket Sand!", "description": "Yell 'Pocket Sand!' to count a successful Body attack against you as a mixed success.", "reusable": False},
  178. {"id": 9, "name": "The Fabulous Grappling Hook", "description": "As an Event, instantly move 50 feet in any direction. (Make sure you have 50 feet available to move in or take 1 Body damage when you arrive short of that.)", "reusable": True},
  179. {"id": 10, "name": "Pocket Accordion", "description": "Make a Brains/Order or Brains/Chaos roll. On a success, any nearby opponent has -1 Brains during their next event. On a failure, everybody nearby, including you, has -1 Brains on their next event.", "reusable": True},
  180. {"id": 11, "name": "Cloak of Adsorption", "description": "The cloak starts out white. Whenever you are the target of a successful attack, the cloak becomes the color of whatever hit you. If your cloak is already the same color as whatever hit you, the attack becomes a mixed success and the cloak turns black and can no longer absorb colors. The cloak becomes white again after a nap.", "reusable": True},
  181. {"id": 12, "name": "Cloak of Absorption", "description": "The cloak starts out white. You can remove the cloak and lay it over difficult terrain to make it easy terrain; if the terrain is difficult because the ground is wet, the cloak becomes wet and the ground in that area becomes dry. The cloak dries out after a nap.", "reusable": True},
  182. {"id": 13, "name": "Cloak of Desorption", "description": "The cloak starts out black. As an Event, you can cause a gas to evaporate from the cloak, leaving it a dingy gray and healing 1 Body to anyone within ten feet of you. The cloak becomes black again after a nap.", "reusable": True},
  183. {"id": 14, "name": "Cloak of Food Portions", "description": "Wearing this cloak causes it to flare out at the base, making the wearer resemble a pyramid. In conversations regarding food the wearer can add +2 to Brains rolls when trying to convince others to alter their diets. This can be done once per nap. Considering how many large things tend to snack on kobolds, this has been found to actually be quite useful.", "reusable": True},
  184. {"id": 15, "name": "Huge Goggles", "description": "If you take Body damage, roll 1d6; on a 6, the lenses of the Goggles break until you take a nap.", "reusable": True},
  185. {"id": 123, "name": "Shortbow of the Watch", "description": "Choose a single target. You get +1 to Body damage against that target and +1 to Brain rolls to track that target. Activating this is not an Event.", "reusable": True},
  186. {"id": 124, "name": "Hammer of Thunderbolts", "description": "You get +1 Body damage on any successful or partially successful attack with this weapon. As an Event, you can also throw it at a target or surface, which will stun any creature within 30 feet of the impact for 1d6 Events.", "reusable": True},
  187. {"id": 125, "name": "Eldritch Cannon", "description": "You conjure a small, semi-autonomous and semi-intelligent cannon that can produce a single spell effect of your choice as an Event.", "reusable": True},
  188. {"id": 126, "name": "Staff of Lightning", "description": "As an Event, create a lightning bolt from the tip of the staff that travels 30 feet in a straight line and deals 2 Body damage to any target in its path.", "reusable": True},
  189. {"id": 127, "name": "Voyager Staff", "description": "Any spell you cast has +1 damage. In addition, as an Event, you can move up to 50 feet in any direction - even through walls and other solid surfaces.", "reusable": True}
  190. ]
  191. # Remember to update gen_career() when you add careers
  192. CAREERS = [ {"id": 0, "name": "Soldier/Guard"},
  193. {"id": 1, "name": "Pilot"},
  194. {"id": 2, "name": "Medic"},
  195. {"id": 3, "name": "Mechanic"},
  196. {"id": 4, "name": "Politician"},
  197. {"id": 5, "name": "Spellcaster"},
  198. {"id": 6, "name": "Performer"},
  199. {"id": 7, "name": "Historian"},
  200. {"id": 8, "name": "Spy"},
  201. {"id": 9, "name": "Cook"},
  202. {"id": 10, "name": "Cartographer"},
  203. {"id": 11, "name": "Inventor"},
  204. {"id": 12, "name": "Merchant"},
  205. {"id": 123, "name": "Ranger"},
  206. {"id": 124, "name": "Barbarian"},
  207. {"id": 125, "name": "Artificer"},
  208. {"id": 126, "name": "Druid"},
  209. {"id": 127, "name": "Wizard"}
  210. ]
  211. def __init__(self, name=None, career=None, stats=None, gadget=None):
  212. self.name = name if name != None else ""
  213. if career == None:
  214. self.career = ""
  215. elif isinstance(career, str):
  216. self.career = career
  217. elif isinstance(career, int) and (career in range(13) or career in range(123,128)):
  218. self.career = [x for x in Character.CAREERS if x["id"] == career][0]
  219. else:
  220. self.career = ""
  221. self.stats = stats if stats != None else []
  222. if gadget == None:
  223. self.gadget = ""
  224. elif isinstance(gadget, str) or isinstance(gadget, dict):
  225. self.gadget = gadget
  226. else:
  227. self.gadget = next((x for x in Character.GADGETS if x["id"] == gadget), "")
  228. self.generate()
  229. def generate(self):
  230. if self.name == "" or self.name == None:
  231. self.gen_name()
  232. if self.stats == [] or self.stats == None:
  233. self.gen_stats()
  234. if self.career == "" or self.career == None:
  235. self.gen_career()
  236. if self.gadget == "" or self.gadget == None:
  237. self.gen_gadget()
  238. def gen_name(self):
  239. self.name = gen_name()
  240. def gen_stats(self, n=12):
  241. if n < 0:
  242. print("Too few stat points!")
  243. return [0,0,0,0]
  244. stats = [0,0,0,0]
  245. points = n
  246. slots = [0,1,2,3]
  247. for _ in range(points):
  248. tgl = False
  249. while tgl == False:
  250. slt = r.choice(slots)
  251. if slt <= 1:
  252. if stats[slt] == 6: continue
  253. if stats[slt] == 5 and r.randint(0,1) != 1: continue
  254. else:
  255. if stats[slt] == 6: continue
  256. if stats[slt] > 2 and r.randint(0,stats[slt]-2) != 1: continue
  257. stats[slt] += 1
  258. tgl = True
  259. stats[3] = stats[3] + 1
  260. if stats[3] > 6:
  261. stats[3] = 6
  262. stats[2] = stats[2] + 1
  263. if stats[2] > 6:
  264. stats[2] = 6
  265. self.stats = stats
  266. def gen_career(self):
  267. cid = r.randint(0,12)
  268. self.career = next((x for x in Character.CAREERS if x["id"] == cid), "")
  269. def gen_gadget(self):
  270. gid = r.randint(0,15)
  271. self.gadget = [x for x in Character.GADGETS if x["id"] == gid][0]
  272. def print_name(self, html=False):
  273. if isinstance(self.career, str):
  274. cname = self.career
  275. cid = next((x for x in Character.CAREERS if x["name"] == cname), "")
  276. else:
  277. cname = self.career["name"]
  278. c = dict(next((x for x in Character.CAREERS if x["name"] == cname), ""))
  279. cid = c["id"]
  280. if html:
  281. charText = f"<h4>Name: {self.name} (Kobold {cname})</h4>"
  282. else:
  283. charText = f"\nName: {self.name} (Kobold {cname} {cid})"
  284. print(charText)
  285. def print(self, html=False):
  286. if html:
  287. if isinstance(self.career, str):
  288. cname = self.career
  289. else:
  290. cname = self.career["name"]
  291. if isinstance(self.gadget, str):
  292. gdg = {"id": 127, "name": self.gadget, "description": "", "reusable": True}
  293. else:
  294. gdg = self.gadget
  295. out = (
  296. f"<div class='kobold'>\n"
  297. f" <span class='koboldid'>\n"
  298. f" <span class='koboldname'>{self.name}</span><br>\n"
  299. f" <span class='koboldcareer'>Kobold {cname}</span>\n"
  300. f" </span>\n"
  301. f" <br>\n"
  302. f" <span class='koboldstats'>\n"
  303. f" <ul>\n"
  304. f" <li>Order: {self.stats[0]}</li>\n"
  305. f" <li>Chaos: {self.stats[1]}</li>\n"
  306. f" <li>Brain: {self.stats[2]}</li>\n"
  307. f" <li>Body: {self.stats[3]}</li>\n"
  308. f" </ul>\n"
  309. f" </span>\n"
  310. f" <br>\n"
  311. f" <span class='koboldgadget'>\n"
  312. f" <span class='koboldgadgetname'>{gdg['name']}</span><br>\n"
  313. f" <span class='koboldgadgetdescription'>{gdg['description']}</span>\n"
  314. f" <span class='koboldgadgetreuse'>{'<br>Reusable' if gdg['reusable'] else ''}</span>\n"
  315. f" </span>"
  316. f"</div>\n"
  317. )
  318. print(out)
  319. else:
  320. self.print_name()
  321. print(f"Order: {self.stats[0]}")
  322. print(f"Chaos: {self.stats[1]}")
  323. print(f"Brain: {self.stats[2]}")
  324. print(f"Body: {self.stats[3]}")
  325. if isinstance(self.gadget, str):
  326. print(f"Gadget: {self.gadget}")
  327. else:
  328. print(f"Gadget: {self.gadget['name']} ({self.gadget['description']}{'- Reusable' if self.gadget['reusable'] else ''})")
  329. class Ship:
  330. NAME1 = ["Red","Orange","Yellow","Green","Blue","Violet","Dark","Light","Frenzied","Maniacal","Ancient"]
  331. NAME2 = ["Moon","Comet","Star","Saber","World-Eater","Dancer","Looter","Phlogiston","Fireball","Mecha","Raptor"]
  332. GQUAL = ["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"]
  333. BQUAL = ["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"]
  334. def __init__(self, name1=None, name2=None, gqual = None, bqual = None):
  335. self.name1 = name1 if name1 != None else r.choice(Ship.NAME1)
  336. self.name2 = name2 if name2 != None else r.choice(Ship.NAME2)
  337. self.gqual = gqual if gqual != None else r.choice(Ship.GQUAL)
  338. self.bqual = bqual if bqual != None else r.choice(Ship.BQUAL)
  339. self.fullname = f"{self.name1} {self.name2}"
  340. def print(self, html=False):
  341. if (html):
  342. shipText = f"<p>The <strong>{self.fullname}</strong> <span style='color: blue;'>{self.gqual}</span>, but <span style='color: red;'>{self.bqual}</span>.</p>\n"
  343. else:
  344. shipText = f"The {self.fullname} {self.gqual}, but {self.bqual}.\n"
  345. print(shipText)
  346. class Campaign:
  347. ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz?- "
  348. NAMELETS = ['a', 'e', 'i', 'o', 'u', 'b', 'y', 'd', 'f', 'g', 'k', 'm', 'n', 'p', 'r', 's', 't', 'w', 'z', 'l', 'x']
  349. def __init__(self, n=None, makeChars=True, fromPW=False, pw=None):
  350. if fromPW == True:
  351. self.ship = None
  352. self.params = None
  353. self.characters = None
  354. self.art = None
  355. self.masterpassword = pw
  356. self.decode_key(pw)
  357. else:
  358. self.masterpassword = None
  359. self.create_campaign(n, makeChars)
  360. def create_campaign(self, n, makeChars):
  361. n = 6 if n == None else n
  362. self.ship = Ship()
  363. self.params = Plot()
  364. self.params.problem["fullname"] = ""
  365. if self.params.problem["id"] in [1,2]:
  366. self.params.problem["fullname"] += " led by " + self.params.problem["name"]
  367. if self.params.problem["id"] in [4,7,8,10]:
  368. self.params.problem["fullname"] += " named " + self.params.problem["name"]
  369. if makeChars:
  370. self.characters = []
  371. for _ in range(n):
  372. c = Character()
  373. c.generate()
  374. self.characters.append(c)
  375. self.art = "an" if self.params.loc_desc[0] in ["a","e","i","o","u"] else "a"
  376. def generate_key(self):
  377. """
  378. "PACKTA CTICS! ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- ------- -------" should generate the Season 3 Pack Tactics crew.
  379. "JUSTIN BAILEY" and "NARPAS SWORD" should do something too.
  380. Key is analphanumeric string generated from a bitfield
  381. Bitfield is:
  382. Location 1: 7 bits
  383. Location 2: 7 bits
  384. Location Battlefield: 1 bit
  385. Mission: 7 bits
  386. Oops: 1 bit
  387. Problem 1: 7 bits
  388. Problem 1 name: 40 bits
  389. Problem 2: 7 bits
  390. Ship name 1: 7 bits
  391. Ship name 2: 7 bits
  392. Ship gqual: 7 bits
  393. Ship bqual: 7 bits
  394. Character 1 name: 40 bits
  395. Character 1 career: 7 bits
  396. Character 1 order: 3 bits
  397. Character 1 chaos: 3 bits
  398. Character 1 body: 3 bits
  399. Character 1 brain: 3 bits
  400. Character 1 gadget: 7 bits
  401. Character 2 name: 40 bits
  402. Character 2 career: 7 bits
  403. Character 2 order: 3 bits
  404. Character 2 chaos: 3 bits
  405. Character 2 body: 3 bits
  406. Character 2 brain: 3 bits
  407. Character 2 gadget: 7 bits
  408. Character 3 name: 40 bits
  409. Character 3 career: 7 bits
  410. Character 3 order: 3 bits
  411. Character 3 chaos: 3 bits
  412. Character 3 body: 3 bits
  413. Character 3 brain: 3 bits
  414. Character 3 gadget: 7 bits
  415. Character 4 name: 40 bits
  416. Character 4 career: 7 bits
  417. Character 4 order: 3 bits
  418. Character 4 chaos: 3 bits
  419. Character 4 body: 3 bits
  420. Character 4 brain: 3 bits
  421. Character 4 gadget: 7 bits
  422. Character 5 name: 40 bits
  423. Character 5 career: 7 bits
  424. Character 5 order: 3 bits
  425. Character 5 chaos: 3 bits
  426. Character 5 body: 3 bits
  427. Character 5 brain: 3 bits
  428. Character 5 gadget: 7 bits
  429. Character 6 name: 40 bits
  430. Character 6 career: 7 bits
  431. Character 6 order: 3 bits
  432. Character 6 chaos: 3 bits
  433. Character 6 body: 3 bits
  434. Character 6 brain: 3 bits
  435. Character 6 gadget: 7 bits
  436. 104 for campaign
  437. 396 for characters
  438. total 501
  439. 11 remaining
  440. """
  441. self.key = ""
  442. l1 = bin(Plot.loc1.index(self.params.loc_desc))[2:]
  443. l2 = bin(Plot.loc2.index(self.params.location))[2:]
  444. lb = bin(self.params.battlefield)[2:]
  445. op = bin(self.params.oops)[2:]
  446. ms = bin(self.params.missIndex)[2:]
  447. pb1 = bin(self.params.probIndex)[2:]
  448. if self.params.problem["hasMinion"]:
  449. pb2 = bin(self.params.secProblem["id"])[2:]
  450. else:
  451. pb2 = bin(127)[2:]
  452. if self.params.problem["needsName"]:
  453. pbname = self.encode_name(self.params.problem["givenname"])
  454. else:
  455. pbname = self.encode_name("yyyyyyyy")
  456. n1 = bin(Ship.NAME1.index(self.ship.name1))[2:]
  457. n2 = bin(Ship.NAME2.index(self.ship.name2))[2:]
  458. gq = bin(Ship.GQUAL.index(self.ship.gqual))[2:]
  459. bq = bin(Ship.BQUAL.index(self.ship.bqual))[2:]
  460. chars = {}
  461. i = 0
  462. for chct in self.characters:
  463. chars[i] = {
  464. "name": self.encode_name(chct.name),
  465. "career": bin(chct.career["id"])[2:],
  466. "order": bin(chct.stats[0])[2:],
  467. "chaos": bin(chct.stats[1])[2:],
  468. "body": bin(chct.stats[2])[2:],
  469. "brains": bin(chct.stats[3])[2:],
  470. "gadget": bin(chct.gadget["id"])[2:]
  471. }
  472. i += 1
  473. l1 = lpad(l1, 7)
  474. l2 = lpad(l2, 7)
  475. ms = lpad(ms, 7)
  476. pb1 = lpad(pb1, 7)
  477. pb2 = lpad(pb2, 7)
  478. pbname = lpad(pbname, 40, "1")
  479. n1 = lpad(n1, 7)
  480. n2 = lpad(n2, 7)
  481. gq = lpad(gq, 7)
  482. bq = lpad(bq, 7)
  483. self.key += l1 + l2 + lb + ms + op + pb1 + pbname + pb2 + n1 + n2 + gq + bq
  484. for k,chct in chars.items():
  485. chct["name"] = lpad(chct["name"], 40, "1")
  486. chct["career"] = lpad(chct["career"], 7)
  487. chct["order"] = lpad(chct["order"],3)
  488. chct["chaos"] = lpad(chct["chaos"], 3)
  489. chct["body"] = lpad(chct["body"], 3)
  490. chct["brains"] = lpad(chct["brains"], 3)
  491. chct["gadget"] = lpad(chct["gadget"], 7)
  492. self.key += chct["name"] + chct["career"] + chct["order"] + chct["chaos"] + chct["body"] + chct["brains"] + chct["gadget"]
  493. while len(self.key) < 509:
  494. self.key = self.key + "0"
  495. letters = []
  496. letter = []
  497. for bit in self.key:
  498. letter.append(bit)
  499. if len(letter) == 6:
  500. letters.append(Campaign.ALPHABET[int("".join(letter),2)])
  501. letter = []
  502. words = []
  503. word = []
  504. for lt in letters:
  505. word.append(lt)
  506. if len(word) == 6:
  507. words.append("".join(word))
  508. word = []
  509. words.append("".join(word))
  510. self.password = " ".join(words)
  511. return self.password
  512. def decode_key(self, pw):
  513. densePwd = pw.replace(" ", "")
  514. if len(densePwd) != 84 and (densePwd not in ["PACKTACTICS!", "JUSTINBAILEY", "NARPASSWORD"]):
  515. print("This password is not valid. If this is a password that this generator created, please email noelle@noelle.codes and let me know.")
  516. sys.exit(0)
  517. if densePwd[:12] == "PACKTACTICS!":
  518. # Create a campaign featuring the Season 3 Pack Tactics crew.
  519. self.ship = Ship("Red", "Star", "is maneuverable & unarmored", "has a politician who thinks they're in charge of it")
  520. self.params = Plot()
  521. self.art = "an" if self.params.loc_desc[0] in ["a","e","i","o","u"] else "a"
  522. self.characters = []
  523. self.characters.append(Character("Niwri", 123, [3, 4, 4, 3], 123))
  524. self.characters.append(Character("Zax", 124, [1, 6, 2, 5], 124))
  525. self.characters.append(Character("Chroma", 125, [4, 2, 5, 3], 125))
  526. self.characters.append(Character("Zenosha", 126, [2, 3, 5, 2], 126))
  527. self.characters.append(Character("Snax", 127, [3, 4, 6, 1], 127))
  528. # self.print_params()
  529. # self.print_chars()
  530. return
  531. elif densePwd[:12] == "JUSTINBAILEY":
  532. # Create a random campaign, but everyone's Gadget is a leotard that somehow is also an environment suit
  533. self.create_campaign(n=6, makeChars=True)
  534. for c in self.characters:
  535. c.gadget = {"id":127, "name": "The Bailey", "description": "A form-fitting leotard that somehow protects the wearer from all environmental effects except extreme heat - including vacuum and poison.", "reusable": True}
  536. # self.print_params()
  537. # self.print_chars()
  538. return
  539. elif densePwd[:12] == "NARPASSWORD":
  540. # Create a random campaign, but all the kobolds' stats are set to 6
  541. self.create_campaign(n=6, makeChars=True)
  542. for c in self.characters:
  543. c.stats = [6,6,6,6]
  544. # self.print_params()
  545. # self.print_chars()
  546. return
  547. numPwd = []
  548. for c in densePwd:
  549. numPwd.append(Campaign.ALPHABET.index(c))
  550. bitPwd = [lpad(bin(x).replace("0b",""), 6) for x in numPwd]
  551. longBitPwd = []
  552. for word in bitPwd:
  553. longword = lpad(word,6)
  554. longBitPwd.append(longword)
  555. self.newBitfield = "".join(longBitPwd)
  556. while len(self.newBitfield) < 509:
  557. self.newBitfield += "0"
  558. outkey = {}
  559. # Location 1: 7 bits
  560. i,j = 0,7
  561. outkey["loc1"] = int(self.newBitfield[i:j], 2)
  562. # Location 2: 7 bits
  563. i,j = j,j+7
  564. outkey["loc2"] = int(self.newBitfield[i:j], 2)
  565. # Location Battlefield: 1 bit
  566. i,j = j,j+1
  567. outkey["battlefield"] = int(self.newBitfield[i:j], 2)
  568. # Mission: 7 bits
  569. i,j = j,j+7
  570. outkey["miss"] = int(self.newBitfield[i:j], 2)
  571. # Oops: 1 bit
  572. i,j = j,j+1
  573. outkey["oops"] = int(self.newBitfield[i:j], 2)
  574. # Problem 1: 7 bits
  575. i,j = j,j+7
  576. outkey["prob1"] = int(self.newBitfield[i:j], 2)
  577. # Problem 1 name: 40 bits
  578. i,j = j,j+40
  579. outkey["prob1name"] = self.newBitfield[i:j]
  580. # Problem 2: 7 bits
  581. i,j = j,j+7
  582. outkey["prob2"] = int(self.newBitfield[i:j], 2)
  583. # Ship name 1: 7 bits
  584. i,j = j,j+7
  585. outkey["sname1"] = int(self.newBitfield[i:j], 2)
  586. # Ship name 2: 7 bits
  587. i,j = j,j+7
  588. outkey["sname2"] = int(self.newBitfield[i:j], 2)
  589. # Ship gqual: 7 bits
  590. i,j = j,j+7
  591. outkey["gqual"] = int(self.newBitfield[i:j], 2)
  592. # Ship bqual: 7 bits
  593. i,j = j,j+7
  594. outkey["bqual"] = int(self.newBitfield[i:j], 2)
  595. # Character 1 name: 40 bits
  596. i,j = j,j+40
  597. outkey["char1name"] = self.newBitfield[i:j]
  598. # Character 1 career: 7 bits
  599. i,j = j,j+7
  600. outkey["char1career"] = int(self.newBitfield[i:j], 2)
  601. # Character 1 order: 3 bits
  602. i,j = j,j+3
  603. outkey["char1ord"] = int(self.newBitfield[i:j], 2)
  604. # Character 1 chaos: 3 bits
  605. i,j = j,j+3
  606. outkey["char1cha"] = int(self.newBitfield[i:j], 2)
  607. # Character 1 body: 3 bits
  608. i,j = j,j+3
  609. outkey["char1bod"] = int(self.newBitfield[i:j], 2)
  610. # Character 1 brain: 3 bits
  611. i,j = j,j+3
  612. outkey["char1bra"] = int(self.newBitfield[i:j], 2)
  613. # Character 1 gadget: 7 bits
  614. i,j = j,j+7
  615. outkey["char1gad"] = int(self.newBitfield[i:j], 2)
  616. # Character 2 name: 40 bits
  617. i,j = j,j+40
  618. outkey["char2name"] = self.newBitfield[i:j]
  619. # Character 2 career: 7 bits
  620. i,j = j,j+7
  621. outkey["char2career"] = int(self.newBitfield[i:j], 2)
  622. # Character 2 order: 3 bits
  623. i,j = j,j+3
  624. outkey["char2ord"] = int(self.newBitfield[i:j], 2)
  625. # Character 2 chaos: 3 bits
  626. i,j = j,j+3
  627. outkey["char2cha"] = int(self.newBitfield[i:j], 2)
  628. # Character 2 body: 3 bits
  629. i,j = j,j+3
  630. outkey["char2bod"] = int(self.newBitfield[i:j], 2)
  631. # Character 2 brain: 3 bits
  632. i,j = j,j+3
  633. outkey["char2bra"] = int(self.newBitfield[i:j], 2)
  634. # Character 2 gadget: 7 bits
  635. i,j = j,j+7
  636. outkey["char2gad"] = int(self.newBitfield[i:j], 2)
  637. # Character 3 name: 40 bits
  638. i,j = j,j+40
  639. outkey["char3name"] = self.newBitfield[i:j]
  640. # Character 3 career: 7 bits
  641. i,j = j,j+7
  642. outkey["char3career"] = int(self.newBitfield[i:j], 2)
  643. # Character 3 order: 3 bits
  644. i,j = j,j+3
  645. outkey["char3ord"] = int(self.newBitfield[i:j], 2)
  646. # Character 3 chaos: 3 bits
  647. i,j = j,j+3
  648. outkey["char3cha"] = int(self.newBitfield[i:j], 2)
  649. # Character 3 body: 3 bits
  650. i,j = j,j+3
  651. outkey["char3bod"] = int(self.newBitfield[i:j], 2)
  652. # Character 3 brain: 3 bits
  653. i,j = j,j+3
  654. outkey["char3bra"] = int(self.newBitfield[i:j], 2)
  655. # Character 3 gadget: 7 bits
  656. i,j = j,j+7
  657. outkey["char3gad"] = int(self.newBitfield[i:j], 2)
  658. # Character 4 name: 40 bits
  659. i,j = j,j+40
  660. outkey["char4name"] = self.newBitfield[i:j]
  661. # Character 4 career: 7 bits
  662. i,j = j,j+7
  663. outkey["char4career"] = int(self.newBitfield[i:j], 2)
  664. # Character 4 order: 3 bits
  665. i,j = j,j+3
  666. outkey["char4ord"] = int(self.newBitfield[i:j], 2)
  667. # Character 4 chaos: 3 bits
  668. i,j = j,j+3
  669. outkey["char4cha"] = int(self.newBitfield[i:j], 2)
  670. # Character 4 body: 3 bits
  671. i,j = j,j+3
  672. outkey["char4bod"] = int(self.newBitfield[i:j], 2)
  673. # Character 4 brain: 3 bits
  674. i,j = j,j+3
  675. outkey["char4bra"] = int(self.newBitfield[i:j], 2)
  676. # Character 4 gadget: 7 bits
  677. i,j = j,j+7
  678. outkey["char4gad"] = int(self.newBitfield[i:j], 2)
  679. # Character 5 name: 40 bits
  680. i,j = j,j+40
  681. outkey["char5name"] = self.newBitfield[i:j]
  682. # Character 5 career: 7 bits
  683. i,j = j,j+7
  684. outkey["char5career"] = int(self.newBitfield[i:j], 2)
  685. # Character 5 order: 3 bits
  686. i,j = j,j+3
  687. outkey["char5ord"] = int(self.newBitfield[i:j], 2)
  688. # Character 5 chaos: 3 bits
  689. i,j = j,j+3
  690. outkey["char5cha"] = int(self.newBitfield[i:j], 2)
  691. # Character 5 body: 3 bits
  692. i,j = j,j+3
  693. outkey["char5bod"] = int(self.newBitfield[i:j], 2)
  694. # Character 5 brain: 3 bits
  695. i,j = j,j+3
  696. outkey["char5bra"] = int(self.newBitfield[i:j], 2)
  697. # Character 5 gadget: 7 bits
  698. i,j = j,j+7
  699. outkey["char5gad"] = int(self.newBitfield[i:j], 2)
  700. # Character 6 name: 40 bits
  701. i,j = j,j+40
  702. outkey["char6name"] = self.newBitfield[i:j]
  703. # Character 6 career: 7 bits
  704. i,j = j,j+7
  705. outkey["char6career"] = int(self.newBitfield[i:j], 2)
  706. # Character 6 order: 3 bits
  707. i,j = j,j+3
  708. outkey["char6ord"] = int(self.newBitfield[i:j], 2)
  709. # Character 6 chaos: 3 bits
  710. i,j = j,j+3
  711. outkey["char6cha"] = int(self.newBitfield[i:j], 2)
  712. # Character 6 body: 3 bits
  713. i,j = j,j+3
  714. outkey["char6bod"] = int(self.newBitfield[i:j], 2)
  715. # Character 6 brain: 3 bits
  716. i,j = j,j+3
  717. outkey["char6bra"] = int(self.newBitfield[i:j], 2)
  718. # Character 6 gadget: 7 bits
  719. i,j = j,j+7
  720. outkey["char6gad"] = int(self.newBitfield[i:j], 2)
  721. self.ship = Ship(Ship.NAME1[outkey["sname1"]], Ship.NAME2[outkey["sname2"]], Ship.GQUAL[outkey["gqual"]], Ship.BQUAL[outkey["bqual"]])
  722. self.params = Plot(loc_desc=Plot.loc1[outkey["loc1"]], locIndex=outkey["loc2"], battlefield=outkey["battlefield"], location=None, missIndex=outkey["miss"], oops=outkey["oops"], mission=None, probIndex=outkey["prob1"], problem=None, probName=self.decode_name(outkey["prob1name"]), secProblem=outkey["prob2"], thirdProblem=None)
  723. self.art = "an" if self.params.loc_desc[0] in ["a","e","i","o","u"] else "a"
  724. self.characters = []
  725. for q in range(1,7):
  726. keys = [f"char{q}name", f"char{q}career", f"char{q}ord", f"char{q}cha", f"char{q}bod", f"char{q}bra", f"char{q}gad"]
  727. c = Character(name=self.decode_name(outkey[keys[0]]), career=outkey[keys[1]], stats=[outkey[keys[2]], outkey[keys[3]], outkey[keys[4]], outkey[keys[5]]], gadget=outkey[keys[6]])
  728. self.characters.append(c)
  729. #return self.newBitfield
  730. def encode_name(self, name):
  731. field = "".join([lpad(bin(Campaign.NAMELETS.index(c.lower()))[2:], 5) for c in name])
  732. return field
  733. def decode_name(self, field):
  734. i,j = 35,40
  735. name = ""
  736. for _ in range(8):
  737. k = int(field[i:j], 2)
  738. if k != 31:
  739. name = Campaign.NAMELETS[k] + name
  740. i,j = i-5, i
  741. name = name[0].upper() + name[1:]
  742. return name
  743. def print_params(self, endc=" ", html=False):
  744. st = ["Order:", "Chaos:", "Brains:", "Body:"]
  745. cst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.problem["stats"]]))])
  746. if self.params.oops == 1:
  747. oops = "...well, they weren't paying attention, so don't tell them, but they're supposed to "
  748. else:
  749. oops = ""
  750. mission = oops + self.params.mission
  751. # pl = "s" if self.params.problem["isPlural"] else ""
  752. note = self.params.problem["note"]
  753. secnote = ""
  754. if self.params.problem["hasMinion"]:
  755. secnote = "Their minion: " + self.params.secProblem["note"]
  756. lines = [
  757. f"The Kobolds of the {self.ship.fullname}",
  758. f"have been sent out to {self.art} {self.params.loc_desc} {self.params.location}!",
  759. f"in order to {mission}",
  760. f"but they're challenged by {self.params.fullProblem}!",
  761. f"{note} {secnote}",
  762. f"The stats of the {self.params.problem['shortname']}",
  763. f"{cst}"
  764. ]
  765. if self.params.problem["hasMinion"]:
  766. mst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.secProblem["stats"]]))])
  767. # spl = "s" if self.params.secProblem["isPlural"] else ""
  768. lines.append(f"The stats of the {self.params.secProblem['shortname']}")
  769. lines.append(f"{mst}")
  770. if html:
  771. secnote = ""
  772. if self.params.problem["hasMinion"]:
  773. secnote = "Their minion: " + self.params.secProblem["note"] + "<br>\n"
  774. out = (
  775. f"<div id='theship' class='firstrow'>\n"
  776. f" <span class='head'>The Ship</span>\n"
  777. f" <span id='shipname'>\n"
  778. f" The {self.ship.fullname}!\n"
  779. f" </span>\n"
  780. f" <br>\n"
  781. f" <span id='shipquality1'>\n"
  782. f" It {self.ship.gqual}...\n"
  783. f" </span><br>\n"
  784. f" <span id='shipquality2'>\n"
  785. f" But {self.ship.bqual}!\n"
  786. f" </span>\n"
  787. f"</div>\n"
  788. f"<div id='themission' class='firstrow'>\n"
  789. f" <span class='head'>The Mission</span>\n"
  790. f" <span id='missionloc'>\n"
  791. f" The kobolds have been sent to {self.art} {self.params.loc_desc} {self.params.location}\n"
  792. f" </span><br>\n"
  793. f" <span id='missiontarget'>\n"
  794. f" in order to {mission}!\n"
  795. f" </span>\n"
  796. f"</div>\n<br clear='all'>\n"
  797. f"<div id='theadversary' class='firstrow'>\n"
  798. f" <span class='head'>The Adversary</span>\n"
  799. f" They're challenged by <span id='advname'>{self.params.fullProblem}</span>!\n"
  800. f" <br>\n"
  801. f" <span id='problemnote'>\n"
  802. f" {self.params.problem['note']}<br>\n"
  803. f" {secnote}"
  804. f" </span>\n"
  805. f" <span id='problemstats'>\n"
  806. f" The stats of the {self.params.problem['shortname']}:<br>\n"
  807. f" {cst}\n"
  808. f" </span>\n"
  809. )
  810. if self.params.problem["hasMinion"]:
  811. out += (
  812. f" <br><span id='secprobstats'>\n"
  813. f" The stats of the {self.params.secProblem['shortname']}:<br>\n"
  814. f" {mst}\n"
  815. f" </span>\n"
  816. )
  817. out += f"</div>\n"
  818. print(out)
  819. print(f"<br clear='all'>\n")
  820. else:
  821. print(f"{lines[0]} {lines[1]} {lines[2]} -- {lines[3]}")
  822. print(f"{lines[4]}")
  823. print(f"{lines[5]}: {lines[6]}")
  824. if self.params.problem["hasMinion"]:
  825. print(f"- {lines[7]}: {lines[8]}")
  826. print()
  827. self.ship.print(html=html)
  828. def print_chars(self, html=False):
  829. if html:
  830. print(f"<div id='thekobolds'>\n")
  831. print(f"<span class='head'>The Kobolds</span>\n")
  832. else:
  833. print("The kobolds:")
  834. for k in self.characters:
  835. k.print(html=html)
  836. if html:
  837. print(f"</div>\n<br clear='all'>\n")
  838. def print_password(self, html=False):
  839. if self.masterpassword:
  840. pw = self.masterpassword
  841. else:
  842. pw = self.generate_key()
  843. if html:
  844. out = (
  845. f"<div id='passwordbox'>"
  846. f"<span class='passwordhead'>Permalink to this campaign:</span><br>"
  847. f"<span><a href='http://node.noelle.codes/kobold?pw={pw.replace(' ', '')}'>{pw.replace(' ', '')}</a></span><br><br>"
  848. f"<span class='passwordhead'><a href='http://node.noelle.codes/kobold'>Generate a new random campaign</a></span><br>"
  849. f"</div>"
  850. )
  851. print(out)
  852. print(f"<br clear='all'>\n")
  853. else:
  854. print(f"Password: {pw}")
  855. def decode(self, pwd):
  856. pass
  857. def lpad(s, n, c="0"):
  858. while len(s) < n:
  859. s = c + s
  860. return s
  861. if __name__ == "__main__":
  862. parser = argparse.ArgumentParser()
  863. group = parser.add_mutually_exclusive_group()
  864. group.add_argument("-c", "--campaign", help="print a full campaign block with N kobolds (default 6)", nargs="?", const=6, type=int, metavar="N")
  865. group.add_argument("-k", "--kobolds", help="print N kobolds", type=int, nargs="?", const=1, default=1, metavar="N")
  866. group.add_argument("-n", "--names", help="print N kobolds without stat blocks", nargs="?", const=1, type=int, metavar="N")
  867. group.add_argument("-p", "--params", help="print only the parameters of a campaign", action="store_true")
  868. group.add_argument("-s", "--ship", help="print only the ship name and description", action="store_true")
  869. group.add_argument("-pw", "--password", help="print the campaign defined by the submitted password", type=str, nargs="?", const=1, metavar="PW")
  870. parser.add_argument("--html", help="print in HTML instead of plain text", action="store_true")
  871. args = parser.parse_args()
  872. html = True if args.html else False
  873. if args.password:
  874. cmp = Campaign(fromPW = True, pw=args.password)
  875. cmp.print_params(html=html)
  876. cmp.print_chars(html=html)
  877. cmp.print_password(html=html)
  878. elif args.campaign:
  879. cmp = Campaign(args.campaign)
  880. cmp.print_params(html=html)
  881. cmp.print_chars(html=html)
  882. cmp.print_password(html=html)
  883. elif args.params:
  884. cmp = Campaign(makeChars=False)
  885. cmp.print_params(html=html)
  886. elif args.ship:
  887. ship = Ship()
  888. ship.print(html=html)
  889. elif args.names:
  890. for _ in range(args.names):
  891. c = Character()
  892. c.generate()
  893. c.print_name(html=html)
  894. else:
  895. for _ in range(args.kobolds):
  896. c = Character()
  897. c.generate()
  898. c.print(html=html)