mirror of
https://github.com/Kornstalx/5etools-mirror-2.github.io.git
synced 2025-10-28 20:45:35 -05:00
v1.198.1
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
export class InitiativeTrackerRoller {
|
||||
static _getRollName (name) {
|
||||
return `Initiative Tracker${name ? ` \u2014 ${name}` : ""}`;
|
||||
}
|
||||
|
||||
async pGetRollInitiative ({mon, name, initiativeModifier}) {
|
||||
name ??= mon?.name;
|
||||
initiativeModifier ??= mon ? Parser.getAbilityModifier(mon.dex) : 0;
|
||||
|
||||
return Renderer.dice.pRoll2(`1d20${UiUtil.intToBonus(initiativeModifier)}`, {
|
||||
isUser: false,
|
||||
name: this.constructor._getRollName(name ?? mon?.name),
|
||||
label: "Initiative",
|
||||
}, {isResultUsed: true});
|
||||
}
|
||||
|
||||
async pGetOrRollHp (mon, {isRollHp}) {
|
||||
if (!isRollHp && mon.hp.average && !isNaN(mon.hp.average)) return Number(mon.hp.average);
|
||||
|
||||
if (isRollHp && mon.hp.formula) {
|
||||
return Renderer.dice.pRoll2(mon.hp.formula, {
|
||||
isUser: false,
|
||||
name: this.constructor._getRollName(mon?.name),
|
||||
label: "HP",
|
||||
}, {isResultUsed: true});
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user