Various fixes for official release

This commit is contained in:
2026-06-08 22:20:44 +02:00
parent 7623123bb5
commit 3851a38c9f
108 changed files with 1011 additions and 538 deletions
+25 -7
View File
@@ -48,14 +48,28 @@ function numericOptions(min, max, current = null) {
})
}
const OUTCOME_ICONS = {
"critical-success": '<i class="fa-solid fa-star"></i>',
"success": '<i class="fa-solid fa-check"></i>',
"steady": '<i class="fa-solid fa-minus"></i>',
"failure": '<i class="fa-solid fa-xmark"></i>',
"broken": '<i class="fa-solid fa-skull"></i>',
"fumble": '<i class="fa-solid fa-skull"></i>',
"rolled": '<i class="fa-solid fa-bolt"></i>',
}
const SPECIAL_ICONS = {
default: '<i class="fa-solid fa-circle-info"></i>',
}
async function renderCard(context) {
const outcomeClass = `${context.outcome ?? ""}`
.toLowerCase()
.replace(/[^a-z0-9]+/g, "-")
.replace(/^-|-$/g, "")
const eyebrow = context.eyebrow ?? getChatModeLabel(context.mode ?? "generic")
const normalizedEyebrow = `${eyebrow}`.trim().toLowerCase()
const normalizedLabel = `${context.label ?? ""}`.trim().toLowerCase()
const modeLabel = getChatModeLabel(context.mode ?? "generic")
const outcomeIcon = OUTCOME_ICONS[outcomeClass] || ""
const specialIcon = SPECIAL_ICONS.default
// Render dice tooltip HTML if a roll was provided
const diceTooltip = context._roll ? await context._roll.render() : null
@@ -63,8 +77,10 @@ async function renderCard(context) {
return foundry.applications.handlebars.renderTemplate(`systems/${SYSTEM_ID}/templates/chat-message.hbs`, {
...context,
modeClass: context.mode ?? "generic",
eyebrow: "",
modeLabel,
outcomeClass,
outcomeIcon,
specialIcon,
diceTooltip,
})
}
@@ -208,7 +224,7 @@ export default class MGNERoll {
return { roll, broken }
}
static async rollDamage({ actor, item }) {
static async rollDamage({ actor, item, targetActor = null }) {
const damageBonus = await actor.consumePendingDamageBonus(item.id)
const multiplier = damageBonus?.multiplier ?? 1
const baseFormula = item.system.damage || "1"
@@ -242,7 +258,7 @@ export default class MGNERoll {
mode: "damage",
actorName: actor.name,
actorImg: actor.img,
label: `${item.name} Damage`,
label: f("MGNE.Roll.ItemDamageLabel", { item: item.name }),
subtitle: null,
formula: roll.formula,
total: roll.total,
@@ -252,6 +268,7 @@ export default class MGNERoll {
showApplyButton: true,
damageTotal: roll.total,
damageCritical: isCritical,
damageTargetActorId: targetActor?.id ?? null,
_roll: roll,
})
@@ -264,7 +281,7 @@ export default class MGNERoll {
return { roll }
}
static async rollFlatDamage({ actor, label, formula }) {
static async rollFlatDamage({ actor, label, formula, targetActor = null }) {
const damageBonus = await actor.consumePendingDamageBonus("profile-attack")
const multiplier = damageBonus?.multiplier ?? 1
const baseFormula = formula || "1"
@@ -284,6 +301,7 @@ export default class MGNERoll {
showApplyButton: true,
damageTotal: roll.total,
damageCritical: isCritical,
damageTargetActorId: targetActor?.id ?? null,
_roll: roll,
})