Working on 0.8.x
- Showing titles (title_ability) in techniques pc/npc
This commit is contained in:
@@ -16,11 +16,8 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Commons datas
|
||||
* @override
|
||||
*/
|
||||
getData(options) {
|
||||
/** @inheritdoc */
|
||||
getData(options = {}) {
|
||||
const sheetData = super.getData(options);
|
||||
|
||||
sheetData.data.dtypes = ["String", "Number", "Boolean"];
|
||||
@@ -64,11 +61,17 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
break;
|
||||
|
||||
case "title":
|
||||
// Embed technique in titles
|
||||
Array.from(item.data.items).forEach(([id, embedItem]) => {
|
||||
if (embedItem.data.type === "technique") {
|
||||
out[embedItem.data.data.technique_type].push(embedItem.data);
|
||||
}
|
||||
});
|
||||
|
||||
// If unlocked, add the "title_ability" as technique (or always displayed for npc)
|
||||
if (item.data.xp_used >= item.data.xp_cost || this.document.type === "npc") {
|
||||
out["title_ability"].push(item);
|
||||
}
|
||||
break;
|
||||
} //swi
|
||||
});
|
||||
@@ -84,10 +87,11 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
sheetData.data.data.techniques["school_ability"] = out["school_ability"].length === 0;
|
||||
sheetData.data.data.techniques["mastery_ability"] = out["mastery_ability"].length === 0;
|
||||
|
||||
// Always display "school_ability", but display "mastery_ability" only if rank >= 5
|
||||
// Always display "school_ability", but display a empty "mastery_ability" field only if rank >= 5
|
||||
if (sheetData.data.data.identity?.school_rank < 5 && out["mastery_ability"].length === 0) {
|
||||
delete out["mastery_ability"];
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,11 @@ export class NpcSheetL5r5e extends BaseSheetL5r5e {
|
||||
});
|
||||
}
|
||||
|
||||
getData() {
|
||||
/** @inheritdoc */
|
||||
getData(options = {}) {
|
||||
const sheetData = super.getData();
|
||||
|
||||
// NPC Subtypes
|
||||
sheetData.data.data.types = NpcSheetL5r5e.types.map((e) => ({
|
||||
id: e,
|
||||
label: game.i18n.localize("l5r5e.character_types." + e),
|
||||
|
||||
@@ -23,7 +23,7 @@ L5R5E.techniques.set("ninjutsu", { type: "core", displayInTypes: true });
|
||||
L5R5E.techniques.set("school_ability", { type: "school", displayInTypes: false });
|
||||
L5R5E.techniques.set("mastery_ability", { type: "school", displayInTypes: false });
|
||||
// Title
|
||||
// L5R5E.techniques.set("title_ability", { type: "title", displayInTypes: false });
|
||||
L5R5E.techniques.set("title_ability", { type: "title", displayInTypes: false });
|
||||
// Custom
|
||||
L5R5E.techniques.set("specificity", { type: "custom", displayInTypes: false });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user