diff --git a/src/layouts/pathfinder 2e/Pathfinder 2e Creature Layout.json b/src/layouts/pathfinder 2e/Pathfinder 2e Creature Layout.json index fe5967a..b4695f4 100644 --- a/src/layouts/pathfinder 2e/Pathfinder 2e Creature Layout.json +++ b/src/layouts/pathfinder 2e/Pathfinder 2e Creature Layout.json @@ -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 += `- ${monster.rarity}\\n`\n}\nif (monster.alignment) {\n s += `- ${monster.alignment}\\n`\n}\nif (monster.size) {\n s += `- ${monster.size}\\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"}]} \ No newline at end of file +{"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(`${monster.rarity}`);\n}\n\nif (monster.alignment) {\n traits.push(`${monster.alignment}`);\n}\nif (monster.size) {\n traits.push(`${monster.size}`);\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} \ No newline at end of file diff --git a/src/layouts/pathfinder 2e/pf2e.ts b/src/layouts/pathfinder 2e/pf2e.ts index 1ec45a1..09ace84 100644 --- a/src/layouts/pathfinder 2e/pf2e.ts +++ b/src/layouts/pathfinder 2e/pf2e.ts @@ -376,21 +376,39 @@ export const LayoutPF2eCreature: DefaultLayout = { display: " " }, { - type: "inline", - id: "499aea6a9aca", - properties: [], - nested: [ - { - type: "action", - id: "8a6a7a499b78", - icon: "sword", - callback: "try { InitiativeTracker.newEncounter({roll: true, creatures: [monster]}); } catch(e) {}" - }, + type: "ifelse", + id: "badbdb298988", + conditions: [ { - type: "action", - id: "fbea380b09b9", - icon: "plus-with-circle", - callback: "try { InitiativeTracker.addCreatures([monster]); } catch(e) {}" + 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" } ] }, @@ -417,11 +435,9 @@ export const LayoutPF2eCreature: DefaultLayout = { { type: "property", id: "0979a989583a", - properties: [ - "traits" - ], + properties: [], fallback: "-", - callback: "if (!monster.traits) return \"\";\nvar s = \"\"\nif (monster.rarity) {\n s += `- ${monster.rarity}\\n`\n}\nif (monster.alignment) {\n s += `- ${monster.alignment}\\n`\n}\nif (monster.size) {\n s += `- ${monster.size}\\n`\n}\nfor (const text of monster.traits) {\n s += `- ${text}\\n`\n}\nreturn s;", + callback: "const traits = []\nif (monster.rarity && monster.rarity.toLowerCase() !== \"common\") {\n traits.push(`${monster.rarity}`);\n}\n\nif (monster.alignment) {\n traits.push(`${monster.alignment}`);\n}\nif (monster.size) {\n traits.push(`${monster.size}`);\n}\n\nif (monster.traits) {\n traits.push(...monster.traits);\n}\n\nreturn traits ? (\"- \" + traits.join(\"\\n- \")) : \"\";", conditioned: true, display: "" } @@ -449,7 +465,8 @@ export const LayoutPF2eCreature: DefaultLayout = { display: "Perception", conditioned: false, dice: false, - diceCallback: "return [\"+\" + property, \" (\", { text: \"1d20+\" + property }, \")\"]" + diceCallback: "const num = (property < 0 ? \"-\" : \"+\") + Math.abs(property);\nreturn [num, \" (\", { text: \"1d20\"+num }, \")\"];", + callback: "return (monster.modifier < 0 ? \"-\" : \"+\") + Math.abs(monster.modifier);" }, { type: "property", @@ -521,10 +538,12 @@ export const LayoutPF2eCreature: DefaultLayout = { "Wis", "Cha" ], - calculate: false, + calculate: true, fallback: "-", conditioned: true, - dice: false + dice: false, + modifier: "stat", + doNotAddClass: false }, { type: "property", @@ -612,7 +631,7 @@ export const LayoutPF2eCreature: DefaultLayout = { conditioned: true } ], - cls: "oneline", + cls: "oneline ac-saves", conditioned: true }, { @@ -671,23 +690,23 @@ export const LayoutPF2eCreature: DefaultLayout = { }, { type: "property", - id: "8b7a3b89fa59", + id: "78689b6b6b79", properties: [ - "resistances" + "weaknesses" ], fallback: "-", conditioned: true, - display: "Resistances" + display: "Weaknesses" }, { type: "property", - id: "78689b6b6b79", + id: "8b7a3b89fa59", properties: [ - "weaknesses" + "resistances" ], fallback: "-", conditioned: true, - display: "Weaknesses" + display: "Resistances" } ], cls: "oneline", @@ -815,5 +834,6 @@ export const LayoutPF2eCreature: DefaultLayout = { id: "8bb8fbbb0869", desc: "+15" } - ] -} \ No newline at end of file + ], + edited: true +} diff --git a/src/layouts/pathfinder 2e/xCSS/pf2e.css b/src/layouts/pathfinder 2e/xCSS/pf2e.css index 7a57df7..b5eb219 100644 --- a/src/layouts/pathfinder 2e/xCSS/pf2e.css +++ b/src/layouts/pathfinder 2e/xCSS/pf2e.css @@ -1297,6 +1297,13 @@ body.pathfinder-2e-affliction-layout-theme-kingmaker .statblock.pathfinder-2e-af font-weight: normal; font-style: normal; } +.statblock.pathfinder-2e-creature-layout .statblock-content .statblock-table.abilitymods .statblock-markdown { + display: none; +} +.statblock.pathfinder-2e-creature-layout .statblock-content .statblock-table.abilitymods .calculated-modifier::before, +.statblock.pathfinder-2e-creature-layout .statblock-content .statblock-table.abilitymods .calculated-modifier::after { + content: ""; +} .statblock.pathfinder-2e-creature-layout .statblock-content .inline-container.oneline { display: block; } @@ -3403,6 +3410,9 @@ body.pathfinder-2e-affliction-layout-theme-kingmaker .statblock.pathfinder-2e-af .statblock.pathfinder-2e-creature-layout .property-name { margin-right: 0; } +.statblock.pathfinder-2e-creature-layout .ac-saves .save-name { + font-weight: var(--statblock-property-name-font-weight); +} .statblock.basic-pathfinder-2e-layout .statblock-item-inline:has(.statblock-inline-item .name) { display: flex; flex-direction: row; @@ -4194,7 +4204,7 @@ body.pathfinder-2e-affliction-layout-theme-kingmaker .statblock.pathfinder-2e-af .statblock.pathfinder-2e-creature-layout .pf2e-traits.statblock-item-container.property-container { margin: 0; } -.statblock.pathfinder-2e-creature-layout .pf2e-traits.statblock-item-container.property-container > .line.traits { +.statblock.pathfinder-2e-creature-layout .pf2e-traits.statblock-item-container.property-container > .line:has(.property-name) { margin: 0; display: block; }