Skip to content

Commit 4c51d59

Browse files
committed
Fix apply damage rule action chat prompt
1 parent 33d7b85 commit 4c51d59

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

module/documents/effects/actions/apply-damage-rule-action.mjs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import { RuleActionDataModel } from './rule-action-data-model.mjs';
66
import { SETTINGS } from '../../../settings.js';
77
import { TraitsDataModel } from '../../items/common/traits-data-model.mjs';
88
import { DamageTraits, TraitUtils } from '../../../pipelines/traits.mjs';
9+
import { DamageData } from '../../../checks/damage-data.mjs';
910

1011
const fields = foundry.data.fields;
1112

1213
/**
1314
* @property {String} amount
14-
* @property {FU.damageTypes} damageType
15+
* @property {DamageType} damageType
1516
* @property {TraitsDataModel} traits
1617
*/
1718
export class ApplyDamageRuleAction extends RuleActionDataModel {
@@ -64,10 +65,8 @@ export class ApplyDamageRuleAction extends RuleActionDataModel {
6465
}
6566
}
6667
} else {
67-
const request = new DamageRequest(context.sourceInfo, targets, {
68-
type: this.damageType,
69-
total: evalAmount,
70-
});
68+
const damageData = DamageData.construct(this.damageType, evalAmount);
69+
const request = new DamageRequest(context.sourceInfo, targets, damageData);
7170
if (!this.traits.empty) {
7271
request.addTraits(this.traits.values);
7372
}

module/pipelines/damage-pipeline.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,13 @@ async function absorbDamage(resource, amount, sourceInfo, targets) {
739739
async function promptApply(request) {
740740
const targets = Targeting.serializeTargetData(request.targets);
741741
const damageData = request.damageData;
742+
const icon = FU.allIcon[request.damageType];
743+
const tooltip = StringUtils.localize('FU.ChatApplyDamageTooltip', {
744+
amount: damageData.total,
745+
type: StringUtils.localize(FU.damageTypes[request.damageType]),
746+
});
742747
const actions = [
743-
new ChatAction('applyDamage', 'fa-heart-crack', 'FU.ChatApplyDamageTooltip', {
748+
new ChatAction('applyDamage', icon, tooltip, {
744749
damageData: damageData,
745750
sourceInfo: request.sourceInfo,
746751
}).requiresOwner(),

module/pipelines/opportunity.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async function onOpportunity(event) {
3838
if (game.dice3d) {
3939
Hooks.once('diceSoNiceRollComplete', postChatMessage);
4040
} else {
41-
await postChatMessage();
41+
event.renderData.postRenderActions.push(postChatMessage);
4242
}
4343
}
4444

0 commit comments

Comments
 (0)