First PC sheet, WIP

This commit is contained in:
2025-12-20 17:20:01 +01:00
parent 189b03ca91
commit e75824cd20
19 changed files with 961 additions and 600 deletions
+6 -67
View File
@@ -7,7 +7,7 @@ export default class PrismRPGCharacterSheet extends PrismRPGActorSheet {
static DEFAULT_OPTIONS = {
classes: ["character"],
position: {
width: 750,
width: 780,
height: 780,
},
window: {
@@ -15,14 +15,9 @@ export default class PrismRPGCharacterSheet extends PrismRPGActorSheet {
},
actions: {
createEquipment: PrismRPGCharacterSheet.#onCreateEquipment,
rangedAttackDefense: PrismRPGCharacterSheet.#onRangedAttackDefense,
rollInitiative: PrismRPGCharacterSheet.#onRollInitiative,
armorHitPointsPlus: PrismRPGCharacterSheet.#onArmorHitPointsPlus,
armorHitPointsMinus: PrismRPGCharacterSheet.#onArmorHitPointsMinus,
divinityPointsPlus: PrismRPGCharacterSheet.#onDivinityPointsPlus,
divinityPointsMinus: PrismRPGCharacterSheet.#onDivinityPointsMinus,
aetherPointsPlus: PrismRPGCharacterSheet.#onAetherPointsPlus,
aetherPointsMinus: PrismRPGCharacterSheet.#onAetherPointsMinus,
},
}
@@ -49,11 +44,6 @@ export default class PrismRPGCharacterSheet extends PrismRPGActorSheet {
spells: {
template: "systems/fvtt-prism-rpg/templates/character-spells.hbs",
},
/* Miracles disabled - Legacy from Lethal Fantasy
miracles: {
template: "systems/fvtt-prism-rpg/templates/character-miracles.hbs",
},
*/
biography: {
template: "systems/fvtt-prism-rpg/templates/character-biography.hbs",
},
@@ -79,11 +69,6 @@ export default class PrismRPGCharacterSheet extends PrismRPGActorSheet {
if (this.actor.system.biodata.magicUser) {
tabs.spells = { id: "spells", group: "sheet", icon: "fa-sharp-duotone fa-solid fa-wand-magic-sparkles", label: "PRISMRPG.Label.spells" }
}
/* Miracles disabled - Legacy from Lethal Fantasy
if (this.actor.system.biodata.clericUser) {
tabs.miracles = { id: "miracles", group: "sheet", icon: "fa-sharp-duotone fa-solid fa-hands-praying", label: "PRISMRPG.Label.miracles" }
}
*/
for (const v of Object.values(tabs)) {
v.active = this.tabGroups[v.group] === v.id
v.cssClass = v.active ? "active" : ""
@@ -128,13 +113,6 @@ export default class PrismRPGCharacterSheet extends PrismRPGActorSheet {
context.spells = doc.itemTypes.spell
context.hasSpells = context.spells.length > 0
break
/* Miracles disabled - Legacy from Lethal Fantasy
case "miracles":
context.tab = context.tabs.miracles
context.miracles = doc.itemTypes.miracle
context.hasMiracles = context.miracles.length > 0
break
*/
case "combat":
context.tab = context.tabs.combat
context.weapons = doc.itemTypes.weapon
@@ -172,19 +150,6 @@ export default class PrismRPGCharacterSheet extends PrismRPGActorSheet {
}
}
static async #onRangedAttackDefense(event, target) {
// Future use : const hasTarget = false
let roll = await PrismRPGRoll.promptRangedDefense({
actorId: this.actor.id,
actorName: this.actor.name,
actorImage: this.actor.img,
})
if (!roll) return null
await roll.toMessage({}, { rollMode: roll.options.rollMode })
}
static async #onRollInitiative(event, target) {
await this.document.system.rollInitiative()
}
@@ -201,34 +166,6 @@ export default class PrismRPGCharacterSheet extends PrismRPGActorSheet {
this.actor.update({ "system.combat.armorHitPoints": Math.max(armorHP, 0) })
}
static #onDivinityPointsPlus(event, target) {
let points = this.actor.system.divinityPoints.value
points += 1
points = Math.min(points, this.actor.system.divinityPoints.max)
this.actor.update({ "system.divinityPoints.value": points })
}
static #onDivinityPointsMinus(event, target) {
let points = this.actor.system.divinityPoints.value
points -= 1
points = Math.max(points, 0)
this.actor.update({ "system.divinityPoints.value": points })
}
static #onAetherPointsPlus(event, target) {
let points = this.actor.system.aetherPoints.value
points += 1
points = Math.min(points, this.actor.system.aetherPoints.max)
this.actor.update({ "system.aetherPoints.value": points })
}
static #onAetherPointsMinus(event, target) {
let points = this.actor.system.aetherPoints.value
points -= 1
points = Math.max(points, 0)
this.actor.update({ "system.aetherPoints.value": points })
}
static #onCreateEquipment(event, target) {
}
@@ -269,9 +206,11 @@ export default class PrismRPGCharacterSheet extends PrismRPGActorSheet {
async _onRoll(event, target) {
if (this.isEditMode) return
const rollType = event.target.dataset.rollType
let rollKey = event.target.dataset.rollKey;
let rollDice = event.target.dataset?.rollDice;
// Use closest to find the rollable element in case user clicked on a child
const rollableElement = event.target.closest('.rollable') || event.target
const rollType = rollableElement.dataset.rollType
let rollKey = rollableElement.dataset.rollKey;
let rollDice = rollableElement.dataset?.rollDice;
this.actor.prepareRoll(rollType, rollKey, rollDice)