diff --git a/system/lang/en-en.json b/system/lang/en-en.json index 75efd31..4b1b3eb 100644 --- a/system/lang/en-en.json +++ b/system/lang/en-en.json @@ -122,6 +122,7 @@ "title": "Techniques", "title_new": "New Technique", "not_allowed": "Your character does not use this type of technique.", + "only_one": "Your character can possess only one of theses technique.", "type": "Allowed Techniques", "kata": "Kata", "kiho": "Kihõ", @@ -129,7 +130,9 @@ "ritual": "Ritual", "shuji": "Shuji", "maho": "Mahõ", - "ninjutsu": "Ninjutsu" + "ninjutsu": "Ninjutsu", + "school_ability": "School Ability", + "mastery_ability": "Mastery Ability" }, "peculiarities": { "title_new": "New peculiarity", diff --git a/system/lang/es-es.json b/system/lang/es-es.json index e97a0c8..de55845 100644 --- a/system/lang/es-es.json +++ b/system/lang/es-es.json @@ -122,6 +122,7 @@ "title": "Techniques", "type": "Tipo accesible", "not_allowed": "Your character does not use this type of technique.", + "only_one": "Your character can possess only one of theses technique.", "title_new": "Nuevo Rasgo", "kata": "Kata", "kiho": "Kihõ", @@ -129,7 +130,9 @@ "ritual": "Ritual", "shuji": "Shuji", "maho": "Mahõ", - "ninjutsu": "Ninjutsu" + "ninjutsu": "Ninjutsu", + "school_ability": "School Ability", + "mastery_ability": "Mastery Ability" }, "peculiarities": { "title_new": "New peculiarity", diff --git a/system/lang/fr-fr.json b/system/lang/fr-fr.json index 3b1766a..73e5de1 100644 --- a/system/lang/fr-fr.json +++ b/system/lang/fr-fr.json @@ -122,6 +122,7 @@ "title": "Techniques", "title_new": "Nouvelle Technique", "not_allowed": "Votre personnage n'utilise pas ce type de technique.", + "only_one": "Votre personnage ne peut avoir qu'une seule de ces technique.", "type": "Type accessible", "kata": "Kata", "kiho": "Kihõ", @@ -129,7 +130,9 @@ "ritual": "Rituel", "shuji": "Shuji", "maho": "Mahõ", - "ninjutsu": "Ninjutsu" + "ninjutsu": "Ninjutsu", + "school_ability": "Capacité d'école", + "mastery_ability": "Capacité de maîtrise" }, "peculiarities": { "title_new": "Nouvelle particularité", diff --git a/system/scripts/actors/base-sheet.js b/system/scripts/actors/base-sheet.js index 0bb4d6f..5fa2119 100644 --- a/system/scripts/actors/base-sheet.js +++ b/system/scripts/actors/base-sheet.js @@ -94,19 +94,41 @@ export class BaseSheetL5r5e extends ActorSheet { break; case "technique": - // Check if technique is allowed for this character - if (!game.user.isGM && !this.actor.data.data.techniques[item.data.data.technique_type]) { - new Dialog({ - title: game.i18n.localize("l5r5e.techniques.title"), - content: game.i18n.localize("l5r5e.techniques.not_allowed"), - buttons: { - ok: { - label: game.i18n.localize("l5r5e.global.ok"), - icon: '', + // School_ability and mastery_ability, allow only 1 per type + if (CONFIG.l5r5e.techniques_school.includes(item.data.data.technique_type)) { + if ( + Array.from(this.actor.items).some( + (e) => + e.type === "technique" && e.data.data.technique_type === item.data.data.technique_type + ) + ) { + new Dialog({ + title: game.i18n.localize("l5r5e.techniques.title"), + content: game.i18n.localize("l5r5e.techniques.only_one"), + buttons: { + ok: { + label: game.i18n.localize("l5r5e.global.ok"), + icon: '', + }, }, - }, - }).render(true); - return; + }).render(true); + return; + } + } else { + // Check if technique is allowed for this character + if (!game.user.isGM && !this.actor.data.data.techniques[item.data.data.technique_type]) { + new Dialog({ + title: game.i18n.localize("l5r5e.techniques.title"), + content: game.i18n.localize("l5r5e.techniques.not_allowed"), + buttons: { + ok: { + label: game.i18n.localize("l5r5e.global.ok"), + icon: '', + }, + }, + }).render(true); + return; + } } // Modify the bought at rank to the current actor rank diff --git a/system/scripts/actors/twenty-questions-dialog.js b/system/scripts/actors/twenty-questions-dialog.js index 450efc1..d077840 100644 --- a/system/scripts/actors/twenty-questions-dialog.js +++ b/system/scripts/actors/twenty-questions-dialog.js @@ -198,9 +198,23 @@ export class TwentyQuestionsDialog extends FormApplication { // Specific entry switch (type) { case "technique": - // Tech not allowed - if (!this.actor.data.data.techniques[item.data.data.technique_type]) { - console.warn("This technique is not allowed for your character", type, item.data.type); + // School Ability + if (stepKey === "step3.school_ability") { + if (item.data.data.technique_type !== "school_ability") { + // console.warn("This technique is not a school ability"); + return; + } + if ( + Array.from(this.actor.items).some( + (e) => e.type === "technique" && e.data.data.technique_type === "school_ability" + ) + ) { + // console.warn("This technique is not a school ability", item.data.data.technique_type); + return; + } + } else if (!this.actor.data.data.techniques[item.data.data.technique_type]) { + // Tech not allowed + // console.warn("This technique is not allowed for your character", item.data.data.technique_type); return; } break; diff --git a/system/scripts/config.js b/system/scripts/config.js index 80dd437..d020d7e 100644 --- a/system/scripts/config.js +++ b/system/scripts/config.js @@ -7,6 +7,7 @@ L5R5E.paths = { L5R5E.stances = ["earth", "air", "water", "fire", "void"]; L5R5E.techniques = ["kata", "kiho", "invocation", "ritual", "shuji", "maho", "ninjutsu"]; +L5R5E.techniques_school = ["school_ability", "mastery_ability"]; L5R5E.xp = { costPerRank: [0, 20, 24, 32, 44, 60], ringCostMultiplier: 3, diff --git a/system/scripts/items/technique-sheet.js b/system/scripts/items/technique-sheet.js index 474e4d1..541b796 100644 --- a/system/scripts/items/technique-sheet.js +++ b/system/scripts/items/technique-sheet.js @@ -14,4 +14,19 @@ export class TechniqueSheetL5r5e extends ItemSheetL5r5e { tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "description" }], }); } + + /** @override */ + async getData() { + const sheetData = await super.getData(); + + // Add "school ability" and "mastery ability" + CONFIG.l5r5e.techniques_school.forEach((e) => { + sheetData.data.techniquesList.push({ + id: e, + label: game.i18n.localize(`l5r5e.techniques.${e}`), + }); + }); + + return sheetData; + } }