From 7e009e473b65a5749392091a0c4776dfddd32bd6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 14:12:27 +0000 Subject: [PATCH 1/2] pf2e 0.12.0: Blessed's Guidance, drawing weapons with Quick Draw, one roll for area Heal - The Blessed background brings Guidance as an innate spell at will, which its text grants and Foundry's rules leave out. The entry hangs off the background, so picking another drops it; staff swap it with +build/uninnate for a GM's other blessing. - A Strike with a carried weapon draws it first: one more action, none with Quick Draw. The encounter remembers what each combatant drew. - A spell whose one roll heals some targets and harms others (three-action Heal on the living and a dhampir) heals by its damage roll instead of rolling healing apart. - Behaviour tests: blessed, quick-draw, heal-area. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01Rqqt7SMSysUs5Y1V7CMGtv --- README.md | 2 +- index.yaml | 2 +- pf2e/package.yaml | 41 +- tests/pf2e/blessed.yaml | 297 ++++++++++++++ tests/pf2e/heal-area.yaml | 438 +++++++++++++++++++++ tests/pf2e/quick-draw.yaml | 336 ++++++++++++++++ tools/pf2e-tests/scenarios/blessed.yaml | 26 ++ tools/pf2e-tests/scenarios/heal-area.yaml | 46 +++ tools/pf2e-tests/scenarios/quick-draw.yaml | 44 +++ 9 files changed, 1222 insertions(+), 10 deletions(-) create mode 100644 tests/pf2e/blessed.yaml create mode 100644 tests/pf2e/heal-area.yaml create mode 100644 tests/pf2e/quick-draw.yaml create mode 100644 tools/pf2e-tests/scenarios/blessed.yaml create mode 100644 tools/pf2e-tests/scenarios/heal-area.yaml create mode 100644 tools/pf2e-tests/scenarios/quick-draw.yaml diff --git a/README.md b/README.md index 97cbdf2..251926b 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,7 @@ The table is generated from [`index.yaml`](index.yaml); edit that file, then run | [`fitd-wiki/`](fitd-wiki/) | 1.1.2 | Wiki pages for the FitD sheet (how to play, making a character, actions and attributes, stress, harm and advancement, encounters, threats, clocks); based on the Blades in the Dark SRD under CC BY 3.0 | | [`brp-wiki/`](brp-wiki/) | 1.1.2 | Wiki pages for the BRP sheet (how to play, making a character, characteristics and skills, hit points, coin and experience, encounters, creatures); ORC Licensed Material | | [`ironsworn-wiki/`](ironsworn-wiki/) | 1.1.2 | Wiki pages for the Ironsworn sheet (how to play, making a character, assets and experience, meters and momentum, vows, encounters, foes); based on the Ironsworn SRD under CC BY 4.0 | -| [`pf2e/`](pf2e/) | 0.11.0 | Pathfinder Second Edition rules read the way Foundry VTT's pf2e system reads them, with ledger character sheets, a character builder, spellcasting, a deity table the game fills, alchemy, encounters with a bestiary, hazards, effects and GM tools, exploration, skill challenges, downtime, loot and shops with unidentified items, audited awards and levels (ORC License) | +| [`pf2e/`](pf2e/) | 0.12.0 | Pathfinder Second Edition rules read the way Foundry VTT's pf2e system reads them, with ledger character sheets, a character builder, spellcasting, a deity table the game fills, alchemy, encounters with a bestiary, hazards, effects and GM tools, exploration, skill challenges, downtime, loot and shops with unidentified items, audited awards and levels (ORC License) | | [`pf2e-portal/`](pf2e-portal/) | 1.0.1 | Joins the Pathfinder 2e rules to the HTTP handler, for the pf2e-app sheet page | | [`pf2e-app/`](pf2e-app/) | 1.0.1 | The Pathfinder 2e sheet as a portal page at /apps/pf2e | | [`pf2e-help/`](pf2e-help/) | 1.0.2 | Puts the Pathfinder 2e topics into +help | diff --git a/index.yaml b/index.yaml index c70e57b..5e2c717 100644 --- a/index.yaml +++ b/index.yaml @@ -190,7 +190,7 @@ packages: - path: pf2e/ name: Pathfinder 2e rules package: pf2e - version: 0.11.0 + version: 0.12.0 description: Pathfinder Second Edition rules read the way Foundry VTT's pf2e system reads them, with ledger character sheets, a character builder, spellcasting, a deity table the game fills, alchemy, encounters with a bestiary, hazards, effects and GM tools, exploration, skill challenges, downtime, loot and shops with unidentified items, audited awards and levels (ORC License) - path: pf2e-portal/ package: pf2e-portal diff --git a/pf2e/package.yaml b/pf2e/package.yaml index 7ee5160..64e716e 100644 --- a/pf2e/package.yaml +++ b/pf2e/package.yaml @@ -1,7 +1,7 @@ format: "1.20" package: pf2e title: Pathfinder 2e rules -version: "0.11.0" +version: "0.12.0" authors: [SharpMUSH] description: "Pathfinder Second Edition rules in softcode, read the way Foundry VTT's pf2e system reads them, with character sheets kept as a ledger: +build, +sheet, +check, spellcasting (+spells, +prepare, +cast, +rest), a deity table the game fills (+deity), alchemy (+alchemy), encounters with effects and battle forms that keep their own copy of each character, built from the bestiary with elite and weak creatures and hazards (+enc), exploration, skill challenges, Recall Knowledge, downtime (+downtime: Earn Income, Crafting, Learn a Spell, Retraining), loot, stashes and shops with unidentified magic items (+loot, +identify), and audited awards with levels and runes (+pf2e/award)." license: MIT @@ -114,7 +114,7 @@ objects: # ledger read again costs a few hundred function calls. The key is the ledger with the package's # version, the books and CACHE`STAMP, which the updater and the deity table change. CACHE lists # the keys oldest first; past DATA`CACHE`KEEP the oldest goes. - DATA`CACHE`VERSION: "0.11.0" + DATA`CACHE`VERSION: "0.12.0" DATA`CACHE`KEEP: 200 DATA`CACHE`REGISTERS: check_actor check_actortraits check_adjstrike check_adjust check_ancestry check_armor check_background check_class check_conditions check_craftgrants check_crafting check_deity check_deity_spells check_deity_weapons check_domopts check_dynamic check_entries check_favored check_favoredrules check_flats check_form check_forms check_formulas check_gear check_grants check_heritage check_index check_itemalts check_level check_martial check_names check_options check_rankdyn check_resgrants check_resources check_rollopts check_rollrules check_shield check_shieldrules check_bulkrules check_bulk check_bulk_enc check_bulk_max check_attrs check_static check_stats check_strikes check_synthetics check_toggles check_traits check_unapplied check_upgrades # The ItemAlteration properties the core applies, by the kind of item they reach. @@ -5480,7 +5480,7 @@ objects: # one goes with everything it brought; a class with one key attribute boosts it at once. INC`BUILD`PICK: value: |- - @include %!/INC`BUILD`GUARD; @include %!/INC`BUILD`PICK`FIND; @include %!/INC`BUILD`BEGIN; @include/nobreak %!/INC`BUILD`CLEAR; @include/nobreak %!/INC`BUILD`FUNDS; think setqm(grant_pack,%q,grant_id,%q,grant_choices,,grant_parent,if(strmatch(%q,heritage),elements(u(%!/FUN`BUILD`GRANT`OF,ancestry),1,~)),grant_step,%q,grant_level,,grant_depth,0); @include %!/INC`BUILD`GRANT; think setq(build_picked,%q); @include/nobreak %!/INC`BUILD`CLASS`KEY; @pemit %#=notice(PF2E,[u(%!/FUN`BUILD`WHO)][capstr(%q)]: [json_query(%q,extract,$.name)].,ok); @wait 0={think u(%!/FUN`BUILD`LOAD); @pemit %#=u(%!/FUN`BUILD`NEXT)} + @include %!/INC`BUILD`GUARD; @include %!/INC`BUILD`PICK`FIND; @include %!/INC`BUILD`BEGIN; @include/nobreak %!/INC`BUILD`CLEAR; @include/nobreak %!/INC`BUILD`FUNDS; think setqm(grant_pack,%q,grant_id,%q,grant_choices,,grant_parent,if(strmatch(%q,heritage),elements(u(%!/FUN`BUILD`GRANT`OF,ancestry),1,~)),grant_step,%q,grant_level,,grant_depth,0); @include %!/INC`BUILD`GRANT; think setq(build_picked,%q); @include/nobreak %!/INC`BUILD`CLASS`KEY; @pemit %#=notice(PF2E,[u(%!/FUN`BUILD`WHO)][capstr(%q)]: [json_query(%q,extract,$.name)].,ok); @include/nobreak %!/INC`BUILD`PICK`INNATE; @wait 0={think u(%!/FUN`BUILD`LOAD); @pemit %#=u(%!/FUN`BUILD`NEXT)} flags: [cmdsyntax] # +build pick: finds the item named in %q in %q (%q, %q), and stops # unless there is exactly one, or the heritage does not fit. @@ -5497,6 +5497,14 @@ objects: value: |- @break cor(not(strmatch(%q,class)),neq(json_query(json_query(%q,extract,$.system.keyAbility.value),size),1)); think setq(entry_json,json(object,kind,"boost",ability,json(string,json_query(%q,extract,$.system.keyAbility.value\[0\])),step,"boost-class",parent,%q)); @include %!/INC`BUILD`PUT flags: [cmdsyntax] + # Innate spells a pick brings that its rules do not, as :~~, |-separated. + # Blessed's text gives Guidance at will, or another blessing the GM chooses: staff take it off with + # +build/uninnate and add theirs. The entry hangs off the pick, so picking another background drops it. + DATA`BUILD`INNATE: "background:Blessed~Guidance~0" + INC`BUILD`PICK`INNATE: + value: |- + think setq(build_innate,grab(v(DATA`BUILD`INNATE),%q:[json_query(%q,extract,$.name)]~*,|)); @break not(strlen(%q)); think setq(build_innate_id,u({{core}}/FUN`ITEM`FIND,spells,elements(%q,2,~))); @break not(strlen(%q)); think setq(entry_json,json(object,kind,"innate",id,json(string,%q),per,elements(%q,3,~),step,json(string,innate-%q),parent,%q)); @include %!/INC`BUILD`PUT; @pemit %#=notice(PF2E,[u(%!/FUN`BUILD`WHO)]Innate spell: [u(%!/FUN`SHOW`SPELLNAME,%q)] %([if(elements(%q,3,~),elements(%q,3,~) a day,at will)]%)%, from [json_query(%q,extract,$.name)].,ok) + flags: [cmdsyntax] DATA`TEMPLATE`INC`BUILD`BOOST: |- {"kind":"","ability":"","step":"","parent":null} # +build/boost =: ancestry, background, class, or a level (1, 5, 10, 15, 20). @@ -8427,9 +8435,22 @@ objects: u(FUN`ACT`ROLL,%q,%q,if(%q,%q),%q [if(%q,%q)])[ u(FUN`ACT`RUNE`DOS)][ u(FUN`ACT`NOTEFX`KEEP)][ - if(t(%q),[u(FUN`ENC`SET,%q,react,1)][setq(spend_warn,)],[u(FUN`ENC`SET,%q,map,inc(u(FUN`ENC`C,%q,map)))][u(FUN`ACTION`SPEND,%q,1)])][ + if(t(%q),[u(FUN`ENC`SET,%q,react,1)][setqm(spend_warn,,strike_drawsay,)],[u(FUN`ENC`SET,%q,map,inc(u(FUN`ENC`C,%q,map)))][u(FUN`ACTION`SPEND,%q,add(1,u(FUN`ACT`STRIKE`DRAW)))])][ setq(strike_crit,cand(eq(%q,3),not(u(FUN`ACT`IMMUNE,%q,critical-hits))))][ - setq(enc_say,[u(FUN`ENC`C,%q,name)] Strikes [u(FUN`ENC`C,%q,name)] with [first(%q,|)][if(t(%q),%bas a reaction)]: [json_query(%q,extract,$.text)][u(FUN`ACT`TAGS)][if(%q,%b%(MAP -%q%))] vs AC [if(cor(%q,strmatch(u(FUN`ENC`C,%q,kind),pc)),%q,?)]: [tone(strong,u(FUN`ACT`DEGREE,%q))][u(FUN`ACT`ADJUSTED)][if(strlen(%q),%b%(%q%, [lcstr(u(FUN`ACT`DEGREE,%q))] rolled%))][if(cand(eq(%q,3),not(%q)),%, but [u(FUN`ENC`C,%q,name)] is immune to critical hits)].[u(FUN`ACT`NOTES)])] + setq(enc_say,%q[u(FUN`ENC`C,%q,name)] Strikes [u(FUN`ENC`C,%q,name)] with [first(%q,|)][if(t(%q),%bas a reaction)]: [json_query(%q,extract,$.text)][u(FUN`ACT`TAGS)][if(%q,%b%(MAP -%q%))] vs AC [if(cor(%q,strmatch(u(FUN`ENC`C,%q,kind),pc)),%q,?)]: [tone(strong,u(FUN`ACT`DEGREE,%q))][u(FUN`ACT`ADJUSTED)][if(strlen(%q),%b%(%q%, [lcstr(u(FUN`ACT`DEGREE,%q))] rolled%))][if(cand(eq(%q,3),not(%q)),%, but [u(FUN`ENC`C,%q,name)] is immune to critical hits)].[u(FUN`ACT`NOTES)])] + flags: [funsyntax] + # A character's Strike with a weapon the sheet carries but does not hold draws it first: an Interact action, + # none with Quick Draw. The combatant's drawn field keeps the item ids of what it has drawn this encounter, so + # the next Strike with it needs no draw. Sets strike_drawsay; 1 when the draw costs an action. + FUN`ACT`STRIKE`DRAW: + value: |- + @@(after FUN`ACT`STRIKE`SETUP for act_at's act_strike)[ + setqm(strike_drawsay,,sd_src,last(%q,|),sd_id,firstof(json_query(last(%q,|),extract,$.id),edit(first(%q,|),%b,_)),sd_drawn,u(FUN`ENC`C,%q,drawn))][ + if(cor(strmatch(%q,npc:*),not(strlen(json_query(%q,extract,$.where))),member(%q,%q)),0, + [u(FUN`ENC`SET,%q,drawn,json(string,trim(%q %q)))][ + setq(sd_quick,t(member(%q,feat:quick-draw)))][ + setq(strike_drawsay,[u(FUN`ENC`C,%q,name)] draws [first(%q,|)][if(%q,%bwith Quick Draw)].%b)][ + not(%q)])] flags: [funsyntax] # Plans the damage for the degree of success and deals it, keeping what a Shield Block needs. FUN`ACT`STRIKE`DAMAGE: @@ -8856,6 +8877,7 @@ objects: setqm(cast_atk,u({{core}}/FUN`CHECK`TOTAL,u({{core}}/FUN`CHECK`SPELL,attack)),cast_dc,add(10,u({{core}}/FUN`CHECK`TOTAL,u({{core}}/FUN`CHECK`SPELL,dc))))] flags: [funsyntax] # The damage and healing rolled once for every target: cast_dmg_parts, cast_dmg_text, cast_heal_n, cast_heal_text, and cast_say. + # A spell whose one roll heals some targets and harms others (spell_both with both left) heals by its damage roll. FUN`CAST`ROLLS: value: |- @@(spell_ registers)[ @@ -8863,7 +8885,10 @@ objects: if(cor(strlen(%q),strlen(%q)), [u({{core}}/FUN`DAMAGE`SPELL,%q,%q,)][u({{core}}/FUN`DAMAGE`FORMULA,2)][u(FUN`ACT`DAMAGE`ROLL)][ setqm(cast_iwropts,squish(%q [if(strlen(json_query(%q,extract,$.area.type)),area-damage)]),cast_dmg_parts,%q,cast_dmg_text,trim(%q),cast_dmg_raw,%q,spell_pers,iter(%q,first(%i0,~),|,%,%b))])][ - if(strlen(%q),[u(FUN`ACT`DAMAGE,%q,0)][setqm(cast_heal_n,%q,cast_heal_text,trim(%q))])][ + if(strlen(%q), + if(cand(%q,words(%q,|)), + setqm(cast_heal_n,elements(first(%q,|),2,~),cast_heal_text,[elements(first(%q,|),2,~)] from the same roll), + [u(FUN`ACT`DAMAGE,%q,0)][setqm(cast_heal_n,%q,cast_heal_text,trim(%q))]))][ setq(cast_say,trim(squish([if(%q,Spell attack [u(FUN`SHOW`SIGNED,%q)].)] [if(strlen(%q),DC %q [if(%q,basic%b)][capstr(%q)].)] [if(strlen(%q),Damage %q[if(gt(words(%q,|),1),%b= %q)].)] [if(strlen(%q),Persistent %q.)] [if(strlen(%q),Healing %q.)])))] flags: [funsyntax] FUN`CAST`HEAD: @@ -10899,7 +10924,7 @@ objects: - `+build/choose =