fix some data, and have heritages except the feat working

bradl/monsters-adult-gold-dragon
James Miller 2020-04-20 21:57:12 -05:00
parent 13d1289481
commit 8dfd8c0a26
2 changed files with 57 additions and 20 deletions

View File

@ -90,13 +90,6 @@ ancestries:
Climb). This doesnt affect you if youre using a climb Speed. Climb). This doesnt affect you if youre using a climb Speed.
feat: null feat: null
name: Woodland Elf name: Woodland Elf
- &id001
descr: Either one of your parents was an elf, or one or both were half-elves.
You have pointed ears and other telltale signs of elf heritage. You gain the
elf trait and low-light vision. In addition, you can select elf, half-elf, and
human feats whenever you gain an ancestry feat.
feat: null
name: Half-Elf
hp: 6 hp: 6
name: Elf name: Elf
senses: Low-Light Vision senses: Low-Light Vision
@ -274,7 +267,30 @@ ancestries:
- Free2 - Free2
flavor_text: TODO flavor_text: TODO
flaws: null flaws: null
heritages: [] heritages:
- descr: Either one of your parents was an elf, or one or both were half-elves. You
have pointed ears and other telltale signs of elf heritage. You gain the elf trait
and low-light vision. In addition, you can select elf, half-elf, and human feats
whenever you gain an ancestry feat.
feat: null
name: Half-Elf
- descr: One of your parents was an orc, or one or both were half-orcs. You have a
green tinge to your skin and other indicators of orc heritage. You gain the orc
trait and low-light vision. In addition, you can select orc, half-orc, and human
feats whenever you gain an ancestry feat.
feat: null
name: Half-Orc
- descr: Your ingenuity allows you to train in a wide variety of skills. You become
trained in one skill of your choice. At 5th level, you become an expert in the
chosen skill.
feat: null
name: Skilled Heritage
- descr: Humanitys versatility and ambition have fueled its ascendance to be the
most common ancestry in most nations throughout the world. Select a general feat
of your choice for which you meet the prerequisites (as with your ancestry feat,
you can select this general feat at any point during character creation).
feat: null
name: Versatile Heritage
hp: 8 hp: 8
name: Human name: Human
senses: None senses: None
@ -290,8 +306,7 @@ ancestries:
- boosts: null - boosts: null
flavor_text: TODO flavor_text: TODO
flaws: null flaws: null
heritages: heritages: []
- *id001
hp: 8 hp: 8
name: Half-Elf name: Half-Elf
senses: None senses: None
@ -309,13 +324,7 @@ ancestries:
- boosts: null - boosts: null
flavor_text: TODO flavor_text: TODO
flaws: null flaws: null
heritages: heritages: []
- descr: One of your parents was an orc, or one or both were half-orcs. You have
a green tinge to your skin and other indicators of orc heritage. You gain the
orc trait and low-light vision. In addition, you can select orc, half-orc, and
human feats whenever you gain an ancestry feat.
feat: null
name: Half-Orc
hp: 8 hp: 8
name: Half-Orc name: Half-Orc
senses: None senses: None

View File

@ -120,16 +120,44 @@ def main():
data = yaml.full_load(yl) data = yaml.full_load(yl)
do_ammo(data, conn) do_ammo(data, conn)
# move on to ammo
with open('gear.yaml') as yl: with open('gear.yaml') as yl:
data = yaml.full_load(yl) data = yaml.full_load(yl)
do_gear(data, conn) do_gear(data, conn)
# move on to ammo with open('ancestriesheritages.yaml') as yl:
with open('ancestries.yaml') as yl:
data = yaml.full_load(yl) data = yaml.full_load(yl)
do_ancestries(data, conn) do_ancestries(data, conn)
with open('ancestriesheritages.yaml') as yl:
data = yaml.full_load(yl)
do_heritages(data, conn)
def do_heritages(data, conn):
table = """
CREATE TABLE heritages (
heritage_id INTEGER PRIMARY KEY,
name TEXT NOT NULL UNIQUE,
descr TEXT NOT NULL,
ancestry_id INTEGER NOT NULL, -- many to one relationship
FOREIGN KEY (ancestry_id) REFERENCES ancestries(ancestry_id)
);
"""
c = conn.cursor()
c.execute(table)
for i in data['ancestries']:
#GET ID OF ANCESTRY
stmt = "SELECT ancestry_id FROM ancestries WHERE name=?;"
c.execute(stmt, (i['name'],))
rowid = c.fetchone()
#FOR EACH HERITAGE, INSERT INTO TABLE USING ANCESTRY ID
for j in i['heritages']:
print("doing this heritage: {}".format(j['name']))
stmt = "INSERT INTO heritages (name, descr, ancestry_id) VALUES (?,?,?);"
c.execute(stmt, (j['name'], j['descr'], rowid[0]))
conn.commit()
def do_ancestries(data, conn): def do_ancestries(data, conn):
# create tables # create tables