Various enhancements + fixes

This commit is contained in:
2025-01-09 20:21:02 +01:00
parent b3a7f7380b
commit 3dcfc30fb6
38 changed files with 732 additions and 603 deletions

View File

@ -35,6 +35,9 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
spells: {
template: "systems/fvtt-lethal-fantasy/templates/character-spells.hbs",
},
miracles: {
template: "systems/fvtt-lethal-fantasy/templates/character-miracles.hbs",
},
biography: {
template: "systems/fvtt-lethal-fantasy/templates/character-biography.hbs",
},
@ -58,7 +61,9 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
if (this.actor.system.biodata.magicUser) {
tabs.spells = { id: "spells", group: "sheet", icon: "fa-sharp-duotone fa-solid fa-wand-magic-sparkles", label: "LETHALFANTASY.Label.spells" }
}
if (this.actor.system.biodata.clericUser) {
tabs.miracles = { id: "miracles", group: "sheet", icon: "fa-sharp-duotone fa-solid fa-hands-praying", label: "LETHALFANTASY.Label.miracles" }
}
for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] === v.id
v.cssClass = v.active ? "active" : ""
@ -71,14 +76,6 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
const context = await super._prepareContext()
context.tabs = this.#getTabs()
context.tooltipsCaracteristiques = {
}
context.tooltipsRessources = {
}
context.rollType = {
}
return context
}
@ -100,9 +97,13 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
case "spells":
context.tab = context.tabs.spells
context.spells = doc.itemTypes.spell
context.miracles = doc.itemTypes.miracle
context.hasSpells = context.spells.length > 0
break
case "miracles":
context.tab = context.tabs.miracles
context.miracles = doc.itemTypes.miracle
context.hasMiracles = context.miracles.length > 0
break
case "weapons":
context.tab = context.tabs.weapons
context.weapons = doc.itemTypes.weapon

View File

@ -282,6 +282,7 @@ export default class LethalFantasyRoll extends Roll {
titleFormula = `${dice}E`
}
// Specific pain case
if (options.rollType === "save" && options.rollTarget.rollKey === "pain") {
baseFormula = options.rollTarget.rollDice
titleFormula = `${dice}`
@ -289,6 +290,11 @@ export default class LethalFantasyRoll extends Roll {
fullModifier = 0
}
// Specific pain/poison/contagion case
if (options.rollType === "save" && options.rollTarget.rollKey.includes(["pain", "poison", "contagion"])) {
hasD30 = false
}
maxValue = Number(baseFormula.match(/\d+$/)[0]) // Update the max value agains
const rollData = {

View File

@ -55,11 +55,20 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
obj[save.id] = challengeField(save.label)
return obj
}, {}),
)
const woundFieldSchema = {
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
duration: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
description: new fields.StringField({ initial: "", required: false, nullable: true }),
}
schema.hp = new fields.SchemaField({
value: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
max: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
painDamage: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
wounds: new fields.ArrayField(new fields.SchemaField(woundFieldSchema ) ),
})
schema.perception = new fields.SchemaField({
@ -92,6 +101,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
eyes: new fields.StringField({ required: true, nullable: false, initial: "" }),
hair: new fields.StringField({ required: true, nullable: false, initial: "" }),
magicUser: new fields.BooleanField({ initial: false }),
clericUser: new fields.BooleanField({ initial: false }),
})
schema.modifiers = new fields.SchemaField({
@ -114,6 +124,7 @@ export default class LethalFantasyCharacter extends foundry.abstract.TypeDataMod
attackModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
defenseModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
damageModifier: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
armorHitPoints: new fields.NumberField({ ...requiredInteger, initial: 0, min: 0 }),
})
const moneyField = (label) => {

View File

@ -29,7 +29,9 @@ export default class LethalFantasyMiracle extends foundry.abstract.TypeDataModel
schema.areaAffected = new fields.StringField({ required: true, initial: "" })
schema.duration = new fields.StringField({ required: true, initial: "" })
schema.savingThrow = new fields.StringField({ required: true, initial: "" })
schema.materialComponent = new fields.StringField({ required: true, initial: "" })
schema.catalyst = new fields.StringField({ required: true, initial: "" })
return schema
}

View File

@ -30,6 +30,7 @@ export default class LethalFantasySpell extends foundry.abstract.TypeDataModel {
schema.duration = new fields.StringField({ required: true, initial: "" })
schema.savingThrow = new fields.StringField({ required: true, initial: "" })
schema.extraAetherPoints = new fields.StringField({ required: true, initial: "" })
schema.materialComponent = new fields.StringField({ required: true, initial: "" })
return schema
}