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

@ -2112,6 +2112,7 @@
"formula": "Formula", "formula": "Formula",
"general": "General", "general": "General",
"gm": "GM", "gm": "GM",
"guaranteedCriticalSuccess": "Guaranteed Critical Success",
"healing": "Healing", "healing": "Healing",
"healingRoll": "Healing Roll", "healingRoll": "Healing Roll",
"hit": { "hit": {

View file

@ -97,7 +97,19 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
} }
async handleBlazeOfGlory() { 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) { static selectMove(_, button) {

View file

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