mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-07-24 03:19:55 +02:00
Fixed ChatMessage damage view
This commit is contained in:
parent
a98e1cef90
commit
a88031e279
2 changed files with 75 additions and 49 deletions
|
|
@ -251,15 +251,17 @@ export default class DhpChatLog extends foundry.applications.sidebar.tabs.ChatLo
|
||||||
}
|
}
|
||||||
|
|
||||||
const message = game.messages.get(messageData._id);
|
const message = game.messages.get(messageData._id);
|
||||||
const target = event.target.closest('[data-die-index]');
|
const target = event.target.closest('[data-result]');
|
||||||
|
|
||||||
if (target.dataset.type === 'damage') {
|
if (target.dataset.type === 'damage') {
|
||||||
const { isResource, damageType, dice, result } = target.dataset;
|
const { isResource, damageType, dice, result } = target.dataset;
|
||||||
await message.system.damage.rerollDamageDie(isResource, damageType, dice, result);
|
await message.system.damage.rerollDamageDie(isResource, damageType, dice, result);
|
||||||
|
|
||||||
const updatePath = isResource ? `system.damage.resources.${damageType}` : 'system.damage.main';
|
const updatePath = isResource ? `system.damage.resources.${damageType}` : 'system.damage.main';
|
||||||
|
const updateValue = isResource ?
|
||||||
|
message.system.damage.resources[damageType] : message.system.damage.main;
|
||||||
await message.update({
|
await message.update({
|
||||||
[updatePath]: message.system.damage.types[damageType].toJSON()
|
[updatePath]: updateValue.toJSON()
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
const rerollDice = message.system.roll.dice[target.dataset.dieIndex];
|
const rerollDice = message.system.roll.dice[target.dataset.dieIndex];
|
||||||
|
|
|
||||||
|
|
@ -10,60 +10,84 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="roll-part-extra on-reduced">
|
<div class="roll-part-extra on-reduced">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
{{#each damage.types as | roll index | }}
|
{{#if damage.main}}
|
||||||
<div class="roll-formula">{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll')}}: {{roll.total}}</div>
|
{{> formula roll=damage.main label=(ifThen hasHealing (localize "DAGGERHEART.GENERAL.healing") (localize "DAGGERHEART.GENERAL.damage")) }}
|
||||||
|
{{/if}}
|
||||||
|
{{#each damage.resources as | roll index | }}
|
||||||
|
{{> formula roll=roll label=(ifThen ../hasHealing (localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.name')) (localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll'))) }}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="roll-part-content dice-result">
|
<div class="roll-part-content dice-result">
|
||||||
<div class="dice-tooltip">
|
<div class="dice-tooltip">
|
||||||
<div class="wrapper">
|
<div class="wrapper">
|
||||||
{{#each damage.types as | roll index | }}
|
{{#if damage.main}}
|
||||||
<fieldset>
|
{{> damage
|
||||||
<legend>
|
label=(ifThen hasHealing (localize "DAGGERHEART.GENERAL.healing") (localize "DAGGERHEART.GENERAL.damage"))
|
||||||
{{#if ../hasHealing}}{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.name')}}{{else}}{{localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll')}}{{/if}} <div class="roll-formula">{{localize "DAGGERHEART.GENERAL.total"}}: {{roll.total}}</div>{{#if (and (eq index "hitPoints") ../isDirect)}} <div class="roll-formula">{{localize "DAGGERHEART.CONFIG.DamageType.direct.short"}}</div>{{/if}}
|
roll=damage.main
|
||||||
</legend>
|
index=0
|
||||||
|
}}
|
||||||
|
{{/if}}
|
||||||
|
|
||||||
{{#if (and (not @root.hasHealing) roll.options.damageTypes.length)}}
|
{{#each damage.resources as | roll index | }}
|
||||||
<label class="roll-part-header"><span>
|
{{> damage
|
||||||
{{#each roll.options.damageTypes}}
|
label=(ifThen ../hasHealing (localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.name')) (localize (concat 'DAGGERHEART.CONFIG.HealingType.' index '.inChatRoll')))
|
||||||
{{localize (concat 'DAGGERHEART.CONFIG.ArmorFeature.' this '.name')}}
|
roll=roll
|
||||||
{{#unless @last}}/{{/unless}}
|
index=index
|
||||||
{{/each}}
|
isResource=true
|
||||||
<div class="roll-formula">{{roll.total}}</div></span></label>
|
}}
|
||||||
{{/if}}
|
|
||||||
<div class="roll-dice">
|
|
||||||
{{#if roll.dice.length}}
|
|
||||||
{{#each roll.dice}}
|
|
||||||
{{#each results}}
|
|
||||||
{{#if active}}
|
|
||||||
<div class="roll-die{{#unless @../first}} has-plus{{/unless}}">
|
|
||||||
<div
|
|
||||||
class="dice reroll-button {{../denomination}}"
|
|
||||||
data-die-index="0" data-type="damage" data-damage-type="{{@../../key}}" data-dice="{{@../key}}" data-result="{{@key}}"
|
|
||||||
>
|
|
||||||
{{#if hasRerolls}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerolled"}}"></i>{{/if}}
|
|
||||||
{{result}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{/each}}
|
|
||||||
{{/each}}
|
|
||||||
|
|
||||||
{{#if roll.modifierTotal}}
|
|
||||||
<div class="roll-die{{#if (gt roll.modifierTotal 0)}} has-plus{{/if}}">
|
|
||||||
<div class="font-20">{{roll.modifierTotal}}</div>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
<div class="roll-die">
|
|
||||||
<div class="font-20">{{roll.total}}</div>
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
</fieldset>
|
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{#*inline "formula"}}
|
||||||
|
<div class="roll-formula">{{label}}: {{roll.total}}</div>
|
||||||
|
{{/inline}}
|
||||||
|
|
||||||
|
{{#*inline "damage"}}
|
||||||
|
<fieldset>
|
||||||
|
<legend>
|
||||||
|
{{label}}
|
||||||
|
<div class="roll-formula">{{localize "DAGGERHEART.GENERAL.total"}}: {{roll.total}}</div>{{#if (and (eq index "hitPoints") ../isDirect)}} <div class="roll-formula">{{localize "DAGGERHEART.CONFIG.DamageType.direct.short"}}</div>{{/if}}
|
||||||
|
</legend>
|
||||||
|
{{#if (and (not @root.hasHealing) roll.options.damageTypes.length)}}
|
||||||
|
<label class="roll-part-header"><span>
|
||||||
|
{{#each roll.options.damageTypes}}
|
||||||
|
{{localize (concat 'DAGGERHEART.CONFIG.ArmorFeature.' this '.name')}}
|
||||||
|
{{#unless @last}}/{{/unless}}
|
||||||
|
{{/each}}
|
||||||
|
<div class="roll-formula">{{roll.total}}</div></span></label>
|
||||||
|
{{/if}}
|
||||||
|
<div class="roll-dice">
|
||||||
|
{{#if roll.dice.length}}
|
||||||
|
{{#each roll.dice}}
|
||||||
|
{{#each results}}
|
||||||
|
{{#if active}}
|
||||||
|
<div class="roll-die{{#unless @../first}} has-plus{{/unless}}">
|
||||||
|
<div
|
||||||
|
class="dice reroll-button {{../denomination}}"
|
||||||
|
data-type="damage" data-damage-type="{{@../../key}}" data-dice="{{@../key}}" data-result="{{@key}}" {{#if ../../isResource}}data-is-resource="true"{{/if}}
|
||||||
|
>
|
||||||
|
{{#if hasRerolls}}<i class="fa-solid fa-dice dice-rerolled" data-tooltip="{{localize "DAGGERHEART.GENERAL.rerolled"}}"></i>{{/if}}
|
||||||
|
{{result}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{/each}}
|
||||||
|
{{/each}}
|
||||||
|
|
||||||
|
{{#if roll.modifierTotal}}
|
||||||
|
<div class="roll-die{{#if (gt roll.modifierTotal 0)}} has-plus{{/if}}">
|
||||||
|
<div class="font-20">{{roll.modifierTotal}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
{{else}}
|
||||||
|
<div class="roll-die">
|
||||||
|
<div class="font-20">{{roll.total}}</div>
|
||||||
|
</div>
|
||||||
|
{{/if}}
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
{{/inline}}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue