mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-12 19:51:08 +01:00
Initial damage message
This commit is contained in:
parent
afdffb672a
commit
362facae76
5 changed files with 95 additions and 4 deletions
|
|
@ -597,7 +597,9 @@ export default class DhpActor extends Actor {
|
|||
|
||||
await this.modifyResource(updates);
|
||||
|
||||
if (Hooks.call(`${CONFIG.DH.id}.postTakeDamage`, this, updates) === false) return null;
|
||||
Hooks.call(`${CONFIG.DH.id}.postTakeDamage`, this, updates);
|
||||
|
||||
return updates;
|
||||
}
|
||||
|
||||
calculateDamage(baseDamage, type) {
|
||||
|
|
@ -645,7 +647,8 @@ export default class DhpActor extends Actor {
|
|||
|
||||
await this.modifyResource(updates);
|
||||
|
||||
if (Hooks.call(`${CONFIG.DH.id}.postTakeHealing`, this, updates) === false) return null;
|
||||
Hooks.call(`${CONFIG.DH.id}.postTakeHealing`, this, updates);
|
||||
return updates;
|
||||
}
|
||||
|
||||
async modifyResource(resources) {
|
||||
|
|
|
|||
|
|
@ -156,6 +156,7 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
if (targets.length === 0)
|
||||
return ui.notifications.info(game.i18n.localize('DAGGERHEART.UI.Notifications.noTargetsSelected'));
|
||||
|
||||
const targetDamage = [];
|
||||
for (let target of targets) {
|
||||
let damages = foundry.utils.deepClone(this.system.damage);
|
||||
if (
|
||||
|
|
@ -174,9 +175,26 @@ export default class DhpChatMessage extends foundry.documents.ChatMessage {
|
|||
}
|
||||
|
||||
this.consumeOnSuccess();
|
||||
if (this.system.hasHealing) target.actor.takeHealing(damages);
|
||||
else target.actor.takeDamage(damages, this.system.isDirect);
|
||||
const updates = this.system.hasHealing
|
||||
? await target.actor.takeHealing(damages)
|
||||
: await target.actor.takeDamage(damages, this.system.isDirect);
|
||||
targetDamage.push({ token: target, updates: updates });
|
||||
}
|
||||
|
||||
const cls = getDocumentClass('ChatMessage');
|
||||
const msg = {
|
||||
user: game.user.id,
|
||||
speaker: cls.getSpeaker(),
|
||||
title: game.i18n.localize('DAGGERHEART.UI.Chat.deathMove.title'),
|
||||
content: await foundry.applications.handlebars.renderTemplate(
|
||||
'systems/daggerheart/templates/ui/chat/damageSummary.hbs',
|
||||
{
|
||||
targets: targetDamage
|
||||
}
|
||||
)
|
||||
};
|
||||
|
||||
cls.create(msg);
|
||||
}
|
||||
|
||||
getAction(actor, itemId, actionId) {
|
||||
|
|
|
|||
51
styles/less/ui/chat/damage-summary.less
Normal file
51
styles/less/ui/chat/damage-summary.less
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
.daggerheart.chat.damage-summary {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 4px;
|
||||
|
||||
.target-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
border: 1px solid light-dark(@dark-blue, @golden);
|
||||
border-radius: 6px;
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
border-bottom: 1px solid light-dark(@dark-blue, @golden);
|
||||
|
||||
img {
|
||||
flex: 0;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
padding: 0 0 0 2px;
|
||||
}
|
||||
|
||||
label {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 0 2px 0 0;
|
||||
}
|
||||
}
|
||||
|
||||
.damage-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
gap: 2px;
|
||||
|
||||
.damage-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 2px;
|
||||
gap: 4px;
|
||||
|
||||
label {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
@import './chat/ability-use.less';
|
||||
@import './chat/action.less';
|
||||
@import './chat/chat.less';
|
||||
@import './chat/damage-summary.less';
|
||||
@import './chat/downtime.less';
|
||||
@import './chat/sheet.less';
|
||||
|
||||
|
|
|
|||
18
templates/ui/chat/damageSummary.hbs
Normal file
18
templates/ui/chat/damageSummary.hbs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<div class="daggerheart chat damage-summary">
|
||||
{{#each targets}}
|
||||
<div class="target-container">
|
||||
<header>
|
||||
<img src="{{this.token.texture.src}}" />
|
||||
<label>{{this.token.name}}</label>
|
||||
</header>
|
||||
<div class="damage-container">
|
||||
{{#each this.updates}}
|
||||
<div class="damage-row">
|
||||
<label>{{localize (concat "DAGGERHEART.CONFIG.HealingType." this.key ".name")}}:</label>
|
||||
<div>{{this.value}}</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue