Enhance sheets and add skill+effects
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user