triggers data and YAML->SQL working
parent
df2bdacc56
commit
1eb2de17e3
|
@ -82,6 +82,34 @@ def main():
|
|||
data = yaml.full_load(yl)
|
||||
do_requirements(data, conn)
|
||||
|
||||
# move on to triggers
|
||||
with open('triggers.yaml') as yl:
|
||||
data = yaml.full_load(yl)
|
||||
do_triggers(data, conn)
|
||||
|
||||
def do_triggers(data, conn):
|
||||
table = """
|
||||
CREATE TABLE trigger (
|
||||
trigger_id INTEGER PRIMARY KEY,
|
||||
descr TEXT NOT NULL UNIQUE
|
||||
);
|
||||
"""
|
||||
|
||||
c = conn.cursor()
|
||||
c.execute(table)
|
||||
|
||||
inp_data = []
|
||||
for i in data['trigger']:
|
||||
inp_data.append((i, ))
|
||||
|
||||
stmt = "INSERT INTO trigger (descr) VALUES (?)"
|
||||
try:
|
||||
conn.executemany(stmt, inp_data)
|
||||
except Exception as e:
|
||||
print("Error creating trigger: {}".format(e))
|
||||
else:
|
||||
conn.commit()
|
||||
|
||||
def do_requirements(data, conn):
|
||||
table = """
|
||||
CREATE TABLE requirement (
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
trigger:
|
||||
- An ally ends a move action adjacent to you.
|
||||
- You fail a skill check or saving throw.
|
||||
- You attempt a check using a skill you’re untrained in.
|
||||
- You would be reduced to 0 Hit Points but not immediately killed.
|
||||
- You attempt a saving throw against a spell or magical effect, before rolling.
|
||||
- You bring a foe to 0 Hit Points.
|
||||
- You use Quick Alchemy to craft an alchemical bomb with a level at least 1 lower than your advanced alchemy level.
|
||||
- You use Quick Alchemy to craft an alchemical item that has the elixer trait and is at least 2 levels lower than your advanced alchemy level.
|
||||
- You use Quick Alchemy to craft an alchemical bomb that is at least 2 levels lower than your advanced alchemy level.
|
||||
- You craft an elixer of life using Quick Alchemy, and that elixir is at least 2 levels lower than your advanced alchemy level.
|
||||
- You craft an alchemical bomb using Quick Alchemy that’s at least 2 levels lower than your advanced alchemy level.
|
||||
- A foe within reach attempts to move away from you.
|
||||
- You take damage and are capable of entering a rage.
|
||||
- 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.
|
||||
- Your melee Strike kills a creature or knocks it unconscious, and another foe is adjacent to that creature.
|
||||
- A creature within your reach succeeds or critically succeeds at an attack against you.
|
||||
- Your turn begins, and you are at half or fewer Hit Points.
|
||||
- You fail or critically fail an attack roll or Will save.
|
||||
- You attempt a save against a spell, before you roll.
|
||||
- "A foe's attack against an ally matches the trigger for both your Shield Block reaction and your champion's reaction."
|
||||
- You finish Casting a Spell using one of your divine spell slots on your turn.
|
||||
- You critically hit a creature that is not on its home plane.
|
||||
- An opponent adjacent to you critically hits you with a melee weapon or melee unarmed attack.
|
||||
- An enemy hits you with a melee Strike.
|
||||
- You use the Shield Block reaction, and the opponent that triggered Shield Block is adjacent to you and is your size or smaller.
|
||||
- An ally within your melee reach is hit by an attack, you can see the attacker, and the ally gaining a +2 circumstance bonus to AC would turn the critical hit into a hit or the hit into a miss.
|
||||
- A creature within your reach critically fails a Strike against you.
|
||||
- An opponent casting a spell that targets you critically fails a speel attack roll against your AC.
|
||||
- You complete the last action on your turn, and your turn has not ended yet.
|
||||
- You roll initiative.
|
||||
- You are the target of a physical ranged attack.
|
||||
- "A creature within your reach uses a move action or leaves a square during a move action it's using."
|
||||
- You are targeted with a melee attack by an attacker you can see.
|
||||
- Your turn ends and you have a status penalty to your Speed or are immobilized or slowed.
|
||||
- "An enemy's attack hits you or you fail a saving throw against an enemy’s ability."
|
||||
- "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."
|
||||
- You are about to roll a Perception or Survival check for initiative.
|
||||
- You fail a check to Seek.
|
||||
- A creature targets you with an attack and you can see the attacker.
|
||||
- You reduce an enemy to 0 hit points.
|
||||
- An adjacent foe moves away from you, and you can reach at least one space adjacent to the foe with a Stride action.
|
||||
- A trap within your reach is triggered.
|
||||
- A creature within your melee reach is hit by a melee attack from one of your allies.
|
||||
- The attack roll for a Strike targeting you fails or critically fails.
|
||||
- An adjacent enemy begins to use a reaction.
|
||||
- A physical attack would reduce you to 0 Hit Points.
|
||||
- Your turn ends.
|
||||
- You specify the trigger when your daily preparations(see Requirements).
|
||||
- You successfully use Stealth to Hide and become hidden from all of your current foes, or use Stealth to Sneak and become undetected to all your current foes.
|
||||
- "You would be hit by an attack or targeted by an effect, or you are within an effect's area."
|
||||
- A creature casts a spell that you have in your repertoire.
|
||||
- A creature Casts a Spell that you have prepared.
|
||||
- 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 must be aware of the casting.
|
||||
- While you have your shield raised, you would take damage from a physical attack.
|
Loading…
Reference in New Issue