Added school_ability and mastery_ability types for techniques
This commit is contained in:
@@ -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: '<i class="fas fa-check"></i>',
|
||||
// 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: '<i class="fas fa-check"></i>',
|
||||
},
|
||||
},
|
||||
},
|
||||
}).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: '<i class="fas fa-check"></i>',
|
||||
},
|
||||
},
|
||||
}).render(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Modify the bought at rank to the current actor rank
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user