Enhance sheets and add skill+effects

This commit is contained in:
2026-05-22 20:14:28 +02:00
parent 78fa804dc5
commit e3f9dedcf6
18 changed files with 459 additions and 35 deletions
@@ -14,6 +14,8 @@ export default class AwECharacterSheet extends AwEActorSheet {
},
actions: {
createAbility: AwECharacterSheet.#onCreateAbility,
createSkill: AwECharacterSheet.#onCreateSkill,
createEffect: AwECharacterSheet.#onCreateEffect,
createWeapon: AwECharacterSheet.#onCreateWeapon,
createKit: AwECharacterSheet.#onCreateKit,
createEquipment: AwECharacterSheet.#onCreateEquipment,
@@ -94,6 +96,20 @@ export default class AwECharacterSheet extends AwEActorSheet {
usedToday: item.system.usedToday
}))
context.hasUsedAbilities = context.abilities.some(a => a.usedToday)
context.skills = doc.itemTypes.skill.map(item => ({
id: item.id,
uuid: item.uuid,
name: item.name,
img: item.img,
system: item.system
}))
context.effects = doc.itemTypes.effect.map(item => ({
id: item.id,
uuid: item.uuid,
name: item.name,
img: item.img,
system: item.system
}))
context.conditions = Object.values(SYSTEM.CONDITIONS).map(c => ({
...c,
label: game.i18n.localize(c.label),
@@ -188,6 +204,26 @@ export default class AwECharacterSheet extends AwEActorSheet {
this.document.createEmbeddedDocuments("Item", [{ name: CONFIG.Item.documentClass.defaultName({ type }), type }])
}
/**
* Create a new skill item.
* @param {Event} event - The triggering event.
* @param {HTMLElement} target - The target element.
*/
static #onCreateSkill(event, target) {
const type = "skill"
this.document.createEmbeddedDocuments("Item", [{ name: CONFIG.Item.documentClass.defaultName({ type }), type }])
}
/**
* Create a new effect item.
* @param {Event} event - The triggering event.
* @param {HTMLElement} target - The target element.
*/
static #onCreateEffect(event, target) {
const type = "effect"
this.document.createEmbeddedDocuments("Item", [{ name: CONFIG.Item.documentClass.defaultName({ type }), type }])
}
/**
* Create a new weapon item.
* @param {Event} event - The triggering event.