-
-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Refine the PF2e creature layout
Thank you to MostTornBrain for valuable feedback! Most of this comes from there :) - Fix traits only showing when the trait property was present (even if alignment, size, or rarity was present) - Add sign (+/-) to perception modifier - Move Weaknesses before Resistances to match book layout - Don't show Initiative Tracker encounter buttons if Initiative Tracker isn't enabled - Show the initiative tracker view when the encounter buttons are pressed, to match the functionality of encounter buttons in the actual encounter blocks - Bold save names - Add sign (+/-) to ability modifiers
- Loading branch information
Showing
3 changed files
with
62 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"blocks":[{"type":"inline","id":"e9b8483aeafa","properties":[],"nested":[{"type":"property","id":"2b596a6919fb","properties":["name"],"fallback":"-","markdown":true,"dice":false,"conditioned":true,"display":" "},{"type":"inline","id":"499aea6a9aca","properties":[],"nested":[{"type":"action","id":"8a6a7a499b78","icon":"sword","callback":"try { InitiativeTracker.newEncounter({roll: true, creatures: [monster]}); } catch(e) {}"},{"type":"action","id":"fbea380b09b9","icon":"plus-with-circle","callback":"try { InitiativeTracker.addCreatures([monster]); } catch(e) {}"}]},{"type":"property","id":"98389a48f808","properties":["level"],"fallback":"-","display":" ","conditioned":true,"markdown":true,"dice":false}],"hasRule":true},{"type":"group","id":"4b3a6809a938","properties":[],"nested":[{"type":"property","id":"0979a989583a","properties":["traits"],"fallback":"-","callback":"if (!monster.traits) return \"\";\nvar s = \"\"\nif (monster.rarity) {\n s += `- <span class=\"rarity ${monster.rarity.toLowerCase()}\">${monster.rarity}</span>\\n`\n}\nif (monster.alignment) {\n s += `- <span class=alignment>${monster.alignment}</span>\\n`\n}\nif (monster.size) {\n s += `- <span class=size>${monster.size}</span>\\n`\n}\nfor (const text of monster.traits) {\n s += `- ${text}\\n`\n}\nreturn s;","conditioned":true,"display":""}],"hasRule":true,"cls":"pf2e-traits"},{"type":"group","id":"5999ea79ca3b","properties":[],"nested":[{"type":"inline","id":"881859197838","properties":[],"nested":[{"type":"property","id":"4ad9f92ab8f8","properties":["modifier"],"fallback":"-","display":"Perception","conditioned":false,"dice":false,"diceCallback":"return [\"+\" + property, \" (\", { text: \"1d20+\" + property }, \")\"]"},{"type":"property","id":"8bd82998dadb","properties":["senses"],"fallback":"-","conditioned":true,"display":""}],"cls":"oneline","conditioned":true},{"type":"property","id":"ba28f9384918","properties":["languages"],"fallback":"-","display":"Language","conditioned":true,"markdown":true},{"type":"inline","id":"db1a38ebcb6b","properties":[],"nested":[{"type":"saves","id":"6a2b78099b0b","properties":["skills"],"fallback":"-","display":"Skills","conditioned":true,"dice":true},{"type":"property","id":"2b987aead8ab","properties":["skillsNote"],"fallback":"-","conditioned":true,"display":""}],"heading":"","cls":"oneline","conditioned":true},{"type":"table","id":"b82b0a1a9969","properties":["abilityMods"],"headers":["Str","Dex","Con","Int","Wis","Cha"],"calculate":false,"fallback":"-","conditioned":true,"dice":false},{"type":"property","id":"1b6a98ba4888","properties":["items"],"fallback":"-","display":"Items","conditioned":true},{"type":"traits","id":"e96ba9d8a80a","properties":["abilities_top"],"fallback":"-","conditioned":true,"dice":true,"markdown":true,"heading":" ","hasRule":false}],"hasRule":true},{"type":"group","id":"faaa08993a98","properties":[],"nested":[{"type":"inline","id":"3a5ab84a2b89","properties":[],"nested":[{"type":"inline","id":"cb6a7809aa2b","properties":[],"nested":[{"type":"property","id":"6b0b0bda0a7a","properties":["ac"],"fallback":"-","display":"AC"},{"type":"property","id":"0908aaab3b1b","properties":["acNote"],"fallback":"-","conditioned":true,"display":""}],"cls":"withnote","conditioned":true},{"type":"saves","id":"9999386a58ea","properties":["saves"],"fallback":"-","dice":true,"display":"","conditioned":true},{"type":"property","id":"69aa5a7b196a","properties":["savesNote"],"fallback":"-","display":"","conditioned":true}],"cls":"oneline","conditioned":true},{"type":"inline","id":"ea29d9ea5aa8","properties":[],"nested":[{"type":"inline","id":"39584be95ae9","properties":[],"nested":[{"type":"property","id":"bb6989092939","properties":["hp"],"fallback":"-","display":"HP"},{"type":"property","id":"b9fa1a89c8d9","properties":["hpNote"],"fallback":"-","doNotAddClass":false,"conditioned":true,"display":""}],"cls":"withnote","conditioned":true},{"type":"property","id":"4bbaa9380a9b","properties":["hardness"],"fallback":"-","display":"Hardness","conditioned":true},{"type":"property","id":"0a8ac8d96bba","properties":["immunities"],"fallback":"-","conditioned":true,"display":"Immunities"},{"type":"property","id":"8b7a3b89fa59","properties":["resistances"],"fallback":"-","conditioned":true,"display":"Resistances"},{"type":"property","id":"78689b6b6b79","properties":["weaknesses"],"fallback":"-","conditioned":true,"display":"Weaknesses"}],"cls":"oneline","conditioned":true},{"type":"traits","id":"ca2bf968987b","properties":["abilities_mid"],"fallback":"-","heading":"","conditioned":true,"dice":true,"markdown":true,"hasRule":false}],"hasRule":true},{"type":"group","id":"cbeabaf93b58","properties":[],"nested":[{"type":"property","id":"0b4809ba0b29","properties":["speed"],"fallback":"-","display":"Speed","conditioned":true,"markdown":true,"dice":false},{"type":"traits","id":"882bc9aa0898","properties":["attacks"],"fallback":"-","conditioned":true,"dice":true,"markdown":true,"headingProp":false,"heading":"","callback":"var s = property.bonus < 0 ? \"-\" : \"+\";\ns += Math.abs(property.bonus);\nif (property.desc) {\n s += \" \" + property.desc\n}\nif (property.damage) {\n s += \", __Damage__ \" + property.damage\n}\nreturn s"},{"type":"traits","id":"faeafb7b6b1b","properties":["spellcasting"],"fallback":"-","conditioned":true,"dice":true,"callback":"const stats = [];\nif (property.dc) {\n stats.push(`DC ${property.dc}`)\n}\nif (property.attack) {\n const sign = property.attack < 0 ? \"-\" : \"+\";\n stats.push(`attack ${sign}${Math.abs(property.attack)}`)\n}\n\nconst s = [];\nif (stats) s.push(stats.join(\", \"));\nif (property.desc) s.push(property.desc)\n\nreturn s.join(\"; \")"},{"type":"traits","id":"aacb399a3b58","properties":["abilities_bot"],"fallback":"-","conditioned":true,"dice":true,"markdown":true,"hasRule":false}],"hasRule":true},{"type":"text","id":"1b195a894b58","properties":["token"],"text":null,"fallback":"","heading":"Show to Players","conditioned":true,"markdown":true},{"type":"image","id":"1bba89582b29","properties":["token"],"fallback":"","conditioned":true,"hasRule":true},{"type":"property","id":"88e97a485b79","properties":["sourcebook"],"fallback":"-","conditioned":true,"markdown":true,"dice":false,"display":" Source:"}],"name":"Pathfinder 2e Creature Layout","id":"29280b089ad8","diceParsing":[{"regex":"(\\s|^)(\\d+d\\d+(?:\\s*[+-]\\s*\\d+)?)(\\W|$)","parser":"const [, before, text, after] = matches;\nreturn [before + text, \" (\", { text }, \")\", after];","id":"4a79397b896a","desc":"1d6+10"},{"regex":"(^|\\s)([+-]\\d+)(\\W|$)(?!status|bonus)","parser":"let [, before, bonus, after] = matches;\nreturn [\n before + bonus,\n \" (\", { text: \"1d20\" + bonus }, \")\",\n after\n];","id":"8bb8fbbb0869","desc":"+15"}]} | ||
{"blocks":[{"type":"inline","id":"e9b8483aeafa","properties":[],"nested":[{"type":"property","id":"2b596a6919fb","properties":["name"],"fallback":"-","markdown":true,"dice":false,"conditioned":true,"display":" "},{"type":"ifelse","id":"badbdb298988","conditions":[{"nested":[{"type":"group","id":"990a4a988ae8","properties":[],"nested":[{"type":"inline","id":"499aea6a9aca","properties":[],"nested":[{"type":"action","id":"8a6a7a499b78","icon":"sword","callback":"(async() => {\n if (!InitiativeTracker.plugin.view) {\n await InitiativeTracker.plugin.addTrackerView();\n }\n InitiativeTracker.newEncounter({\n roll: true,\n creatures: [monster]\n });\n if (InitiativeTracker.plugin.view) {\n InitiativeTracker.plugin\n .app\n .workspace\n .revealLeaf(InitiativeTracker.plugin.view.leaf);\n }\n})();"},{"type":"action","id":"fbea380b09b9","icon":"plus-with-circle","callback":"(async() => {\n if (!InitiativeTracker.plugin.view) {\n await InitiativeTracker.plugin.addTrackerView();\n }\n InitiativeTracker.addCreatures([monster]);\n if (InitiativeTracker.plugin.view) {\n InitiativeTracker.plugin\n .app\n .workspace\n .revealLeaf(InitiativeTracker.plugin.view.leaf);\n }\n})();"}]}]}],"condition":"return plugin.app.plugins.enabledPlugins.has(\"initiative-tracker\");\n"}]},{"type":"property","id":"98389a48f808","properties":["level"],"fallback":"-","display":" ","conditioned":true,"markdown":true,"dice":false}],"hasRule":true},{"type":"group","id":"4b3a6809a938","properties":[],"nested":[{"type":"property","id":"0979a989583a","properties":[],"fallback":"-","callback":"const traits = []\nif (monster.rarity && monster.rarity.toLowerCase() !== \"common\") {\n traits.push(`<span class=\"rarity ${monster.rarity.toLowerCase()}\">${monster.rarity}</span>`);\n}\n\nif (monster.alignment) {\n traits.push(`<span class=alignment>${monster.alignment}</span>`);\n}\nif (monster.size) {\n traits.push(`<span class=size>${monster.size}</span>`);\n}\n\nif (monster.traits) {\n traits.push(...monster.traits);\n}\n\nreturn traits ? (\"- \" + traits.join(\"\\n- \")) : \"\";","conditioned":true,"display":""}],"hasRule":true,"cls":"pf2e-traits"},{"type":"group","id":"5999ea79ca3b","properties":[],"nested":[{"type":"inline","id":"881859197838","properties":[],"nested":[{"type":"property","id":"4ad9f92ab8f8","properties":["modifier"],"fallback":"-","display":"Perception","conditioned":false,"dice":false,"diceCallback":"const num = (property < 0 ? \"-\" : \"+\") + Math.abs(property);\nreturn [num, \" (\", { text: \"1d20\"+num }, \")\"];","callback":"return (monster.modifier < 0 ? \"-\" : \"+\") + Math.abs(monster.modifier);"},{"type":"property","id":"8bd82998dadb","properties":["senses"],"fallback":"-","conditioned":true,"display":""}],"cls":"oneline","conditioned":true},{"type":"property","id":"ba28f9384918","properties":["languages"],"fallback":"-","display":"Language","conditioned":true,"markdown":true},{"type":"inline","id":"db1a38ebcb6b","properties":[],"nested":[{"type":"saves","id":"6a2b78099b0b","properties":["skills"],"fallback":"-","display":"Skills","conditioned":true,"dice":true},{"type":"property","id":"2b987aead8ab","properties":["skillsNote"],"fallback":"-","conditioned":true,"display":""}],"heading":"","cls":"oneline","conditioned":true},{"type":"table","id":"b82b0a1a9969","properties":["abilityMods"],"headers":["Str","Dex","Con","Int","Wis","Cha"],"calculate":true,"fallback":"-","conditioned":true,"dice":false,"modifier":"stat","doNotAddClass":false},{"type":"property","id":"1b6a98ba4888","properties":["items"],"fallback":"-","display":"Items","conditioned":true},{"type":"traits","id":"e96ba9d8a80a","properties":["abilities_top"],"fallback":"-","conditioned":true,"dice":true,"markdown":true,"heading":" ","hasRule":false}],"hasRule":true},{"type":"group","id":"faaa08993a98","properties":[],"nested":[{"type":"inline","id":"3a5ab84a2b89","properties":[],"nested":[{"type":"inline","id":"cb6a7809aa2b","properties":[],"nested":[{"type":"property","id":"6b0b0bda0a7a","properties":["ac"],"fallback":"-","display":"AC"},{"type":"property","id":"0908aaab3b1b","properties":["acNote"],"fallback":"-","conditioned":true,"display":""}],"cls":"withnote","conditioned":true},{"type":"saves","id":"9999386a58ea","properties":["saves"],"fallback":"-","dice":true,"display":"","conditioned":true},{"type":"property","id":"69aa5a7b196a","properties":["savesNote"],"fallback":"-","display":"","conditioned":true}],"cls":"oneline ac-saves","conditioned":true},{"type":"inline","id":"ea29d9ea5aa8","properties":[],"nested":[{"type":"inline","id":"39584be95ae9","properties":[],"nested":[{"type":"property","id":"bb6989092939","properties":["hp"],"fallback":"-","display":"HP"},{"type":"property","id":"b9fa1a89c8d9","properties":["hpNote"],"fallback":"-","doNotAddClass":false,"conditioned":true,"display":""}],"cls":"withnote","conditioned":true},{"type":"property","id":"4bbaa9380a9b","properties":["hardness"],"fallback":"-","display":"Hardness","conditioned":true},{"type":"property","id":"0a8ac8d96bba","properties":["immunities"],"fallback":"-","conditioned":true,"display":"Immunities"},{"type":"property","id":"78689b6b6b79","properties":["weaknesses"],"fallback":"-","conditioned":true,"display":"Weaknesses"},{"type":"property","id":"8b7a3b89fa59","properties":["resistances"],"fallback":"-","conditioned":true,"display":"Resistances"}],"cls":"oneline","conditioned":true},{"type":"traits","id":"ca2bf968987b","properties":["abilities_mid"],"fallback":"-","heading":"","conditioned":true,"dice":true,"markdown":true,"hasRule":false}],"hasRule":true},{"type":"group","id":"cbeabaf93b58","properties":[],"nested":[{"type":"property","id":"0b4809ba0b29","properties":["speed"],"fallback":"-","display":"Speed","conditioned":true,"markdown":true,"dice":false},{"type":"traits","id":"882bc9aa0898","properties":["attacks"],"fallback":"-","conditioned":true,"dice":true,"markdown":true,"headingProp":false,"heading":"","callback":"var s = property.bonus < 0 ? \"-\" : \"+\";\ns += Math.abs(property.bonus);\nif (property.desc) {\n s += \" \" + property.desc\n}\nif (property.damage) {\n s += \", __Damage__ \" + property.damage\n}\nreturn s"},{"type":"traits","id":"faeafb7b6b1b","properties":["spellcasting"],"fallback":"-","conditioned":true,"dice":true},{"type":"traits","id":"aacb399a3b58","properties":["abilities_bot"],"fallback":"-","conditioned":true,"dice":true,"markdown":true,"hasRule":false}],"hasRule":true},{"type":"text","id":"1b195a894b58","properties":["token"],"text":null,"fallback":"","heading":"Show to Players","conditioned":true,"markdown":true},{"type":"image","id":"1bba89582b29","properties":["token"],"fallback":"","conditioned":true,"hasRule":true},{"type":"property","id":"88e97a485b79","properties":["sourcebook"],"fallback":"-","conditioned":true,"markdown":true,"dice":false,"display":" Source:"}],"name":"Pathfinder 2e Creature Layout","id":"b8ab3ae89a0a","diceParsing":[{"regex":"(\\s|^)(\\d+d\\d+(?:\\s*[+-]\\s*\\d+)?)(\\W|$)","parser":"const [, before, text, after] = matches;\nreturn [before + text, \" (\", { text }, \")\", after];","id":"4a79397b896a","desc":"1d6+10"},{"regex":"(^|\\s)([+-]\\d+)(\\W|$)(?!status|bonus)","parser":"let [, before, bonus, after] = matches;\nreturn [\n before + bonus,\n \" (\", { text: \"1d20\" + bonus }, \")\",\n after\n];","id":"8bb8fbbb0869","desc":"+15"}],"edited":true} |
Oops, something went wrong.