Added effect message

This commit is contained in:
WBHarry 2025-08-25 22:43:58 +02:00
parent 744412bf9f
commit 30229407cd
5 changed files with 106 additions and 1 deletions

View file

@ -2322,6 +2322,7 @@
"action": {
"title": "Action"
},
"appliedTo": "Applied To",
"applyEffect": {
"title": "Apply Effects - {name}"
},
@ -2331,6 +2332,10 @@
"rollHealing": "Roll Healing",
"applyEffect": "Apply Effects"
},
"damageSummary": {
"title": "Damage Applied",
"healingTitle": "Healing Applied"
},
"damageRoll": {
"title": "Damage - {damage}",
"dealDamageToTargets": "Damage Hit Targets",
@ -2352,6 +2357,9 @@
"dualityRoll": {
"abilityCheckTitle": "{ability} Check"
},
"effectSummary": {
"title": "Effects Applied"
},
"featureTitle": "Class Feature",
"healingRoll": {
"title": "Heal - {damage}",

View file

@ -220,7 +220,9 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
const msg = {
user: game.user.id,
speaker: cls.getSpeaker(),
title: game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.title'),
title: game.i18n.localize(
`DAGGERHEART.UI.Chat.damageSummary.${this.system.hasHealing ? 'healingTitle' : 'title'}`
),
content: await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/ui/chat/damageSummary.hbs',
{
@ -255,6 +257,25 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
this.consumeOnSuccess();
await action.applyEffects(event, this, targets);
const effects = this.system.action.item.effects.filter(effect =>
this.system.action.effects.some(x => x._id === effect.id)
);
const cls = getDocumentClass('ChatMessage');
const msg = {
user: game.user.id,
speaker: cls.getSpeaker(),
title: game.i18n.localize('DAGGERHEART.UI.Chat.effectSummary.title'),
content: await foundry.applications.handlebars.renderTemplate(
'systems/daggerheart/templates/ui/chat/effectSummary.hbs',
{
effects,
targets
}
)
};
cls.create(msg);
}
}

View file

@ -0,0 +1,54 @@
.daggerheart.chat.effect-summary {
display: flex;
flex-direction: column;
h5 {
color: light-dark(@dark, @beige);
margin: 0;
text-align: center;
}
.effects-container {
display: flex;
flex-wrap: wrap;
gap: 4px;
margin-bottom: 8px;
}
.targets-container {
display: flex;
flex-direction: column;
gap: 4px;
}
.effect-target-container,
.token-target-container {
display: flex;
align-items: center;
gap: 2px;
border: 1px solid light-dark(@dark-blue, @golden);
border-radius: 6px;
padding: 0 2px;
img {
width: 24px;
height: 24px;
flex: 0;
pointer-events: none;
}
label {
flex: 1;
text-align: center;
pointer-events: none;
}
}
.token-target-container {
cursor: pointer;
&:hover {
filter: drop-shadow(0 0 3px @golden);
}
}
}

View file

@ -3,6 +3,7 @@
@import './chat/chat.less';
@import './chat/damage-summary.less';
@import './chat/downtime.less';
@import './chat/effect-summary.less';
@import './chat/sheet.less';
@import './combat-sidebar/combat-sidebar.less';

View file

@ -0,0 +1,21 @@
<div class="daggerheart chat effect-summary">
<h5>{{localize "DAGGERHEART.GENERAL.Effect.plural"}}</h5>
<div class="effects-container">
{{#each effects}}
<div class="effect-target-container" data-tooltip="{{concat "#item#" this.uuid}}">
<img src="{{this.img}}" />
<label>{{this.name}}</label>
</div>
{{/each}}
</div>
<h5>{{localize "DAGGERHEART.UI.Chat.appliedTo"}}</h5>
<div class="targets-container">
{{#each targets}}
<div class="token-target-container" data-token-uuid="{{this.uuid}}">
<img src="{{this.texture.src}}" />
<label>{{this.name}}</label>
</div>
{{/each}}
</div>
</div>