Release Creation / build (release) Failing after 1m32s
- VermineTotemDice : influence Humain/Adapté (+1D/-1D par domaine, règles p. 121), gains/pertes via Instincts/Interdits avec limites (3D/totem, 5D total) et règles d'échange. - roll.mjs applique l'influence selon le Totem dominant (au lieu de l'ancienne logique basée sur identity.totem). - Dialogue TotemDiceDialog (instinct Humain/autre totem, interdit Humain, acte grave ±2D) + bouton et ligne d'influence sur la fiche personnage. - Dés de Totem gagnés en cas d'échec à l'apprentissage Dé d'Évolution (dés dépensés, garde capacité vide). - Couleur de texte @color-text-light-2 assombrie (#c9e0c0 → #3f9b55) pour la lisibilité dans tous les dialogues. fix: robustesse et visibilité des évolutions - buyEvolutionDialog : n'efface les Dés d'Évolution que si l'item est créé. - Flag mutation éditable sur la fiche item evolution + badge Adaptation/Mutation dans la liste du personnage. - loseDie : applique aussi la limite totale de 5 dés au gain Adapté. - Case "acte grave" conservée entre les rendus du dialogue.
153 lines
6.8 KiB
JavaScript
153 lines
6.8 KiB
JavaScript
import VermineBaseActorSheet from "./base-actor-sheet.mjs"
|
|
|
|
export default class VermineCharacterSheetV2 extends VermineBaseActorSheet {
|
|
|
|
static DEFAULT_OPTIONS = {
|
|
classes: ["character"],
|
|
position: { width: 920, height: 720 },
|
|
window: { contentClasses: ["character-content"] },
|
|
actions: {
|
|
addSpecialty: VermineCharacterSheetV2.#onAddSpecialty,
|
|
openExperiencePhase: VermineCharacterSheetV2.#onOpenExperiencePhase,
|
|
openLearning: VermineCharacterSheetV2.#onOpenLearning,
|
|
validatePhase: VermineCharacterSheetV2.#onValidatePhase,
|
|
buyEvolution: VermineCharacterSheetV2.#onBuyEvolution,
|
|
openTotemDice: VermineCharacterSheetV2.#onOpenTotemDice
|
|
}
|
|
}
|
|
|
|
static PARTS = {
|
|
main: { template: "systems/vermine2047/templates/actor/appv2/character-main.hbs", scrollable: [""] },
|
|
tabs: { template: "templates/generic/tab-navigation.hbs" },
|
|
abilities: { template: "systems/vermine2047/templates/actor/appv2/character-abilities.hbs", scrollable: [""] },
|
|
totem: { template: "systems/vermine2047/templates/actor/appv2/character-totem.hbs", scrollable: [""] },
|
|
equipment: { template: "systems/vermine2047/templates/actor/appv2/character-equipment.hbs", scrollable: [""] },
|
|
stories: { template: "systems/vermine2047/templates/actor/appv2/character-stories.hbs", scrollable: [""] },
|
|
combat: { template: "systems/vermine2047/templates/actor/appv2/character-combat.hbs", scrollable: [""] },
|
|
experience: { template: "systems/vermine2047/templates/actor/appv2/character-experience.hbs", scrollable: [""] }
|
|
}
|
|
|
|
tabGroups = { sheet: "abilities" }
|
|
|
|
#getTabs() {
|
|
const tabs = {
|
|
abilities: { id: "abilities", group: "sheet", icon: "fas fa-address-card", label: "VERMINE.tabs.abilities" },
|
|
totem: { id: "totem", group: "sheet", icon: "fas fa-star", label: "VERMINE.tabs.totem" },
|
|
equipment: { id: "equipment", group: "sheet", icon: "fas fa-hammer", label: "VERMINE.tabs.equipment" },
|
|
stories: { id: "stories", group: "sheet", icon: "fas fa-book-open-reader", label: "VERMINE.tabs.stories" },
|
|
combat: { id: "combat", group: "sheet", icon: "fas fa-medal", label: "VERMINE.tabs.combat" },
|
|
experience: { id: "experience", group: "sheet", icon: "fas fa-graduation-cap", label: "VERMINE.tabs.experience" }
|
|
}
|
|
for (const v of Object.values(tabs)) {
|
|
v.active = this.tabGroups[v.group] === v.id
|
|
v.cssClass = v.active ? "active" : ""
|
|
}
|
|
return tabs
|
|
}
|
|
|
|
async _prepareContext() {
|
|
const context = await super._prepareContext()
|
|
context.tabs = this.#getTabs()
|
|
return context
|
|
}
|
|
|
|
async _preparePartContext(partId, context) {
|
|
const doc = this.document
|
|
context.systemFields = doc.system.schema.fields
|
|
switch (partId) {
|
|
case "main": break
|
|
case "abilities":
|
|
context.tab = context.tabs.abilities
|
|
context.specialties = doc.itemTypes.specialty
|
|
break
|
|
case "totem":
|
|
context.tab = context.tabs.totem
|
|
context.abilities = doc.itemTypes.ability.filter(i => i.system.type !== "totem")
|
|
context.totem_abilities = doc.itemTypes.ability.filter(i => i.system.type === "totem")
|
|
context.specialties = doc.itemTypes.specialty
|
|
context.backgrounds = doc.itemTypes.background
|
|
context.traumas = doc.itemTypes.trauma
|
|
context.evolutions = doc.itemTypes.evolution
|
|
context.rites = doc.itemTypes.rite
|
|
break
|
|
case "equipment":
|
|
context.tab = context.tabs.equipment
|
|
context.gear = doc.itemTypes.item
|
|
context.weapons = doc.itemTypes.weapon
|
|
context.defenses = doc.itemTypes.defense
|
|
context.vehicles = game.actors.filter(a => a.type === "vehicle" && a.system.ownerId === doc.id)
|
|
break
|
|
case "stories":
|
|
context.tab = context.tabs.stories
|
|
break
|
|
case "combat":
|
|
context.tab = context.tabs.combat
|
|
context.equippedWeapons = doc.itemTypes.weapon.filter(i => i.system.equipped)
|
|
context.equippedDefenses = doc.itemTypes.defense.filter(i => i.system.equipped)
|
|
const { prepareActiveEffectCategories } = await import("../../system/effects.mjs")
|
|
context.effects = prepareActiveEffectCategories(doc.effects)
|
|
break
|
|
case "experience":
|
|
context.tab = context.tabs.experience
|
|
context.specialtyCount = doc.itemTypes.specialty.length
|
|
const ex = doc.system.experience
|
|
context.experience = ex
|
|
context.collectiveTotal = (ex.collective.danger + ex.collective.discoveries + ex.collective.duration)
|
|
context.individualTotal = (ex.individual.implication + ex.individual.influence + ex.individual.interpretation)
|
|
context.currentPhase = ex.phase
|
|
context.learnedCurrent = ex.learned.phase === ex.phase
|
|
break
|
|
}
|
|
return context
|
|
}
|
|
|
|
changeTab(tab, group, options = {}) {
|
|
super.changeTab(tab, group, options)
|
|
if (group === "sheet") {
|
|
const main = this.element?.querySelector('[data-group="sheet"][data-tab="main"]')
|
|
if (main) main.classList.add("active")
|
|
}
|
|
}
|
|
|
|
static async #onAddSpecialty(event, target) {
|
|
const skillKey = target.dataset.skill
|
|
const name = game.i18n.localize("ITEMS.new_specialty")
|
|
const itemData = { name, type: "specialty" }
|
|
if (skillKey) itemData.system = { skill: skillKey }
|
|
await this.document.createEmbeddedDocuments("Item", [itemData])
|
|
}
|
|
|
|
static async #onOpenExperiencePhase(event, target) {
|
|
const { default: ExperiencePhaseDialog } = await import("../../system/dialogs/experiencePhaseDialog.mjs")
|
|
const dialog = await ExperiencePhaseDialog.create()
|
|
if (dialog) dialog.render(true)
|
|
}
|
|
|
|
static async #onOpenLearning(event, target) {
|
|
const { default: LearningDialog } = await import("../../system/dialogs/learningDialog.mjs")
|
|
const dialog = await LearningDialog.create({ actorId: this.document.id })
|
|
if (dialog) dialog.render(true)
|
|
}
|
|
|
|
/** Valide la phase d'Expérience courante et réinitialise les limites. */
|
|
static async #onValidatePhase() {
|
|
const { VermineExperience } = await import("../../system/experience.mjs")
|
|
await VermineExperience.resetPhaseLimits(this.document)
|
|
ui.notifications.info(game.i18n.localize("VERMINE.validate_phase_done"))
|
|
}
|
|
|
|
/** Ouvre le dialogue d'achat d'une Adaptation/Mutation (Dés d'Évolution). */
|
|
static async #onBuyEvolution(event, target) {
|
|
const { default: BuyEvolutionDialog } = await import("../../system/dialogs/buyEvolutionDialog.mjs")
|
|
const dialog = await BuyEvolutionDialog.create({ actorId: this.document.id })
|
|
if (dialog) dialog.render(true)
|
|
}
|
|
|
|
/** Ouvre le dialogue de gestion des Dés de Totems. */
|
|
static async #onOpenTotemDice(event, target) {
|
|
const { default: TotemDiceDialog } = await import("../../system/dialogs/totemDiceDialog.mjs")
|
|
const dialog = await TotemDiceDialog.create({ actorId: this.document.id })
|
|
if (dialog) dialog.render(true)
|
|
}
|
|
}
|