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
+1 -1
View File
@@ -139,7 +139,7 @@ export const SYSTEM = {
{ name: "Clothing (Average)", type: "armor", armorDie: "d2", penalty: 0 },
{ name: "Helm", type: "armor", armorDie: "d2", penalty: 0 },
{ name: "Medium Shield", type: "shield", armorDie: "d4", penalty: 0 },
{ name: "Gambeson", type: "armor", armorDie: "d4", penalty: 0 },
{ name: "Gambeson", type: "armor", armorDie: "d2", penalty: 0 },
{ name: "Padded Leather", type: "armor", armorDie: "d4", penalty: 1 },
{ name: "Chain Shirt", type: "armor", armorDie: "d6", penalty: 1 },
{ name: "Half Plate", type: "armor", armorDie: "d8", penalty: 2 },
+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,
})
+2 -10
View File
@@ -54,7 +54,7 @@ export default class MGNECharacter extends foundry.abstract.TypeDataModel {
// Compute current load per RAW:
// Only items with a weight field count — features and creature-traits are excluded
// trivial = 0, light = 10 per slot, normal = 1, heavy = fills remaining capacity (max 1)
// trivial = 0, light = 10 per slot, normal = 1, heavy = 2
let normalLoad = 0
let lightCount = 0
let heavyCount = 0
@@ -71,15 +71,7 @@ export default class MGNECharacter extends foundry.abstract.TypeDataModel {
this.lightItemCount = lightCount
this.heavyItemCount = heavyCount
if (heavyCount >= 2) {
// Can't carry two heavy items — automatically overloaded
this.currentLoad = this.carryCapacity + (heavyCount - 1)
} else if (heavyCount === 1) {
// Heavy fills remaining capacity; other items fit alongside it
this.currentLoad = Math.max(normalLoad, this.carryCapacity)
} else {
this.currentLoad = normalLoad
}
this.currentLoad = normalLoad + heavyCount * 2
this.overloaded = this.currentLoad > this.carryCapacity
}