Browse Source

Change stat generation

master
Noëlle 4 years ago
parent
commit
a138a2ef5d
1 changed files with 44 additions and 28 deletions
  1. 44
    28
      koboldgen.py

+ 44
- 28
koboldgen.py View File

@@ -22,26 +22,6 @@ def gen_name(n=None):
return "".join(morae)


def gen_stats(n):
if n < 4:
print("Too few stat points!")
return [0,0,0,0]
stats = [1,1,1,1]
points = n - 4
slots = [0,1,2,3]
for _ in range(points):
tgl = False
while tgl == False:
slt = r.choice(slots)
if stats[slt] == 6:
continue
if stats[slt] == 5:
if r.randint(0,1) == 1:
continue
stats[slt] += 1
tgl = True
return stats

def gen_career():
return r.choice(["Soldier/Guard","Pilot","Medic","Mechanic","Politician","Spellcaster","Performer","Historian","Spy","Cook","Cartographer"])

@@ -87,8 +67,44 @@ class Character:
def gen_name(self):
self.name = gen_name()

def gen_stats(self):
self.stats = gen_stats(12)
def gen_stats(self, n=12):
if n < 4:
print("Too few stat points!")
return [0,0,0,0]
stats = [0,0,0,0]
points = n
slots = [0,1,2,3]
for _ in range(points):
tgl = False
while tgl == False:
slt = r.choice(slots)
if slt <= 1:
if stats[slt] == 6:
continue
if stats[slt] == 5:
if r.randint(0,1) != 1:
continue
else:
if stats[slt] == 6:
continue
if stats[slt] == 5:
if r.randint(0,3) != 1:
continue
if stats[slt] == 4:
if r.randint(0,2) != 1:
continue
if stats[slt] == 3:
if r.randint(0,1) != 1:
continue
stats[slt] += 1
tgl = True
stats[3] = stats[3] + 2
if stats[3] > 6:
stats[3] = 6
stats[2] = stats[2] + 2
if stats[2] > 6:
stats[2] = 6
self.stats = stats

def gen_career(self):
self.career = gen_career()
@@ -126,11 +142,11 @@ class Campaign:
self.characters.append(c)
self.art = "an" if self.params[1][0] in ["A","E","I","O","U"] else "a"

def print_params(self):
print(f"The Kobolds of the {self.ship.fullname}")
print(f"have been sent out to {self.art} {self.params[0]} {self.params[1]}")
print(f"in order {self.params[2]}")
print(f"but they're challenged by {self.params[3]}!")
def print_params(self, endc=""):
print(f"The Kobolds of the {self.ship.fullname} ", end=endc)
print(f"have been sent out to {self.art} {self.params[0]} {self.params[1]} ", end=endc)
print(f"in order {self.params[2]} ", end=endc)
print(f"-- but they're challenged by {self.params[3]}!")
print()
self.ship.print()

@@ -168,4 +184,4 @@ if __name__ == "__main__":
for _ in range(args.kobolds):
c = Character()
c.generate()
c.print()
c.print()

Loading…
Cancel
Save