Partial implementation of Blaze of Glory

This commit is contained in:
Chris Ryan 2025-12-28 14:26:41 +10:00
parent cee79ac4c2
commit 3a7fd0eb8b
3 changed files with 23 additions and 16 deletions

View file

@ -97,7 +97,19 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
}
async handleBlazeOfGlory() {
console.log("TODO: Blaze Of Glory");
this.actor.createEmbeddedDocuments('ActiveEffect', [
{
name: game.i18n.localize('DAGGERHEART.CONFIG.DeathMoves.blazeOfGlory.name'),
img: 'icons/magic/movement/abstract-ribbons-red-orange.webp',
changes: [
{
key: 'system.rules.roll.guaranteedCritical',
mode: 2,
value: "true"
}
]
}
]);
}
static selectMove(_, button) {

View file

@ -13,7 +13,6 @@ export default class DualityRoll extends D20Roll {
super(formula, data, options);
this.rallyChoices = this.setRallyChoices();
this.guaranteedCritical = this.setGuaranteedCritical();
console.log("guaranteedCritical", this.guaranteedCritical);
}
static messageType = 'dualityRoll';
@ -73,13 +72,9 @@ export default class DualityRoll extends D20Roll {
}
setGuaranteedCritical() {
console.log("setGuaranteedCritical", this);
return this.data?.parent?.appliedEffects.reduce((a, c) => {
console.log("a,c", a,c);
const change = c.changes.find(ch => ch.key === 'system.rules.role.guaranteedCritical');
console.log("change", change);
if (change) a.push({ value: c.id, label: change.value });
const change = c.changes.find(ch => ch.key === 'system.rules.roll.guaranteedCritical');
if (change) a = true;
return a;
}, false);
}
@ -105,8 +100,6 @@ export default class DualityRoll extends D20Roll {
get isCritical() {
if (this.guaranteedCritical) {
this.dHope.total = this.dice[0]?.faces ?? 12;
this.dFear.total = this.dice[1]?.faces ?? 12;
return true;
}
if (!this.dHope._evaluated || !this.dFear._evaluated) return;
@ -114,17 +107,18 @@ export default class DualityRoll extends D20Roll {
}
get withHope() {
if (!this._evaluated) return;
if (!this._evaluated || this.guaranteedCritical) return;
return this.dHope.total > this.dFear.total;
}
get withFear() {
if (!this._evaluated) return;
if (!this._evaluated || this.guaranteedCritical) return;
return this.dHope.total < this.dFear.total;
}
get totalLabel() {
const label = this.isCritical ? 'DAGGERHEART.GENERAL.criticalSuccess' :
const label = this.guaranteedCritical ? 'DAGGERHEART.GENERAL.guaranteedCriticalSuccess' :
this.isCritical ? 'DAGGERHEART.GENERAL.criticalSuccess' :
this.withHope ? 'DAGGERHEART.GENERAL.hope' : 'DAGGERHEART.GENERAL.fear';
return game.i18n.localize(label);
@ -206,7 +200,7 @@ export default class DualityRoll extends D20Roll {
data.hope = {
dice: roll.dHope.denomination,
value: roll.dHope.total,
value: this.guaranteedCritical ? 0 : roll.dHope.total,
rerolled: {
any: roll.dHope.results.some(x => x.rerolled),
rerolls: roll.dHope.results.filter(x => x.rerolled)
@ -214,7 +208,7 @@ export default class DualityRoll extends D20Roll {
};
data.fear = {
dice: roll.dFear.denomination,
value: roll.dFear.total,
value: this.guaranteedCritical ? 0 : roll.dFear.total,
rerolled: {
any: roll.dFear.results.some(x => x.rerolled),
rerolls: roll.dFear.results.filter(x => x.rerolled)
@ -226,7 +220,7 @@ export default class DualityRoll extends D20Roll {
};
data.result = {
duality: roll.withHope ? 1 : roll.withFear ? -1 : 0,
total: roll.dHope.total + roll.dFear.total,
total: this.guaranteedCritical ? 0 : roll.dHope.total + roll.dFear.total,
label: roll.totalLabel
};