Improved chat card design. Fixed OOP bug with roll modifiers.

This commit is contained in:
Aaron Lutomski
2026-06-19 14:20:25 -07:00
parent b66d7b98ac
commit 5d4202b527
29 changed files with 781 additions and 707 deletions
+21 -27
View File
@@ -2,7 +2,9 @@ import DG, { BASE_TEMPLATE_PATH } from "../config/index.js";
import { prepareAgentSkillColumns } from "../utils/skill-layout.js";
import { formatProfessionSkillLabel } from "../profession/index.js";
import { buildSkillTooltip } from "../utils/skill-tooltip.js";
import createAgentResourceChatMessage from "../chat/resource-chat.js";
import createAgentResourceChatMessage, {
buildWillpowerChangeSpan,
} from "../chat/resource-chat.js";
import {
createSkillImprovementChatMessage,
evaluateSkillImprovementRolls,
@@ -428,13 +430,13 @@ export default class DGAgentSheet extends AgentSheetBase {
actor,
token: this.token,
roll: wpRoll,
contentKey: "DG.Physical.Chat.Exhausted",
labelKey: "DG.Physical.Chat.ExhaustedLabel",
rollLabelKey: "DG.Physical.Chat.ExhaustedRollLabel",
i18nData: {
name: actor.name,
loss,
current: newWp,
max: maxWp,
willpowerChange: buildWillpowerChangeSpan({
amount: loss,
current: newWp,
max: maxWp,
}),
},
});
}
@@ -461,16 +463,15 @@ export default class DGAgentSheet extends AgentSheetBase {
actor,
token: this.token,
roll: wpRoll,
contentKey: "DG.Physical.Chat.Rested",
labelKey: "DG.Physical.Chat.RestedLabel",
extraContentKey: wasExhausted
? "DG.Physical.Chat.RestedNoLongerExhausted"
: null,
rollLabelKey: wasExhausted
? "DG.Physical.Chat.RestedRollLabelExhausted"
: "DG.Physical.Chat.RestedRollLabel",
i18nData: {
name: actor.name,
gain,
current: newWp,
max: maxWp,
willpowerChange: buildWillpowerChangeSpan({
amount: gain,
current: newWp,
max: maxWp,
}),
},
});
}
@@ -526,26 +527,19 @@ export default class DGAgentSheet extends AgentSheetBase {
const formula = choice === "hard" ? "2d6" : "1d6";
const hoursRoll = await new Roll(formula).evaluate();
const hours = hoursRoll.total;
const contentKey =
const rollLabelKey =
choice === "hard"
? "DG.Physical.Chat.StimulantsHard"
: "DG.Physical.Chat.StimulantsRegular";
? "DG.Physical.Chat.StimulantsHardRollLabel"
: "DG.Physical.Chat.StimulantsRegularRollLabel";
const appliedHours = await applyStimulantEffect(actor, hours);
const labelKey =
choice === "hard"
? "DG.Physical.Chat.StimulantsHardLabel"
: "DG.Physical.Chat.StimulantsRegularLabel";
await createAgentResourceChatMessage({
actor,
token: this.token,
roll: hoursRoll,
contentKey,
labelKey,
rollLabelKey,
i18nData: {
name: actor.name,
hours: appliedHours,
},
});