Browse Source

Adversaries into dicts

master
Noëlle 3 years ago
parent
commit
5528125143
1 changed files with 90 additions and 33 deletions
  1. 90
    33
      koboldgen.py

+ 90
- 33
koboldgen.py View File

@@ -24,11 +24,77 @@ def gen_name(length=None, minimum=None, maximum=None):
return "".join(morae)

class Plot:
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"]
loc1 = ["friendly","hostile","derelict","airless","poison-filled/covered","overgrown","looted","burning","frozen","haunted","infested"]
loc2 = ["asteroid","moon","space station","spaceship","ringworld","Dyson sphere","planet","Space Whale","pocket of folded space","time vortex","Reroll"]
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"]
prob = ["an Undead Sample Pack (swarm of zombies and skeletons)","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","a Flying Brain Monster"]
pstats = [[0,5,2,6],[3,3,4,4],[4,3,5,4],[2,4,0,0],[4,1,6,3],[3,3,2,4],[0,2,1,5],[2,3,1,6],[5,2,6,3],[6,6,6,6],[2,3,6,1]]
prob = [
{
"id": 0,
"name": "an Undead Sample Pack (swarm of zombies and skeletons)",
"shortname": "undead",
"stats": [0,5,2,6],
},
{
"id": 1,
"name": "a rival band of kobolds",
"shortname": "kobolds",
"stats": [3,3,4,4],
},
{
"id": 2,
"name": "a detachment from the Elf Armada",
"shortname": "elves",
"stats": [4,3,5,4],
},
{
"id": 3,
"name": "refugees with parasites. Big parasites",
"shortname": "refugees",
"stats": [2,4,0,0],
},
{
"id": 4,
"name": "an artificial intelligence bent on multi-world domination",
"shortname": "AI",
"stats": [4,1,6,3],
},
{
"id": 5,
"name": "robot spiders",
"shortname": "spiders",
"stats": [3,3,2,4],
},
{
"id": 6,
"name": "semi-intelligent metal eating slime",
"shortname": "slime",
"stats": [0,2,1,5],
},
{
"id": 7,
"name": "a living asteroid that intends to follow the kobolds home like the largest puppy",
"shortname": "asteroid",
"stats": [2,3,1,6],
},
{
"id": 8,
"name": "an old lich that wants everyone to stay off of their 'lawn'",
"shortname": "lich",
"stats": [5,2,6,3],
},
{
"id": 9,
"name": "elder gods hailing from the dark spaces between the stars",
"shortname": "gods",
"stats": [6,6,6,6],
},
{
"id": 10,
"name": "a Flying Brain Monster",
"shortname": "Flying Brain Monster",
"stats": [2,3,6,1],
},
]
def __init__(self):
self.loc_desc = Plot.loc1[r.randint(0, len(Plot.loc1)-1)]
@@ -41,28 +107,22 @@ class Plot:
self.mission += Plot.miss[r.randint(0, len(Plot.miss)-1)]
self.probIndex = r.randint(0, len(Plot.prob)-1)
self.problem = Plot.prob[self.probIndex]
self.problemStats = Plot.pstats[self.probIndex]
self.secProblem = None
self.secProbStats = None
self.thirdProblem = None
self.thirdProbStats = None
if self.probIndex in [1,2]:
self.problem += " led by " + gen_name()
if self.probIndex in [4,7,8,10]:
self.problem += " named " + gen_name(minimum=5, maximum=12)
if self.probIndex == 3:
self.secProblem = "Parasites"
self.secProbStats = [3,4,2,3]
elif self.probIndex == len(Plot.prob) - 1:
self.secProbIndex = r.randint(0, len(Plot.prob)-2)
if self.problem["id"] in [1,2]:
self.problem["name"] += " led by " + gen_name()
if self.problem["id"] in [4,7,8,10]:
self.problem["name"] += " named " + gen_name(minimum=5, maximum=12)
if self.problem["id"] == 3:
self.secProblem = {"name": "Parasites", "shortname": "parasites", "stats": [3,4,2,3]}
if self.problem["id"] == 10:
self.secProbIndex = r.randint(0, len(Plot.prob)-2)
self.secProblem = Plot.prob[self.secProbIndex]
self.secProbStats = Plot.pstats[self.secProbIndex]
if self.secProbIndex == 3:
self.thirdProblem = "Parasites"
self.thirdProbStats = [3,4,2,3]
self.fullProblem = self.problem
if self.secProblem and self.secProblem != "Parasites":
self.fullProblem += ", and its minion, " + self.secProblem
self.thirdProblem = {"name": "Parasites", "shortname": "parasites", "stats": [3,4,2,3]}
self.fullProblem = self.problem["name"]
if self.secProblem and self.secProblem["name"] != "Parasites":
self.fullProblem += " and its minion, " + self.secProblem["name"]


class Character:
@@ -142,7 +202,7 @@ class Campaign:
c = Character()
c.generate()
self.characters.append(c)
self.art = "an" if self.params.loc_desc in ["A","E","I","O","U"] else "a"
self.art = "an" if self.params.loc_desc[0] in ["a","e","i","o","u"] else "a"


def print_params(self, endc=""):
@@ -151,17 +211,14 @@ class Campaign:
print(f"have been sent out to {self.art} {self.params.loc_desc} {self.params.location} ", end=endc)
print(f"in order {self.params.mission} ", end=endc)
print(f"-- but they're challenged by {self.params.fullProblem}!")
cst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.problemStats]))])
print(f"The challenger's stats: {cst}")
if self.params.secProblem != None:
mst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.secProbStats]))])
if self.params.secProblem == "Parasites":
print(f"- The parasites' stats: {mst}")
else:
print(f"- Its minion's stats: {mst}")
if self.params.thirdProblem != None:
pst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.thirdProbStats]))])
print(f"- - The parasites' stats: {pst}")
cst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.problem["stats"]]))])
print(f"The stats of the {self.params.problem['shortname']}: {cst}")
if self.params.secProblem:
mst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.secProblem["stats"]]))])
print(f"- The stats of the {self.params.secProblem['shortname']}: {mst}")
if self.params.thirdProblem:
pst = ", ".join([" ".join(y) for y in list(zip(st, [str(x) for x in self.params.thirdProblem["stats"]]))])
print(f"- - The stats of the {self.params.thirdProblem['shortname']}: {pst}")
print()
self.ship.print()


Loading…
Cancel
Save