chore(deps): update dependency @league-of-foundry-developers/foundry-vtt-types to v9.242.0

This commit is contained in:
Renovate Bot 2022-01-22 13:15:39 +00:00 committed by Johannes Loher
parent 079537251a
commit 818ce32d8d
4 changed files with 19 additions and 31 deletions

View file

@ -80,7 +80,7 @@ export class DS4ActiveEffect extends ActiveEffect {
}
/**
* Gets the source document for this effect. Uses the cached {@link DS4ActiveEffect#origin} if it has already been
* Gets the source document for this effect. Uses the cached {@link DS4ActiveEffect#source} if it has already been
* set.
*/
protected async getSource(): ReturnType<typeof fromUuid> {

View file

@ -9,41 +9,29 @@ export class DS4Roll<D extends Record<string, unknown> = Record<string, unknown>
static CHAT_TEMPLATE = "systems/ds4/templates/dice/roll.hbs";
/**
* This only differs from {@link Roll.render} in that it provides `isCoup` and `isFumble` properties to the roll
* template if the first dice term is a ds4 check.
* @override
* @remarks
* This only differs from {@link Roll#render} in that it provides `isCoup` and `isFumble` properties to the roll
* template if the first dice term is a ds4 check.
*/
async render(chatOptions: Parameters<Roll["render"]>[0] = {}): Promise<string> {
chatOptions = foundry.utils.mergeObject(
{
user: getGame().user?.id,
flavor: null,
template: DS4Roll.CHAT_TEMPLATE,
blind: false,
},
chatOptions,
);
const isPrivate = chatOptions.isPrivate;
// Execute the roll, if needed
if (!this._evaluated) this.evaluate();
// Define chat data
async render({
flavor,
template = (this.constructor as typeof DS4Roll).CHAT_TEMPLATE,
isPrivate = false,
}: Parameters<Roll["render"]>[0] = {}): Promise<string> {
if (!this._evaluated) await this.evaluate({ async: true });
const firstDiceTerm = this.dice[0];
const isCoup = firstDiceTerm instanceof DS4Check && firstDiceTerm.coup;
const isFumble = firstDiceTerm instanceof DS4Check && firstDiceTerm.fumble;
const chatData = {
formula: isPrivate ? "???" : this._formula,
flavor: isPrivate ? null : chatOptions.flavor,
user: chatOptions.user,
flavor: isPrivate ? null : flavor,
user: getGame().user?.id,
tooltip: isPrivate ? "" : await this.getTooltip(),
total: isPrivate ? "?" : Math.round((this.total ?? 0) * 100) / 100,
isCoup: isPrivate ? null : isCoup,
isFumble: isPrivate ? null : isFumble,
};
// Render the roll display template
return renderTemplate(chatOptions.template ?? "", chatData);
return renderTemplate(template, chatData);
}
}