Enhancements as per issue tracking sheet
This commit is contained in:
@@ -14,6 +14,17 @@ export default class OathHammerArmorDialog {
|
||||
const isReinforced = [...(sys.traits ?? [])].includes("reinforced")
|
||||
const defaultColor = isReinforced ? "red" : "white"
|
||||
|
||||
// Luck
|
||||
const actorSys = actor.system
|
||||
const availableLuck = actorSys.luck?.value ?? 0
|
||||
const isHuman = (actorSys.lineage?.name ?? "").toLowerCase() === "human"
|
||||
const luckDicePerPoint = isHuman ? 3 : 2
|
||||
const luckOptions = Array.from({ length: availableLuck + 1 }, (_, i) => ({
|
||||
value: i,
|
||||
label: i === 0 ? "0" : `${i} (+${i * luckDicePerPoint}d)`,
|
||||
selected: i === 0,
|
||||
}))
|
||||
|
||||
// AP options — entered by the user based on the attacker's weapon
|
||||
const apOptions = Array.from({ length: 9 }, (_, i) => ({
|
||||
value: -i,
|
||||
@@ -45,6 +56,9 @@ export default class OathHammerArmorDialog {
|
||||
colorOptions,
|
||||
rollModes,
|
||||
visibility: game.settings.get("core", "rollMode"),
|
||||
availableLuck,
|
||||
isHuman,
|
||||
luckOptions,
|
||||
}
|
||||
|
||||
const content = await foundry.applications.handlebars.renderTemplate(
|
||||
@@ -55,6 +69,7 @@ export default class OathHammerArmorDialog {
|
||||
const result = await foundry.applications.api.DialogV2.wait({
|
||||
window: { title: game.i18n.format("OATHHAMMER.Dialog.ArmorRollTitle", { armor: armor.name }) },
|
||||
classes: ["fvtt-oath-hammer"],
|
||||
position: { width: 420 },
|
||||
content,
|
||||
rejectClose: false,
|
||||
buttons: [{
|
||||
@@ -80,6 +95,8 @@ export default class OathHammerArmorDialog {
|
||||
bonus: parseInt(result.bonus) || 0,
|
||||
visibility: result.visibility ?? game.settings.get("core", "rollMode"),
|
||||
explodeOn5: result.explodeOn5 === "true",
|
||||
luckSpend: Math.min(Math.max(0, parseInt(result.luckSpend) || 0), availableLuck),
|
||||
luckIsHuman: result.luckIsHuman === "true",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user