Working on 0.8.x
- NPC with all ring on strengths/weaknesses (CSS TODO). - Removed Custom tech "Links" as they are in fact "Bonds" and need more work. - Added Bonds, SignatureScroll, ItemPatterns and working on titles
This commit is contained in:
@@ -5,7 +5,7 @@ import { L5rBaseDie } from "./l5r-base-die.js";
|
||||
*/
|
||||
export class AbilityDie extends L5rBaseDie {
|
||||
/** @override */
|
||||
static DENOMINATION = "ds";
|
||||
static DENOMINATION = "s";
|
||||
|
||||
static FACES = {
|
||||
1: { success: 0, explosive: 0, opportunity: 0, strife: 0, image: "skill_blank" },
|
||||
|
||||
@@ -22,20 +22,33 @@ export class L5rBaseDie extends DiceTerm {
|
||||
return this.l5r5e.success + this.l5r5e.explosive;
|
||||
}
|
||||
|
||||
/**
|
||||
* A string representation of the formula expression for this RollTerm, prior to evaluation.
|
||||
* @type {string}
|
||||
* @override
|
||||
*/
|
||||
get expression() {
|
||||
return `${this.number}d${this.constructor.DENOMINATION}${this.modifiers.join("")}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a standardized representation for the displayed formula associated with this DiceTerm
|
||||
* @override
|
||||
*/
|
||||
get formula() {
|
||||
return `${this.number}${this.constructor.DENOMINATION}${this.modifiers.join("")}`;
|
||||
// No flavor
|
||||
return this.expression;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the full img string used as the label for each rolled result
|
||||
* @override
|
||||
* Return a string used as the label for each rolled result
|
||||
* @param {DiceTermResult} result The rolled result
|
||||
* @return {string} The result label
|
||||
*/
|
||||
static getResultLabel(result) {
|
||||
return `<img src="${CONFIG.l5r5e.paths.assets}dices/default/${this.FACES[result].image}.svg" alt="${result}" />`;
|
||||
getResultLabel(result) {
|
||||
return `<img src="${CONFIG.l5r5e.paths.assets}dices/default/${
|
||||
this.constructor.FACES[result.result].image
|
||||
}.svg" alt="${result.result}" />`;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@ import { L5rBaseDie } from "./l5r-base-die.js";
|
||||
*/
|
||||
export class RingDie extends L5rBaseDie {
|
||||
/** @override */
|
||||
static DENOMINATION = "dr";
|
||||
static DENOMINATION = "r";
|
||||
|
||||
static FACES = {
|
||||
1: { success: 0, explosive: 0, opportunity: 0, strife: 0, image: "ring_blank" },
|
||||
|
||||
@@ -5,8 +5,8 @@ export class RollL5r5e extends Roll {
|
||||
static CHAT_TEMPLATE = "dice/chat-roll.html";
|
||||
static TOOLTIP_TEMPLATE = "dice/tooltip.html";
|
||||
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor(formula, data = {}, options = {}) {
|
||||
super(formula, data, options);
|
||||
|
||||
this.l5r5e = {
|
||||
stance: "",
|
||||
@@ -37,7 +37,7 @@ export class RollL5r5e extends Roll {
|
||||
};
|
||||
|
||||
// Parse flavor for stance and skillId
|
||||
const flavors = Array.from(args[0].matchAll(/\d+d(s|r)\[([^\]]+)\]/gmu));
|
||||
const flavors = Array.from(formula.matchAll(/\d+d(s|r)\[([^\]]+)\]/gmu));
|
||||
flavors.forEach((res) => {
|
||||
if (res[1] === "r" && !!res[2] && this.l5r5e.stance === "") {
|
||||
this.l5r5e.stance = res[2];
|
||||
@@ -160,6 +160,8 @@ export class RollL5r5e extends Roll {
|
||||
* @override
|
||||
*/
|
||||
get total() {
|
||||
//return 0; // todo Bug : Si 0 tout le temps -> pas de pb pour le chat. mais plus d'inline :'(
|
||||
|
||||
if (!this._evaluated) {
|
||||
return null;
|
||||
}
|
||||
@@ -205,7 +207,7 @@ export class RollL5r5e extends Roll {
|
||||
display: !isL5rDie || contexte?.from !== "render",
|
||||
rolls: term.results.map((r) => {
|
||||
return {
|
||||
result: cls.getResultLabel(r.result),
|
||||
result: term.getResultLabel(r),
|
||||
classes: [
|
||||
cls.name.toLowerCase(),
|
||||
"d" + term.faces,
|
||||
@@ -273,7 +275,7 @@ export class RollL5r5e extends Roll {
|
||||
diceTypeL5r: isL5rDie,
|
||||
rolls: term.results.map((r) => {
|
||||
return {
|
||||
result: term.constructor.getResultLabel(r.result),
|
||||
result: term.getResultLabel(r),
|
||||
classes: [
|
||||
isL5rDie && r.swapped ? "swapped" : null,
|
||||
r.rerolled ? "rerolled" : null,
|
||||
@@ -292,6 +294,14 @@ export class RollL5r5e extends Roll {
|
||||
return renderTemplate(chatOptions.template, chatData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the HTML for the ChatMessage which should be added to the log
|
||||
* @return {Promise<jQuery>}
|
||||
*/
|
||||
async getHTML() {
|
||||
console.log(" --------- getHTML");
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform a Roll instance into a ChatMessage, displaying the roll result.
|
||||
* This function can either create the ChatMessage directly, or return the data object that will be used to create.
|
||||
|
||||
Reference in New Issue
Block a user