Some localization, style and smaller changes

This commit is contained in:
WBHarry 2026-01-13 15:37:05 +01:00
parent a554ec0e4d
commit 048510074c
9 changed files with 137 additions and 151 deletions

View file

@ -1009,7 +1009,7 @@
}, },
"blazeOfGlory": { "blazeOfGlory": {
"name": "Blaze Of Glory", "name": "Blaze Of Glory",
"description": " Your character embraces death and goes out in a blaze of glory. Take one final action. It automatically critically succeeds (with GM approval), and then you cross through the veil of death. NOTE: A Blaze of Glory effect has been added to your character. Any Duality Roll will automatically be a critical." "description": "Your character embraces death and goes out in a blaze of glory. Take one final action. It automatically critically succeeds (with GM approval), and then you cross through the veil of death. NOTE: A Blaze of Glory effect has been added to your character. Any Duality Roll will automatically be a critical."
} }
}, },
"DomainCardTypes": { "DomainCardTypes": {
@ -2605,7 +2605,13 @@
"currentTarget": "Current" "currentTarget": "Current"
}, },
"deathMove": { "deathMove": {
"title": "Death Move" "title": "Death Move",
"gainScar": "You gained a scar",
"avoidScar": "You have avoided a new scar",
"journeysEnd": "You have {scars} Scars and have crossed out your last Hope slot. Your character's journey ends.",
"riskItAllCritical": "Critical Rolled, clearing all marked Stress and Hit Points",
"riskItAllFailure": "The fear die rolled higher. You have crossed through the veil of death.",
"blazeOfGlory": "Blaze of Glory Effect Added!"
}, },
"dicePool": { "dicePool": {
"title": "Dice Pool" "title": "Dice Pool"

View file

@ -1,9 +1,7 @@
import { enrichedFateRoll } from '../../enrichers/FateRollEnricher.mjs'; import { enrichedFateRoll } from '../../enrichers/FateRollEnricher.mjs';
import { enrichedDualityRoll } from '../../enrichers/DualityRollEnricher.mjs'; import { enrichedDualityRoll } from '../../enrichers/DualityRollEnricher.mjs';
const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api; const { HandlebarsApplicationMixin, ApplicationV2 } = foundry.applications.api;
export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV2) { export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV2) {
constructor(actor) { constructor(actor) {
super({}); super({});
@ -46,46 +44,44 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
const target = this.actor.uuid; const target = this.actor.uuid;
const config = await enrichedFateRoll({ const config = await enrichedFateRoll({
target, target,
title: "Avoid Death Hope Fate Roll", title: 'Avoid Death Hope Fate Roll',
label: 'test', label: 'test',
fateType: "Hope" fateType: 'Hope'
}); });
if (config.roll.fate.value <= this.actor.system.levelData.level.current) { if (config.roll.fate.value <= this.actor.system.levelData.level.current) {
// apply scarring - for now directly apply - later add a button. // apply scarring - for now directly apply - later add a button.
const newScarAmount = this.actor.system.scars + 1; const newScarAmount = this.actor.system.scars + 1;
await this.actor.update( await this.actor.update({
{ system: {
system: { scars: newScarAmount
scars: newScarAmount
}
} }
); });
if (newScarAmount >= this.actor.system.resources.hope.max) { if (newScarAmount >= this.actor.system.resources.hope.max) {
return "You have " + newScarAmount + " Scars and have crossed out your last Hope slot. Your character's journey ends." return game.i18n.format('DAGGERHEART.UI.Chat.deathMove.journeysEnd', { scars: newScarAmount });
} }
return "You have a new scar, total scars: " + newScarAmount; return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.gainScar');
} }
return "You have avoided a new scar.";
return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.avoidScar');
} }
async clearAllStressAndHitpoints() { async clearAllStressAndHitpoints() {
await this.actor.update( await this.actor.update({
{ system: {
system: { resources: {
resources: { hitPoints: {
hitPoints: { value: 0
value: 0 },
}, stress: {
stress: { value: 0
value: 0
}
} }
} }
} }
); });
} }
async handleRiskItAll() { async handleRiskItAll() {
@ -94,7 +90,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
traitValue: null, traitValue: null,
target: null, target: null,
difficulty: null, difficulty: null,
title: "Risk It All", title: 'Risk It All',
label: 'test', label: 'test',
actionType: null, actionType: null,
advantage: null advantage: null
@ -102,25 +98,25 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
if (config.roll.isCritical) { if (config.roll.isCritical) {
this.clearAllStressAndHitpoints(); this.clearAllStressAndHitpoints();
return "Critical Rolled, clearing all marked Stress and Hit Points"; return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.riskItAllCritical');
} }
// Hope
if (config.roll.result.duality == 1) { if (config.roll.result.duality == 1) {
console.log("Need to clear up Stress and HP up to hope value"); console.log('Need to clear up Stress and HP up to hope value');
console.log("Hope rolled", config.roll.hope.value); console.log('Hope rolled', config.roll.hope.value);
if (config.roll.hope.value >= (this.actor.system.resources.hitPoints.value + this.actor.system.resources.stress.value)) { if (
config.roll.hope.value >=
this.actor.system.resources.hitPoints.value + this.actor.system.resources.stress.value
) {
this.clearAllStressAndHitpoints(); this.clearAllStressAndHitpoints();
return "Hope roll value is more than the marked Stress and Hit Points, clearing both."; return 'Hope roll value is more than the marked Stress and Hit Points, clearing both.';
} }
return "TODO - need to clear Stress and/or Hit Points up to: " + config.roll.hope.value; return 'TODO - need to clear Stress and/or Hit Points up to: ' + config.roll.hope.value;
} }
//Fear
if (config.roll.result.duality == -1) { if (config.roll.result.duality == -1) {
return "Fear rolled higher, you have died..."; return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.riskItAllFailure');
} }
} }
async handleBlazeOfGlory() { async handleBlazeOfGlory() {
@ -133,13 +129,13 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
{ {
key: 'system.rules.roll.guaranteedCritical', key: 'system.rules.roll.guaranteedCritical',
mode: 2, mode: 2,
value: "true" value: 'true'
} }
] ]
} }
]); ]);
return "Blaze of Glory Effect Added!"; return game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.blazeOfGlory');
} }
static selectMove(_, button) { static selectMove(_, button) {
@ -150,10 +146,9 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
} }
static async takeMove() { static async takeMove() {
this.close(); this.close();
let result = ""; let result = '';
if (CONFIG.DH.GENERAL.deathMoves.blazeOfGlory === this.selectedMove) { if (CONFIG.DH.GENERAL.deathMoves.blazeOfGlory === this.selectedMove) {
result = await this.handleBlazeOfGlory(); result = await this.handleBlazeOfGlory();
@ -167,11 +162,10 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
result = await this.handleRiskItAll(); result = await this.handleRiskItAll();
} }
const autoExpandDescription = game.settings.get( const autoExpandDescription = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.appearance)
CONFIG.DH.id, .expandRollMessage?.desc;
CONFIG.DH.SETTINGS.gameSettings.appearance
).expandRollMessage?.desc;
const cls = getDocumentClass('ChatMessage'); const cls = getDocumentClass('ChatMessage');
const msg = { const msg = {
user: game.user.id, user: game.user.id,
content: await foundry.applications.handlebars.renderTemplate( content: await foundry.applications.handlebars.renderTemplate(
@ -188,9 +182,7 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
chevron: autoExpandDescription ? 'fa-chevron-up' : 'fa-chevron-down' chevron: autoExpandDescription ? 'fa-chevron-up' : 'fa-chevron-down'
} }
), ),
title: game.i18n.localize( title: game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.title'),
'DAGGERHEART.UI.Chat.deathMove.title'
),
speaker: cls.getSpeaker(), speaker: cls.getSpeaker(),
flags: { flags: {
daggerheart: { daggerheart: {

View file

@ -686,10 +686,10 @@ export default class DhCharacter extends BaseDataActor {
const newHopeMax = this.system.resources.hope.max + diff; const newHopeMax = this.system.resources.hope.max + diff;
const newHopeValue = Math.min(newHopeMax, this.system.resources.hope.value); const newHopeValue = Math.min(newHopeMax, this.system.resources.hope.value);
if (newHopeValue != this.system.resources.hope.value) { if (newHopeValue != this.system.resources.hope.value) {
changes.system.resources = { if (!changes.system.resources) changes.system.resources = { hope: { value: 0 } };
hope: { changes.system.resources.hope = {
value: newHopeValue ...changes.system.resources.hope,
} value: changes.system.resources.hope.value + newHopeValue
}; };
} }
} }
@ -710,7 +710,7 @@ export default class DhCharacter extends BaseDataActor {
} }
static migrateData(source) { static migrateData(source) {
if (typeof (source.scars) === 'object') source.scars = 0; if (typeof source.scars === 'object') source.scars = 0;
return super.migrateData(source); return super.migrateData(source);
} }
} }

View file

@ -85,9 +85,7 @@ export default class DualityRoll extends D20Roll {
} }
get isCritical() { get isCritical() {
if (this.guaranteedCritical) { if (this.guaranteedCritical) return true;
return true;
}
if (!this.dHope._evaluated || !this.dFear._evaluated) return; if (!this.dHope._evaluated || !this.dFear._evaluated) return;
return this.dHope.total === this.dFear.total; return this.dHope.total === this.dFear.total;
} }
@ -103,9 +101,13 @@ export default class DualityRoll extends D20Roll {
} }
get totalLabel() { get totalLabel() {
const label = this.guaranteedCritical ? 'DAGGERHEART.GENERAL.guaranteedCriticalSuccess' : const label = this.guaranteedCritical
this.isCritical ? 'DAGGERHEART.GENERAL.criticalSuccess' : ? 'DAGGERHEART.GENERAL.guaranteedCriticalSuccess'
this.withHope ? 'DAGGERHEART.GENERAL.hope' : 'DAGGERHEART.GENERAL.fear'; : this.isCritical
? 'DAGGERHEART.GENERAL.criticalSuccess'
: this.withHope
? 'DAGGERHEART.GENERAL.hope'
: 'DAGGERHEART.GENERAL.fear';
return game.i18n.localize(label); return game.i18n.localize(label);
} }
@ -117,8 +119,9 @@ export default class DualityRoll extends D20Roll {
/** @inheritDoc */ /** @inheritDoc */
static fromData(data) { static fromData(data) {
if (data.options.guaranteedCritical) { if (data.options.guaranteedCritical) {
console.log("TODO: set the max values for Hope and Fear here?"); console.log('TODO: set the max values for Hope and Fear here?');
} }
data.terms[0].class = foundry.dice.terms.Die.name; data.terms[0].class = foundry.dice.terms.Die.name;
data.terms[2].class = foundry.dice.terms.Die.name; data.terms[2].class = foundry.dice.terms.Die.name;
return super.fromData(data); return super.fromData(data);
@ -176,7 +179,7 @@ export default class DualityRoll extends D20Roll {
config.dialog ??= {}; config.dialog ??= {};
config.guaranteedCritical = config.data?.parent?.appliedEffects.reduce((a, c) => { config.guaranteedCritical = config.data?.parent?.appliedEffects.reduce((a, c) => {
const change = c.changes.find(ch => ch.key === 'system.rules.roll.guaranteedCritical'); const change = c.changes.find(ch => ch.key === 'system.rules.roll.guaranteedCritical');
if (change) a = true; if (change) a = true;
return a; return a;
}, false); }, false);
@ -187,7 +190,6 @@ export default class DualityRoll extends D20Roll {
return super.buildConfigure(config, message); return super.buildConfigure(config, message);
} }
static async buildEvaluate(roll, config = {}, message = {}) { static async buildEvaluate(roll, config = {}, message = {}) {
await super.buildEvaluate(roll, config, message); await super.buildEvaluate(roll, config, message);

View file

@ -3,7 +3,7 @@ import D20Roll from './d20Roll.mjs';
import { setDiceSoNiceForHopeFateRoll, setDiceSoNiceForFearFateRoll } from '../helpers/utils.mjs'; import { setDiceSoNiceForHopeFateRoll, setDiceSoNiceForFearFateRoll } from '../helpers/utils.mjs';
export default class FateRoll extends D20Roll { export default class FateRoll extends D20Roll {
constructor(formula, data = {}, options = {}) { constructor(formula, data = {}, options = {}) {
super(formula, data, options); super(formula, data, options);
} }
@ -12,42 +12,33 @@ export default class FateRoll extends D20Roll {
static DefaultDialog = D20RollDialog; static DefaultDialog = D20RollDialog;
get title() { get title() {
return game.i18n.localize( return game.i18n.localize(`DAGGERHEART.GENERAL.fateRoll`);
`DAGGERHEART.GENERAL.fateRoll`
);
} }
get dHope() { get dHope() {
// if ( !(this.terms[0] instanceof foundry.dice.terms.Die) ) return;
if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice(); if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
return this.dice[0]; return this.dice[0];
// return this.#hopeDice;
} }
set dHope(faces) { set dHope(faces) {
if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice(); if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
this.dice[0].faces = this.getFaces(faces); this.dice[0].faces = this.getFaces(faces);
// this.#hopeDice = `d${face}`;
} }
get dFear() { get dFear() {
// if ( !(this.terms[1] instanceof foundry.dice.terms.Die) ) return;
if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice(); if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
return this.dice[0]; return this.dice[0];
// return this.#fearDice;
} }
set dFear(faces) { set dFear(faces) {
if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice(); if (!(this.dice[0] instanceof foundry.dice.terms.Die)) this.createBaseDice();
this.dice[0].faces = this.getFaces(faces); this.dice[0].faces = this.getFaces(faces);
// this.#fearDice = `d${face}`;
} }
get isCritical() { get isCritical() {
return false; return false;
} }
get fateDie() { get fateDie() {
return this.data.fateType; return this.data.fateType;
} }
@ -73,16 +64,10 @@ export default class FateRoll extends D20Roll {
static async buildEvaluate(roll, config = {}, message = {}) { static async buildEvaluate(roll, config = {}, message = {}) {
await super.buildEvaluate(roll, config, message); await super.buildEvaluate(roll, config, message);
if (roll.fateDie === "Hope") { if (roll.fateDie === 'Hope') {
await setDiceSoNiceForHopeFateRoll( await setDiceSoNiceForHopeFateRoll(roll, config.roll.fate.dice);
roll,
config.roll.fate.dice
);
} else { } else {
await setDiceSoNiceForFearFateRoll( await setDiceSoNiceForFearFateRoll(roll, config.roll.fate.dice);
roll,
config.roll.fate.dice
);
} }
} }
@ -90,12 +75,11 @@ export default class FateRoll extends D20Roll {
const data = super.postEvaluate(roll, config); const data = super.postEvaluate(roll, config);
data.fate = { data.fate = {
dice: roll.fateDie === "Hope" ? roll.dHope.denomination : roll.dFear.denomination, dice: roll.fateDie === 'Hope' ? roll.dHope.denomination : roll.dFear.denomination,
value: roll.fateDie === "Hope" ? roll.dHope.total : roll.dFear.total, value: roll.fateDie === 'Hope' ? roll.dHope.total : roll.dFear.total,
fateDie: roll.fateDie fateDie: roll.fateDie
}; };
return data; return data;
} }
} }

View file

@ -1,55 +1,56 @@
@import '../../utils/spacing.less'; @import '../../utils/spacing.less';
@import '../../utils/colors.less'; @import '../../utils/colors.less';
@import '../../utils/fonts.less'; @import '../../utils/fonts.less';
.daggerheart.dh-style.dialog.death-move { .daggerheart.dh-style.dialog.death-move {
.death-move-container { .death-move-container {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: 5px; gap: 5px;
.moves-list { .moves-list {
.move-item { .move-item {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 5px; gap: 5px;
padding: 5px;
&:hover { border-radius: 5px;
background-color: light-dark(@soft-shadow, @soft-white-shadow); transition: background-color 0.3s ease-in-out;
cursor: pointer; height: 37px;
}
padding: 5px; &:hover {
border-radius: 5px; background-color: light-dark(@soft-shadow, @soft-white-shadow);
transition: background-color 0.3s ease-in-out; cursor: pointer;
}
.label {
display: flex; .label {
align-items: center; display: flex;
gap: 10px; align-items: center;
cursor: pointer; gap: 10px;
flex: 1; cursor: pointer;
i { flex: 1;
text-align: center; i {
width: 30px; text-align: center;
} width: 30px;
} }
}
input[type='radio'] {
margin-left: auto; input[type='radio'] {
} margin-left: auto;
} }
} }
} }
}
footer {
margin-top: 8px; footer {
display: flex; margin-top: 8px;
gap: 8px; display: flex;
gap: 8px;
button {
flex: 1; button {
height: 40px; flex: 1;
font-weight: 600; height: 40px;
} font-weight: 600;
} }
} }
}

View file

@ -3,7 +3,7 @@
@import '../../utils/spacing.less'; @import '../../utils/spacing.less';
#interface.theme-light { #interface.theme-light {
.daggerheart.chat.deathmoves { .daggerheart.chat.death-moves {
.death-moves-list .death-move { .death-moves-list .death-move {
&:hover { &:hover {
background: @dark-blue-10; background: @dark-blue-10;
@ -36,7 +36,7 @@
} }
.daggerheart.chat { .daggerheart.chat {
&.deathmoves { &.death-moves {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@ -101,17 +101,13 @@
.description { .description {
padding: 8px; padding: 8px;
} }
.result {
padding: 8px;
}
} }
.action-use-button-parent { .action-use-button-parent {
width: 100%; width: 100%;
.action-use-target { .action-use-target {
display:flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
gap: 4px; gap: 4px;
@ -135,7 +131,11 @@
font-weight: 600; font-weight: 600;
height: 40px; height: 40px;
} }
}
.result {
padding: 8px;
font-weight: bold;
} }
} }
} }

View file

@ -6,6 +6,7 @@
@import './chat/effect-summary.less'; @import './chat/effect-summary.less';
@import './chat/group-roll.less'; @import './chat/group-roll.less';
@import './chat/refresh-message.less'; @import './chat/refresh-message.less';
@import './chat/deathmoves.less';
@import './chat/sheet.less'; @import './chat/sheet.less';
@import './combat-sidebar/combat-sidebar.less'; @import './combat-sidebar/combat-sidebar.less';

View file

@ -1,4 +1,4 @@
<div class="daggerheart chat deathmoves"> <div class="daggerheart chat death-moves">
<ul class="death-moves-list"> <ul class="death-moves-list">
<details class="death-move" {{this.open}}> <details class="death-move" {{this.open}}>
<summary class="death-label"> <summary class="death-label">
@ -12,9 +12,9 @@
<div class="description"> <div class="description">
{{{this.description}}} {{{this.description}}}
</div> </div>
<div class="result">
{{{this.result}}}
</div>
</details> </details>
</ul> </ul>
<div class="result">
{{{this.result}}}
</div>
</div> </div>