diff --git a/lang/en.json b/lang/en.json index 948dceec..8abc119c 100644 --- a/lang/en.json +++ b/lang/en.json @@ -37,6 +37,7 @@ "Ex3.InitiativeIconColor": "Initiative Icon Color", "Ex3.Flowing": "Flowing", "Ex3.Still": "Still", + "Ex3.Both": "Both", "Ex3.ActivateAura": "Activate Aura", "Ex3.Aura": "Aura", "Ex3.HasAura": "Has Aura", diff --git a/module/apps/template-importer.js b/module/apps/template-importer.js index 4bf82566..4cebfb6b 100644 --- a/module/apps/template-importer.js +++ b/module/apps/template-importer.js @@ -422,6 +422,7 @@ export default class TemplateImporter extends FormApplication { async createOther(html) { + const martialArtsWeapons = await foundry.utils.fetchJsonWithTimeout('systems/exaltedthird/module/data/martialArtsWeapons.json', {}, { int: 30000 }); var textArray = html.find('#template-text').val().split(/\r?\n/); var itemType = html.find('#itemType').val(); var index = 0; @@ -490,22 +491,14 @@ export default class TemplateImporter extends FormApplication { itemData.img = "systems/exaltedthird/assets/icons/punch-blast.svg"; itemData.type = 'customability'; itemData.system.abilitytype = 'martialart'; - // const weaponMatches = description.match(/Weapons:(.*?)Armor:/s); - // if (weaponMatches) { - // const extractedText = weaponMatches[1].trim().replace(/[^\w\s]/gi, '').toLowerCase(); - // var weaponsList = []; - // for (const weapon of Object.keys(weapons)) { - // if (extractedText.includes(weapon)) { - // weaponsList.push(weapon); - // } - // } - // itemData.system.traits = { - // "weapons": { - // "value": weaponsList, - // "custom": "" - // } - // } - // } + if (martialArtsWeapons[itemData.name]) { + itemData.system.traits = { + weapons: { + "value": martialArtsWeapons[itemData.name], + "custom": "" + } + } + } const armorMatches = description.match(/Armor:(.*)/); if (armorMatches) { const extractedText = armorMatches[1].trim().toLowerCase(); @@ -522,6 +515,21 @@ export default class TemplateImporter extends FormApplication { itemData.system.armorallowance = "none"; } } + + const natureMatches = description.match(/Nature:(.*)/); + if (natureMatches) { + const extractedText = natureMatches[1].trim().toLowerCase(); + itemData.system.siderealmartialart = true; + if (extractedText.includes('still') && extractedText.includes('flowing')) { + itemData.system.nature = 'both'; + } + else if (extractedText.includes('still')) { + itemData.system.nature = 'still'; + } + else if (extractedText.includes('flowing')) { + itemData.system.nature = 'flowing'; + } + } } itemData.system.description = description; if (folder) { diff --git a/module/data/martialArtsWeapons.json b/module/data/martialArtsWeapons.json new file mode 100644 index 00000000..0c96c9e5 --- /dev/null +++ b/module/data/martialArtsWeapons.json @@ -0,0 +1,179 @@ +{ + "Air Dragon Style": [ + "chakrams", + "unarmed" + ], + "Bear Style": [ + "unarmed" + ], + "Black Claw Style": [ + "unarmed" + ], + "Centipede Style": [ + "fightingchains", + "hookswords", + "ironboots", + "sevenectionstaffs", + "unarmed" + ], + "Charcoal March of Spiders Style": [ + "fightingchains", + "knives", + "meteorhammers", + "nunchakus", + "ropedarts", + "sevenectionstaffs", + "unarmed", + "whips" + ], + "Citrine Poxes of Contagion Style": [ + "handneedles", + "ropedarts", + "unarmed" + ], + "Crane Style": [ + "hookswords", + "unarmed", + "warfans" + ], + "Earth Dragon Style": [ + "tetsubos", + "unarmed" + ], + "Ebon Shadow Style": [ + "knives", + "sais", + "tigerclaws", + "unarmed" + ], + "Emerald Gyre of Aeons Style": [ + "kusarigamas", + "melee", + "nunchakus", + "ropedarts", + "sevenectionstaffs", + "staffs", + "unarmed", + "windandfirewheels" + ], + "Falcon Style": [ + "cestus", + "improvised", + "ironboots", + "tigerclaws", + "unarmed" + ], + "Fire Dragon Style": [ + "shortswords", + "unarmed" + ], + "Golden Janissary Style": [ + "spears", + "staffs", + "unarmed" + ], + "Laughing Monster Style": [ + "staffs", + "unarmed", + "warfans", + "whips" + ], + "Mantis Style": [ + "batons", + "kamas", + "nunchakus", + "sevenectionstaffs", + "unarmed", + "warfans" + ], + "Monkey Style": [ + "batons", + "improvised", + "sevenectionstaffs", + "staffs", + "unarmed" + ], + "Obsidian Shards of Infinity Style": [ + "khatars", + "knives", + "sais", + "unarmed" + ], + "Prismatic Arrangement of Creation Style": [], + "Rat Style": [ + "knives", + "tigerclaws", + "unarmed" + ], + "Righteous Devil Style": [ + "flame" + ], + "Silver-Voiced Nightingale Style": [ + "kiais", + "unarmed" + ], + "Single Point Shining Into the Void Style": [ + "slashingswords" + ], + "Snake Style": [ + "hookswords", + "sevenectionstaffs", + "unarmed" + ], + "Steel Devil Style": [ + "dualswords" + ], + "Swaying Grass Dance Style": [ + "batons", + "ironboots", + "knives", + "unarmed" + ], + "Thousand Blades Style": [ + "melee" + ], + "Throne Shadow Style": [ + "fightingchains", + "ropedarts", + "sevenectionstaffs", + "staffs", + "unarmed", + "windandfirewheels" + ], + "Tiger Style": [ + "tigerclaws", + "unarmed" + ], + "Toad Style": [ + "unarmed" + ], + "Violet Bier of Sorrows Style": [ + "choppingswords", + "greatswords", + "knives", + "sevenectionstaffs", + "straightswords", + "staffs", + "unarmed" + ], + "Water Dragon Style": [ + "tigerclaws", + "unarmed" + ], + "White Reaper Style": [ + "scythes", + "spears", + "staffs", + "unarmed" + ], + "White Veil Style": [ + "garrotes", + "handneedles", + "unarmed" + ], + "Wood Dragon Style": [ + "bows", + "staffs", + "unarmed" + ] +} \ No newline at end of file diff --git a/module/exaltedthird.js b/module/exaltedthird.js index c78f09f5..e540494f 100644 --- a/module/exaltedthird.js +++ b/module/exaltedthird.js @@ -112,13 +112,13 @@ Hooks.once('init', async function () { Die.prototype.doubleSuccess = function (modifier) { const rgx = /(?:ds)([<>=]+)?([0-9]+)?/i; const match = modifier.match(rgx); - if ( !match ) return false; + if (!match) return false; let [comparison, target] = match.slice(1); comparison = comparison || "="; target = parseInt(target) ?? this.faces; - for ( let r of this.results ) { + for (let r of this.results) { let success = DiceTerm.compareResult(r.result, comparison, target); - if(!r.success) { + if (!r.success) { r.success = success; } r.count += (success ? 1 : 0); @@ -1140,7 +1140,11 @@ Hooks.once("ready", async function () { ui.notifications.notify(`Migration Complete`); await game.settings.set("exaltedthird", "systemMigrationVersion", game.system.version); } - + const map = {} + for (const martialArt of game.items.filter(item => item.type === 'customability' && item.system.abilitytype === 'martialart')) { + map[martialArt.name] = martialArt.system.traits.weapons.value; + } + console.log(map); // for(const martialArt of CONFIG.exaltedthird.martialarts) { // console.log(martialArt); // let folder = game.folders.filter(folder => folder.name === 'Martial Arts')[0]; diff --git a/template.json b/template.json index 4a6c5ba1..281c44d0 100644 --- a/template.json +++ b/template.json @@ -851,6 +851,7 @@ "siderealmartialart": false, "excellency": false, "armorallowance": "", + "nature": "", "traits": { "weapons": { "value": [], diff --git a/templates/item/item-customability-sheet.html b/templates/item/item-customability-sheet.html index 919c18ac..f724ae6a 100644 --- a/templates/item/item-customability-sheet.html +++ b/templates/item/item-customability-sheet.html @@ -66,14 +66,27 @@

{{localize "Ex3.Favored"}} +
+
{{localize "Ex3.Excellency"}}
+ +
{{localize "Ex3.SiderealMartialArt"}}
+ {{#if system.siderealmartialart}}
-
{{localize "Ex3.Excellency"}}
- +
{{localize "Ex3.Nature"}}
+
+ {{/if}} {{> systems/exaltedthird/templates/actor/active-effects.html}}