Browse Source

Add battlefield logic

master
Noëlle 3 years ago
parent
commit
97a397252f
1 changed files with 16 additions and 7 deletions
  1. 16
    7
      koboldgen.py

+ 16
- 7
koboldgen.py View File

@@ -42,7 +42,7 @@ def gen_name(length=None, minimum=3):

class Plot:
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"]
loc2 = ["asteroid","moon","space station","spaceship","ringworld","Dyson sphere","planet","Space Whale","pocket of folded space","time vortex","battlefield"]
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"]
prob = adversaries.prob
@@ -51,10 +51,9 @@ class Plot:
self.locIndex = int(locIndex) if locIndex != None else r.randint(0, len(Plot.loc2)-1)
self.battlefield = int(battlefield) if battlefield != None else 0
self.location = location if location != None else Plot.loc2[self.locIndex]
if locIndex == None and self.locIndex == len(Plot.loc2) - 2:
if self.battlefield == 0:
self.battlefield = 1
self.locIndex = r.randint(0, len(Plot.loc2)-3)
if locIndex == None and loc2[self.locIndex] == "battlefield":
self.battlefield = 1
self.locIndex = r.randint(0, len(Plot.loc2)-2)
elif locIndex == None and self.locIndex != len(Plot.loc2) - 1:
if self.location == "":
self.location = Plot.loc2[self.locIndex]
@@ -741,9 +740,12 @@ class Campaign:
secnote = ""
if self.params.problem["hasMinion"]:
secnote = "Their minion: " + self.params.secProblem["note"]
bf = ""
if self.params.battlefield:
bf = "a battlefield on "
lines = [
f"The Kobolds of the {self.ship.fullname}",
f"have been sent out to {self.art} {self.params.loc_desc} {self.params.location}!",
f"have been sent out to {bf}{self.art} {self.params.loc_desc} {self.params.location}!",
f"in order to {mission}",
f"but they're challenged by {self.params.fullProblem}!",
f"{note} {secnote}",
@@ -776,7 +778,7 @@ class Campaign:
f"<div id='themission' class='firstrow'>\n"
f" <span class='head'>The Mission</span>\n"
f" <span id='missionloc'>\n"
f" The kobolds have been sent to {self.art} {self.params.loc_desc} {self.params.location}\n"
f" The kobolds have been sent to {bf}{self.art} {self.params.loc_desc} {self.params.location}\n"
f" </span><br>\n"
f" <span id='missiontarget'>\n"
f" in order to {mission}!\n"
@@ -851,6 +853,12 @@ def lpad(s, n, c="0"):
s = c + s
return s

def create_password():
pw = []
for _ in range(84):
pw.append(r.choice(Campaign.ALPHABET))
return "".join(pw)

if __name__ == "__main__":
parser = argparse.ArgumentParser()
group = parser.add_mutually_exclusive_group()
@@ -869,6 +877,7 @@ if __name__ == "__main__":
cmp.print_chars(html=html)
cmp.print_password(html=html)
elif args.campaign:
#cmp = Campaign(fromPW = True, pw=create_password())
cmp = Campaign(args.campaign)
cmp.print_params(html=html)
cmp.print_chars(html=html)

Loading…
Cancel
Save