Update sheet again...

This commit is contained in:
2025-01-19 22:33:51 +01:00
parent 4198bf82be
commit 6d4a12252c
40 changed files with 416 additions and 166 deletions

View File

@ -119,12 +119,13 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
context.tab = context.tabs.combat
context.weapons = doc.itemTypes.weapon
context.armors = doc.itemTypes.armor
context.shields = doc.itemTypes.shield
break
case "equipment":
context.tab = context.tabs.equipment
context.equipments = doc.itemTypes.equipment
break
case "biography":
case "biography":
context.tab = context.tabs.biography
context.enrichedDescription = await TextEditor.enrichHTML(doc.system.description, { async: true })
context.enrichedNotes = await TextEditor.enrichHTML(doc.system.notes, { async: true })
@ -190,7 +191,7 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
static #onDivinityPointsMinus(event, target) {
let points = this.actor.system.divinityPoints.value
points -= 1
points -= 1
points = Math.max(points, 0)
this.actor.update({ "system.divinityPoints.value": points })
}
@ -208,7 +209,7 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
points = Math.max(points, 0)
this.actor.update({ "system.aetherPoints.value": points })
}
static #onCreateEquipment(event, target) {
}
@ -225,8 +226,8 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
let tab = foundry.utils.duplicate(this.actor.system.hp.wounds)
tab[index][fieldName] = newValue
console.log(tab, index, fieldName, newValue)
this.actor.update( { "system.hp.wounds": tab } );
})
this.actor.update({ "system.hp.wounds": tab });
})
}
super._onRender();
}
@ -279,6 +280,16 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
let rollTarget
let rollKey = event.target.dataset.rollKey
switch (rollType) {
case "granted":
rollTarget = {
name: rollKey,
formula: foundry.utils.duplicate(this.document.system.granted[rollKey]),
rollKey: rollKey
}
if ( rollTarget.formula === "" || rollTarget.formula === undefined) {
rollTarget.formula = 0
}
break;
case "challenge":
rollTarget = foundry.utils.duplicate(this.document.system.challenges[rollKey])
rollTarget.rollKey = rollKey
@ -336,12 +347,21 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
console.error("Weapon or skill not found", weapon, skill)
ui.notifications.warn(game.i18n.localize("LETHALFANTASY.Notifications.skillNotFound"))
return
}
}
rollTarget = skill
rollTarget.weapon = weapon
rollTarget.weaponSkillModifier = skill.weaponSkillModifier
rollTarget.rollKey = rollKey
rollTarget.combat = foundry.utils.duplicate(this.actor.system.combat)
if ( rollType === "weapon-damage-small" || rollType === "weapon-damage-medium") {
rollTarget.grantedDice = this.actor.system.granted.damageDice
}
if ( rollType === "weapon-attack") {
rollTarget.grantedDice = this.actor.system.granted.attackDice
}
if ( rollType === "weapon-defense") {
rollTarget.grantedDice = this.actor.system.granted.defenseDice
}
break
default:
ui.notifications.error(game.i18n.localize("LETHALFANTASY.Notifications.rollTypeNotFound") + String(rollType))
@ -351,7 +371,7 @@ export default class LethalFantasyCharacterSheet extends LethalFantasyActorSheet
// In all cases
rollTarget.magicUser = this.actor.system.biodata.magicUser
rollTarget.actorModifiers = foundry.utils.duplicate(this.actor.system.modifiers)
console.log(rollTarget)
console.log("ROLLTARGET", rollTarget)
await this.document.system.roll(rollType, rollTarget)
}
// #endregion