mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-15 21:21:08 +01:00
Risk It All success chat message start
This commit is contained in:
parent
89ba240998
commit
70f4e5f4e5
6 changed files with 51 additions and 12 deletions
11
lang/en.json
11
lang/en.json
|
|
@ -2660,12 +2660,15 @@
|
||||||
},
|
},
|
||||||
"deathMove": {
|
"deathMove": {
|
||||||
"title": "Death Move",
|
"title": "Death Move",
|
||||||
"gainScar": "You gained a scar",
|
"gainScar": "You gained a scar.",
|
||||||
"avoidScar": "You have avoided a new 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.",
|
"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",
|
"riskItAllCritical": "Critical Rolled, clearing all marked Stress and Hit Points.",
|
||||||
"riskItAllFailure": "The fear die rolled higher. You have crossed through the veil of death.",
|
"riskItAllFailure": "The fear die rolled higher. You have crossed through the veil of death.",
|
||||||
"blazeOfGlory": "Blaze of Glory Effect Added!"
|
"blazeOfGlory": "Blaze of Glory Effect Added!",
|
||||||
|
"riskItAllClearStressAndHitPoints": "Clear {hope} Stress Or Hit Points.",
|
||||||
|
"riskItAllSuccessWithEnoughHope": "Hope roll value is more than the marked Stress and Hit Points, clearing both.",
|
||||||
|
"riskItAllSuccess": "The hope die rolled higher, clear up to {hope} Stress Or Hit Points."
|
||||||
},
|
},
|
||||||
"dicePool": {
|
"dicePool": {
|
||||||
"title": "Dice Pool"
|
"title": "Dice Pool"
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
|
|
||||||
this.actor = actor;
|
this.actor = actor;
|
||||||
this.selectedMove = null;
|
this.selectedMove = null;
|
||||||
|
this.showRiskItAllButton = false;
|
||||||
|
this.riskItAllButtonLabel = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
get title() {
|
get title() {
|
||||||
|
|
@ -98,16 +100,17 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
}
|
}
|
||||||
|
|
||||||
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('Hope rolled', config.roll.hope.value);
|
|
||||||
if (
|
if (
|
||||||
config.roll.hope.value >=
|
config.roll.hope.value >=
|
||||||
this.actor.system.resources.hitPoints.value + this.actor.system.resources.stress.value
|
this.actor.system.resources.hitPoints.value + this.actor.system.resources.stress.value
|
||||||
) {
|
) {
|
||||||
config.resourceUpdates.addResources(clearAllStressAndHitpointsUpdates);
|
config.resourceUpdates.addResources(clearAllStressAndHitpointsUpdates);
|
||||||
chatMessage = 'Hope roll value is more than the marked Stress and Hit Points, clearing both.';
|
chatMessage = game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.riskItAllSuccessWithEnoughHope');
|
||||||
|
} else {
|
||||||
|
chatMessage = game.i18n.format('DAGGERHEART.UI.Chat.deathMove.riskItAllSuccess', { hope: config.roll.hope.value })
|
||||||
|
this.showRiskItAllButton = true;
|
||||||
|
this.riskItAllButtonLabel = game.i18n.format('DAGGERHEART.UI.Chat.deathMove.riskItAllClearStressAndHitPoints', { hope: config.roll.hope.value })
|
||||||
}
|
}
|
||||||
chatMessage = 'TODO - need to clear Stress and/or Hit Points up to: ' + config.roll.hope.value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.roll.result.duality == -1) {
|
if (config.roll.result.duality == -1) {
|
||||||
|
|
@ -180,7 +183,9 @@ export default class DhDeathMove extends HandlebarsApplicationMixin(ApplicationV
|
||||||
description: game.i18n.localize(this.selectedMove.description),
|
description: game.i18n.localize(this.selectedMove.description),
|
||||||
result: result,
|
result: result,
|
||||||
open: autoExpandDescription ? 'open' : '',
|
open: autoExpandDescription ? 'open' : '',
|
||||||
chevron: autoExpandDescription ? 'fa-chevron-up' : 'fa-chevron-down'
|
chevron: autoExpandDescription ? 'fa-chevron-up' : 'fa-chevron-down',
|
||||||
|
showRiskItAllButton: this.showRiskItAllButton,
|
||||||
|
riskItAllButtonLabel: this.riskItAllButtonLabel
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
title: game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.title'),
|
title: game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.title'),
|
||||||
|
|
|
||||||
|
|
@ -728,9 +728,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
||||||
if (!result) return;
|
if (!result) return;
|
||||||
|
|
||||||
/* This could be avoided by baking config.costs into config.resourceUpdates. Didn't feel like messing with it at the time */
|
/* This could be avoided by baking config.costs into config.resourceUpdates. Didn't feel like messing with it at the time */
|
||||||
const costResources = result.costs
|
const costResources = result.costs?.filter(x => x.enabled)
|
||||||
.filter(x => x.enabled)
|
.map(cost => ({ ...cost, value: -cost.value, total: -cost.total })) || {};
|
||||||
.map(cost => ({ ...cost, value: -cost.value, total: -cost.total }));
|
|
||||||
config.resourceUpdates.addResources(costResources);
|
config.resourceUpdates.addResources(costResources);
|
||||||
await config.resourceUpdates.updateResources();
|
await config.resourceUpdates.updateResources();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,9 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
html.querySelectorAll('.group-roll-header-expand-section').forEach(element =>
|
html.querySelectorAll('.group-roll-header-expand-section').forEach(element =>
|
||||||
element.addEventListener('click', this.groupRollExpandSection)
|
element.addEventListener('click', this.groupRollExpandSection)
|
||||||
);
|
);
|
||||||
|
html.querySelectorAll('.risk-it-all-button').forEach(element =>
|
||||||
|
element.addEventListener('click', event => this.riskItAllClearStressAndHitPoints(event, message))
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
setupHooks() {
|
setupHooks() {
|
||||||
|
|
@ -370,4 +373,11 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
});
|
});
|
||||||
event.target.closest('.group-roll-section').querySelector('.group-roll-content').classList.toggle('closed');
|
event.target.closest('.group-roll-section').querySelector('.group-roll-content').classList.toggle('closed');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
async riskItAllClearStressAndHitPoints(event, message) {
|
||||||
|
console.log("riskItAllClearStressAndHitPoints button hit!", event, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,10 @@
|
||||||
.result {
|
.result {
|
||||||
color: @dark;
|
color: @dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.risk-it-all-button {
|
||||||
|
color: @dark;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -137,5 +141,12 @@
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.risk-it-all-button {
|
||||||
|
width: -webkit-fill-available;
|
||||||
|
margin: 0 8px;
|
||||||
|
font-weight: 600;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,15 @@
|
||||||
<div class="result">
|
<div class="result">
|
||||||
{{{this.result}}}
|
{{{this.result}}}
|
||||||
</div>
|
</div>
|
||||||
|
{{#if this.showRiskItAllButton}}
|
||||||
|
<div>
|
||||||
|
<button class="risk-it-all-button">
|
||||||
|
<span>
|
||||||
|
{{this.riskItAllButtonLabel}}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<div>
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue