working on triggers in feats, cleanyaml updates to triggers
parent
83e45e6c68
commit
a691f5c994
|
@ -29,6 +29,10 @@ def main():
|
||||||
# print("Before: {}".format(i['requirement']))
|
# print("Before: {}".format(i['requirement']))
|
||||||
i['requirement'] = i['requirement'].replace('’', "'")
|
i['requirement'] = i['requirement'].replace('’', "'")
|
||||||
# print("After: {}".format(i['requirement']))
|
# print("After: {}".format(i['requirement']))
|
||||||
|
if i['trigger'] != None:
|
||||||
|
# print("Before: {}".format(i['trigger']))
|
||||||
|
i['trigger'] = i['trigger'].replace('’', "'")
|
||||||
|
# print("After: {}".format(i['trigger']))
|
||||||
final = yaml.safe_dump(data, allow_unicode=True)
|
final = yaml.safe_dump(data, allow_unicode=True)
|
||||||
with open(x, 'w') as f:
|
with open(x, 'w') as f:
|
||||||
f.write(final)
|
f.write(final)
|
||||||
|
|
|
@ -40,8 +40,8 @@ feat:
|
||||||
page_start: 35
|
page_start: 35
|
||||||
page_stop: 35
|
page_stop: 35
|
||||||
traits: null
|
traits: null
|
||||||
trigger:
|
trigger: You attempt a saving throw against a magical effect, but you haven't rolled
|
||||||
- You attempt a saving throw against a magical effect, but you haven't rolled yet.
|
yet.
|
||||||
- actioncost: null
|
- actioncost: null
|
||||||
descr: You eagerly absorbed the old stories and traditions of your ancestors, your
|
descr: You eagerly absorbed the old stories and traditions of your ancestors, your
|
||||||
gods, and your people, studying in subjects and techniques passed down for generation
|
gods, and your people, studying in subjects and techniques passed down for generation
|
||||||
|
@ -1639,7 +1639,7 @@ feat:
|
||||||
page_stop: 57
|
page_stop: 57
|
||||||
traits:
|
traits:
|
||||||
- Human
|
- Human
|
||||||
trigger: You attempt a check using a skill you’re untrained in.
|
trigger: You attempt a check using a skill you're untrained in.
|
||||||
- actioncost: null
|
- actioncost: null
|
||||||
descr: You’ve learned to split your focus between multiple classes with ease. You
|
descr: You’ve learned to split your focus between multiple classes with ease. You
|
||||||
gain a 2nd-level multiclass dedication feat (for more about multiclass archetypes,
|
gain a 2nd-level multiclass dedication feat (for more about multiclass archetypes,
|
||||||
|
@ -2558,7 +2558,7 @@ feat:
|
||||||
traits:
|
traits:
|
||||||
- Additive
|
- Additive
|
||||||
- Alchemist
|
- Alchemist
|
||||||
trigger: You craft an alchemical bomb using Quick Alchemy that’s at least 2 levels
|
trigger: You craft an alchemical bomb using Quick Alchemy that's at least 2 levels
|
||||||
lower than your advanced alchemy level.
|
lower than your advanced alchemy level.
|
||||||
- actioncost: null
|
- actioncost: null
|
||||||
descr: Specialized tweaks to your formula that supplements your genius considerably
|
descr: Specialized tweaks to your formula that supplements your genius considerably
|
||||||
|
@ -3086,7 +3086,7 @@ feat:
|
||||||
traits:
|
traits:
|
||||||
- Barbarian
|
- Barbarian
|
||||||
trigger: A creature within your reach uses a manipulate action or a move action,
|
trigger: A creature within your reach uses a manipulate action or a move action,
|
||||||
makes a ranged attack, or leaves a square during a move action it’s using.
|
makes a ranged attack, or leaves a square during a move action it's using.
|
||||||
- actioncost: null
|
- actioncost: null
|
||||||
descr: You push your foes around and leave bruises. While raging, when you successfully
|
descr: You push your foes around and leave bruises. While raging, when you successfully
|
||||||
Disarm, Grapple, Shove, or Trip a foe, you deal that foe bludgeoning damage equal
|
Disarm, Grapple, Shove, or Trip a foe, you deal that foe bludgeoning damage equal
|
||||||
|
@ -5125,8 +5125,8 @@ feat:
|
||||||
traits:
|
traits:
|
||||||
- Champion
|
- Champion
|
||||||
- Flourish
|
- Flourish
|
||||||
trigger: A foe’s attack against an ally matches the trigger for both your Shield
|
trigger: A foe's attack against an ally matches the trigger for both your Shield
|
||||||
Block reaction and your champion’s reaction.
|
Block reaction and your champion's reaction.
|
||||||
- actioncost: null
|
- actioncost: null
|
||||||
descr: The divine grace that flows through you grants reprieve from an affliction.
|
descr: The divine grace that flows through you grants reprieve from an affliction.
|
||||||
When you use Mercy, you can instead attempt to counteract a curse, disease, or
|
When you use Mercy, you can instead attempt to counteract a curse, disease, or
|
||||||
|
@ -9244,7 +9244,7 @@ feat:
|
||||||
traits:
|
traits:
|
||||||
- Monk
|
- Monk
|
||||||
trigger: A creature within your reach uses a move action or leaves a square during
|
trigger: A creature within your reach uses a move action or leaves a square during
|
||||||
a move action it’s using.
|
a move action it's using.
|
||||||
- actioncost: null
|
- actioncost: null
|
||||||
descr: You can restore your health by tapping into your ki. You gain the wholeness
|
descr: You can restore your health by tapping into your ki. You gain the wholeness
|
||||||
of body ki spell. Increase the number of Focus Points in your focus pool by 1.
|
of body ki spell. Increase the number of Focus Points in your focus pool by 1.
|
||||||
|
@ -10089,7 +10089,7 @@ feat:
|
||||||
traits:
|
traits:
|
||||||
- Fortune
|
- Fortune
|
||||||
- Monk
|
- Monk
|
||||||
trigger: An enemy’s attack hits you or you fail a saving throw against an enemy’s
|
trigger: An enemy's attack hits you or you fail a saving throw against an enemy's
|
||||||
ability.
|
ability.
|
||||||
- actioncost: null
|
- actioncost: null
|
||||||
descr: You gain the service of a young animal companion that travels with you and
|
descr: You gain the service of a young animal companion that travels with you and
|
||||||
|
@ -10333,7 +10333,7 @@ feat:
|
||||||
traits:
|
traits:
|
||||||
- Ranger
|
- Ranger
|
||||||
trigger: Your hunted prey is within your reach, and it uses a manipulate action,
|
trigger: Your hunted prey is within your reach, and it uses a manipulate action,
|
||||||
uses a move action, or leaves a square during a move action it’s using.
|
uses a move action, or leaves a square during a move action it's using.
|
||||||
- actioncost: null
|
- actioncost: null
|
||||||
descr: Your experience in the field has taught you how to focus your aim at a distance,
|
descr: Your experience in the field has taught you how to focus your aim at a distance,
|
||||||
increasing your accuracy. Double your weapons’ range increments.
|
increasing your accuracy. Double your weapons’ range increments.
|
||||||
|
@ -12282,7 +12282,7 @@ feat:
|
||||||
- Manipulate
|
- Manipulate
|
||||||
- Rogue
|
- Rogue
|
||||||
trigger: You would be hit by an attack or targeted by an effect, or you are within
|
trigger: You would be hit by an attack or targeted by an effect, or you are within
|
||||||
an effect’s area.
|
an effect's area.
|
||||||
- actioncost: Reaction
|
- actioncost: Reaction
|
||||||
descr: When a foe Casts a Spell you know and you can see its manifestations, you
|
descr: When a foe Casts a Spell you know and you can see its manifestations, you
|
||||||
can use your own magic to disrupt it. You expend one of your spell slots to counter
|
can use your own magic to disrupt it. You expend one of your spell slots to counter
|
||||||
|
@ -16836,7 +16836,7 @@ feat:
|
||||||
- General
|
- General
|
||||||
- Secret
|
- Secret
|
||||||
- Skill
|
- Skill
|
||||||
trigger: A creature within line of sight casts a spell that you don’t have prepared
|
trigger: A creature within line of sight casts a spell that you don't have prepared
|
||||||
or in your spell repertoire, or a trap or similar object casts such a spell. You
|
or in your spell repertoire, or a trap or similar object casts such a spell. You
|
||||||
must be aware of the casting.
|
must be aware of the casting.
|
||||||
- actioncost: null
|
- actioncost: null
|
||||||
|
|
|
@ -174,14 +174,31 @@ def do_feats(data, conn):
|
||||||
r_id = None
|
r_id = None
|
||||||
else:
|
else:
|
||||||
r_id = get_requirement_id_by_descr(i['requirement'], conn)
|
r_id = get_requirement_id_by_descr(i['requirement'], conn)
|
||||||
# print("f_id for {} is {}".format(i['frequency'], f_id))
|
if i['trigger'] == None:
|
||||||
|
t_id = None
|
||||||
|
else:
|
||||||
|
t_id = get_trigger_id_by_descr(i['trigger'], conn)
|
||||||
|
|
||||||
# res = (ac_id, i['descr'], f_id, i['level'], i['name'], r_id, t_id)
|
# res = (ac_id, i['descr'], f_id, i['level'], i['name'], r_id, t_id)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
insert_stmt = "INSERT INTO feat (actioncost_id, descr, freq_id, level, name, requirement_id, trigger_id) VALUES (?,?,?,?,?,?,?);"
|
insert_stmt = "INSERT INTO feat (actioncost_id, descr, freq_id, level, name, requirement_id, trigger_id) VALUES (?,?,?,?,?,?,?);"
|
||||||
|
|
||||||
|
def get_trigger_id_by_descr(t, conn):
|
||||||
|
qstmt = "SELECT trigger_id FROM trigger WHERE descr=?;"
|
||||||
|
try:
|
||||||
|
c = conn.cursor()
|
||||||
|
c.execute(qstmt, (t,))
|
||||||
|
except sqlite3.Error as e:
|
||||||
|
print("Error getting an trigger_id by name: {} Error: {}".format(t, e))
|
||||||
|
except:
|
||||||
|
print("Error getting an trigger_id_by_name something other than sqlite3 error")
|
||||||
|
else:
|
||||||
|
x = c.fetchone()
|
||||||
|
if x == None:
|
||||||
|
raise AssertionError('there was no trigger_id for given trigger name: {}\nYou should check to see if this trigger is in triggers.yaml and sometimes it is a straight apostrophe versus uni-code curly apostrophe.'.format(t))
|
||||||
|
else:
|
||||||
|
return x[0]
|
||||||
|
|
||||||
def get_requirement_id_by_descr(r, conn):
|
def get_requirement_id_by_descr(r, conn):
|
||||||
qstmt = "SELECT requirement_id FROM requirement WHERE descr=?;"
|
qstmt = "SELECT requirement_id FROM requirement WHERE descr=?;"
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue