Fix skills and multiple maneuvers per weapons
This commit is contained in:
@@ -24,8 +24,44 @@ export default class PrismRPGWeaponSheet extends PrismRPGItemSheet {
|
||||
const context = await super._prepareContext()
|
||||
context.enrichedDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.description, { async: true })
|
||||
context.enrichedPassiveDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.passiveDescription, { async: true })
|
||||
context.enrichedManeuverDescription = await foundry.applications.ux.TextEditor.implementation.enrichHTML(this.document.system.maneuverDescription, { async: true })
|
||||
|
||||
// Enrich descriptions for all maneuvers
|
||||
context.enrichedManeuvers = await Promise.all(
|
||||
this.document.system.maneuvers.map(async (maneuver) => ({
|
||||
...maneuver,
|
||||
enrichedDescription: await foundry.applications.ux.TextEditor.implementation.enrichHTML(maneuver.description, { async: true })
|
||||
}))
|
||||
)
|
||||
|
||||
return context
|
||||
}
|
||||
|
||||
/** @override */
|
||||
_onRender(context, options) {
|
||||
super._onRender(context, options)
|
||||
|
||||
// Add event listeners for maneuver management
|
||||
this.element.querySelectorAll('[data-action="add-maneuver"]').forEach(el => {
|
||||
el.addEventListener("click", this._onAddManeuver.bind(this))
|
||||
})
|
||||
|
||||
this.element.querySelectorAll('[data-action="delete-maneuver"]').forEach(el => {
|
||||
el.addEventListener("click", this._onDeleteManeuver.bind(this))
|
||||
})
|
||||
}
|
||||
|
||||
async _onAddManeuver(event) {
|
||||
event.preventDefault()
|
||||
const maneuvers = [...this.document.system.maneuvers]
|
||||
maneuvers.push({ name: "", description: "" })
|
||||
await this.document.update({ "system.maneuvers": maneuvers })
|
||||
}
|
||||
|
||||
async _onDeleteManeuver(event) {
|
||||
event.preventDefault()
|
||||
const index = parseInt(event.currentTarget.closest("[data-maneuver-index]").dataset.maneuverIndex)
|
||||
const maneuvers = this.document.system.maneuvers.filter((_, i) => i !== index)
|
||||
await this.document.update({ "system.maneuvers": maneuvers })
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+19
-63
@@ -4,98 +4,80 @@
|
||||
* - +5 bonus to basic skill checks
|
||||
* - Access to advanced skill checks
|
||||
* - Access to a Core Skill Class (based on archetype)
|
||||
* - +2 to one of 3 associated attributes
|
||||
* - +2 to one chosen attribute
|
||||
*/
|
||||
export const CORE_SKILLS = Object.freeze({
|
||||
acrobatics: {
|
||||
id: "acrobatics",
|
||||
label: "PRISMRPG.Skill.CoreSkill.acrobatics",
|
||||
attributeChoices: ["dex", "wis", "con"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.acrobatics"
|
||||
},
|
||||
animalHandling: {
|
||||
id: "animalHandling",
|
||||
label: "PRISMRPG.Skill.CoreSkill.animalHandling",
|
||||
attributeChoices: ["str", "con", "dex"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.animalHandling"
|
||||
},
|
||||
arcana: {
|
||||
id: "arcana",
|
||||
label: "PRISMRPG.Skill.CoreSkill.arcana",
|
||||
attributeChoices: ["str", "int", "wis"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.arcana"
|
||||
},
|
||||
athletics: {
|
||||
id: "athletics",
|
||||
label: "PRISMRPG.Skill.CoreSkill.athletics",
|
||||
attributeChoices: ["str", "dex", "con"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.athletics"
|
||||
},
|
||||
deception: {
|
||||
id: "deception",
|
||||
label: "PRISMRPG.Skill.CoreSkill.deception",
|
||||
attributeChoices: ["int", "wis", "cha"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.deception"
|
||||
},
|
||||
history: {
|
||||
id: "history",
|
||||
label: "PRISMRPG.Skill.CoreSkill.history",
|
||||
attributeChoices: ["str", "wis", "con"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.history"
|
||||
},
|
||||
insight: {
|
||||
id: "insight",
|
||||
label: "PRISMRPG.Skill.CoreSkill.insight",
|
||||
attributeChoices: ["int", "cha", "wis"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.insight"
|
||||
},
|
||||
intimidate: {
|
||||
id: "intimidate",
|
||||
label: "PRISMRPG.Skill.CoreSkill.intimidate",
|
||||
attributeChoices: ["str", "cha", "wis"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.intimidate"
|
||||
},
|
||||
investigation: {
|
||||
id: "investigation",
|
||||
label: "PRISMRPG.Skill.CoreSkill.investigation",
|
||||
attributeChoices: ["int", "wis", "con"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.investigation"
|
||||
},
|
||||
medicine: {
|
||||
id: "medicine",
|
||||
label: "PRISMRPG.Skill.CoreSkill.medicine",
|
||||
attributeChoices: ["con", "wis", "int"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.medicine"
|
||||
},
|
||||
nature: {
|
||||
id: "nature",
|
||||
label: "PRISMRPG.Skill.CoreSkill.nature",
|
||||
attributeChoices: ["str", "wis", "int"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.nature"
|
||||
},
|
||||
perception: {
|
||||
id: "perception",
|
||||
label: "PRISMRPG.Skill.CoreSkill.perception",
|
||||
attributeChoices: ["dex", "wis", "cha"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.perception"
|
||||
},
|
||||
performance: {
|
||||
id: "performance",
|
||||
label: "PRISMRPG.Skill.CoreSkill.performance",
|
||||
attributeChoices: ["str", "cha", "wis"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.performance"
|
||||
},
|
||||
persuasion: {
|
||||
id: "persuasion",
|
||||
label: "PRISMRPG.Skill.CoreSkill.persuasion",
|
||||
attributeChoices: ["cha", "dex", "int"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.persuasion"
|
||||
},
|
||||
religion: {
|
||||
id: "religion",
|
||||
label: "PRISMRPG.Skill.CoreSkill.religion",
|
||||
attributeChoices: ["str", "wis", "cha"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.religion"
|
||||
},
|
||||
sleightOfHand: {
|
||||
id: "sleightOfHand",
|
||||
label: "PRISMRPG.Skill.CoreSkill.sleightOfHand",
|
||||
attributeChoices: ["dex", "wis", "int"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.sleightOfHand"
|
||||
},
|
||||
stealth: {
|
||||
id: "stealth",
|
||||
label: "PRISMRPG.Skill.CoreSkill.stealth",
|
||||
attributeChoices: ["int", "dex", "cha"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.stealth"
|
||||
},
|
||||
survival: {
|
||||
id: "survival",
|
||||
label: "PRISMRPG.Skill.CoreSkill.survival",
|
||||
attributeChoices: ["int", "con", "cha"]
|
||||
label: "PRISMRPG.Skill.CoreSkill.survival"
|
||||
}
|
||||
});
|
||||
|
||||
@@ -130,29 +112,3 @@ export const CORE_SKILL_BONUS = Object.freeze({
|
||||
basic: 5, // +5 to basic skill checks
|
||||
attributeBonus: 2 // +2 to chosen attribute
|
||||
});
|
||||
|
||||
/**
|
||||
* Legacy skill categories (may be deprecated)
|
||||
*/
|
||||
export const CATEGORY = Object.freeze({
|
||||
layperson: {
|
||||
id: "layperson",
|
||||
label: "PRISMRPG.Skill.Category.layperson",
|
||||
},
|
||||
professional: {
|
||||
id: "professional",
|
||||
label: "PRISMRPG.Skill.Category.professional",
|
||||
},
|
||||
weapon: {
|
||||
id: "weapon",
|
||||
label: "PRISMRPG.Skill.Category.weapon",
|
||||
},
|
||||
armor: {
|
||||
id: "armor",
|
||||
label: "PRISMRPG.Skill.Category.armor",
|
||||
},
|
||||
resist: {
|
||||
id: "resist",
|
||||
label: "PRISMRPG.Skill.Category.resist",
|
||||
}
|
||||
})
|
||||
|
||||
@@ -66,14 +66,18 @@ export default class PrismRPGWeapon extends foundry.abstract.TypeDataModel {
|
||||
})
|
||||
|
||||
// Maneuver(s) available with this weapon
|
||||
schema.maneuver = new fields.StringField({
|
||||
schema.maneuvers = new fields.ArrayField(new fields.SchemaField({
|
||||
name: new fields.StringField({
|
||||
required: true,
|
||||
initial: ""
|
||||
}),
|
||||
description: new fields.HTMLField({
|
||||
required: true,
|
||||
initial: ""
|
||||
})
|
||||
}), {
|
||||
required: true,
|
||||
initial: ""
|
||||
})
|
||||
|
||||
schema.maneuverDescription = new fields.HTMLField({
|
||||
required: true,
|
||||
initial: ""
|
||||
initial: []
|
||||
})
|
||||
|
||||
// Augment effects (for equipment progression)
|
||||
|
||||
Reference in New Issue
Block a user