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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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","za","ze","zi","zo","zu","zy"]
  4. mid = beg + ["l","x","n"]
  5. def gen_name(n=None):
  6. if n == None:
  7. lgt = r.randint(3,10)
  8. else:
  9. lgt = n
  10. nm = ""
  11. while len(nm) < lgt:
  12. if nm == "":
  13. mora = r.choice(beg)
  14. nm += mora[0].upper() + mora[1:]
  15. else:
  16. nm += r.choice(mid)
  17. return nm
  18. def gen_stats(n):
  19. if n < 4:
  20. print("Too few stat points!")
  21. return [0,0,0,0]
  22. stats = [1,1,1,1]
  23. points = n - 4
  24. slots = [0,1,2,3]
  25. for _ in range(points):
  26. tgl = False
  27. while tgl == False:
  28. slt = r.choice(slots)
  29. if stats[slt] == 6:
  30. continue
  31. if stats[slt] == 5:
  32. if r.randint(0,1) == 1:
  33. continue
  34. stats[slt] += 1
  35. tgl = True
  36. return stats
  37. def gen_career():
  38. return r.choice(["Soldier/Guard","Pilot","Medic","Mechanic","Politician","Spellcaster","Performer","Historian","Spy","Cook","Cartographer"])
  39. def gen_plot():
  40. loc1 = ["Friendly","Hostile","Derelict","Airless","Poison-filled/covered","Overgrown","Looted","Burning","Frozen","Haunted","Infested"]
  41. loc2 = ["Asteroid","Moon","Space Station","Spaceship","Ringworld","Dyson Sphere","Planet","Space Whale","Pocket of Folded Space","Time Vortex","Reroll"]
  42. 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 [location] 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"]
  43. prob = ["Army of undead","Rival band of kobolds","Detachment from the Elf Armada","Refugees with parasites. Big parasites","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","Old lich that wants everyone to stay off of their “lawn”","Elder gods hailing from the dark spaces between the stars","Reroll"]
  44. cl1 = r.choice(loc1)
  45. cl2 = r.choice(loc2)
  46. cm = r.choice(miss)
  47. cp = r.choice(prob)
  48. if cl2 == "Reroll":
  49. cl2p = r.choice(loc2[:-1])
  50. if cl2p == "Asteroid":
  51. cl2 = "Battlefield on an Asteroid"
  52. else:
  53. cl2 = "Battlefield on a " + cl2p
  54. if cm == "Reroll":
  55. cm = "The kobolds weren't paying attention, so don't tell them, but it's " + r.choice(miss[:-1])
  56. if cp == "Reroll":
  57. cp = "A Floating Brain Monster and its servitor " + r.choice(prob[:-1])
  58. return [cl1, cl2, cm, cp]
  59. def gen_transpo():
  60. name1 = ["Red","Orange","Yellow","Green","Blue","Violet","Dark","Light","Frenzied","Maniacal","Ancient"]
  61. name2 = ["Moon","Comet","Star","Saber","World-Eater","Dancer","Looter","Phlogiston","Fireball","Mecha","Raptor"]
  62. prop1 = ["Stealthy & unarmored","Speedy & unarmored","Maneuverable & unarmored","Reliable (May override Attribute 2)","Self-Repairing","Flamboyant & speedy","Slow & armored","Flamboyant & armored","Hard to maneuver & armored","Too Many Weapons!","Prototype hyperdrive"]
  63. prop2 = ["Annoying AI","Inconveniently crossed circuits","Unpredictable power source","Drifts to the right","Haunted","Recently “found” ","Too cold","Constant odd smell","Interior design … changes","Water pressure shifts between slow drip and power wash","Leaves visible smoke trail"]
  64. return [r.choice(name1), r.choice(name2), r.choice(prop1), r.choice(prop2)]
  65. class Character:
  66. def __init__(self):
  67. self.name = ""
  68. self.career = ""
  69. self.stats = []
  70. def generate(self):
  71. self.gen_name()
  72. self.gen_stats()
  73. self.gen_career()
  74. def gen_name(self):
  75. self.name = gen_name()
  76. def gen_stats(self):
  77. self.stats = gen_stats(12)
  78. def gen_career(self):
  79. self.career = gen_career()
  80. def print(self):
  81. print(f"Name: {self.name} (Kobold {self.career})")
  82. print(f"Order: {self.stats[0]}")
  83. print(f"Chaos: {self.stats[1]}")
  84. print(f"Brain: {self.stats[2]}")
  85. print(f"Body: {self.stats[3]}")
  86. if __name__ == "__main__":
  87. args = sys.argv[1:]
  88. if "--campaign" in args:
  89. cs = []
  90. for _ in range(6):
  91. c = Character()
  92. c.generate()
  93. cs.append(c)
  94. parameters = gen_plot()
  95. ship = gen_transpo()
  96. art = "an" if parameters[1] == "Asteroid" else "a"
  97. print(f"The Kobolds of the {ship[0]} {ship[1]}")
  98. print(f"have been sent out to {art} {parameters[0]} {parameters[1]}")
  99. print(f"{parameters[2]}")
  100. print(f"but they're challenged by {parameters[3]}!")
  101. print()
  102. print(f"The {ship[0]} {ship[1]} has the qualities [{ship[2]}] and [{ship[3]}].")
  103. print()
  104. print("The kobolds:")
  105. for k in cs:
  106. k.print()
  107. else:
  108. c = Character()
  109. c.generate()
  110. c.print()