feat: fiche véhicule (caractéristiques) et capacités de totem de groupe
Release Creation / build (release) Failing after 1m24s
Release Creation / build (release) Failing after 1m24s
- véhicule : fiabilité 1-10, type véhicule/monture, distance, vitesse (croisière/pointe), entretien, réserve d'effort - nettoyage du tableau d'entretien à la soumission - fiche de groupe : section capacités de totem (création type totem + liste)
This commit is contained in:
@@ -11,7 +11,8 @@ export default class VermineGroupSheetV2 extends VermineBaseActorSheet {
|
||||
deleteMember: VermineGroupSheetV2.#onDeleteMember,
|
||||
deleteEncounter: VermineGroupSheetV2.#onDeleteEncounter,
|
||||
deleteObjective: VermineGroupSheetV2.#onDeleteObjective,
|
||||
addObjective: VermineGroupSheetV2.#onAddObjective
|
||||
addObjective: VermineGroupSheetV2.#onAddObjective,
|
||||
createTotemAbility: VermineGroupSheetV2.#onCreateTotemAbility
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +68,8 @@ export default class VermineGroupSheetV2 extends VermineBaseActorSheet {
|
||||
case "main": break
|
||||
case "info":
|
||||
context.tab = context.tabs.info
|
||||
context.abilities = doc.itemTypes.ability
|
||||
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
|
||||
@@ -135,4 +137,9 @@ export default class VermineGroupSheetV2 extends VermineBaseActorSheet {
|
||||
objectives[type].push("")
|
||||
this.document.update({ "system.objectives": objectives })
|
||||
}
|
||||
|
||||
static async #onCreateTotemAbility(event, target) {
|
||||
const name = game.i18n.localize("ITEMS.new_ability")
|
||||
await this.document.createEmbeddedDocuments("Item", [{ name, type: "ability", system: { type: "totem" } }])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,28 @@ export class VermineDefenseSheetV2 extends VermineBaseItemSheet {
|
||||
export class VermineVehicleSheetV2 extends VermineBaseItemSheet {
|
||||
static DEFAULT_OPTIONS = { classes: ["vehicle"], position: { width: 520 } }
|
||||
static PARTS = { main: { template: "systems/vermine2047/templates/item/item-vehicle-sheet.hbs", scrollable: [""] } }
|
||||
|
||||
async _prepareContext() {
|
||||
const context = await super._prepareContext()
|
||||
// Compétences d'Entretien possibles (mécanique, technologie, artisanat, animalisme…)
|
||||
const maintenanceKeys = ["mecanical", "technology", "crafting", "animalism", "environment", "wildlife", "flora", "repulsion", "toxics"]
|
||||
const current = this.document.system.maintenance || []
|
||||
context.maintenanceSkills = maintenanceKeys.map(key => ({
|
||||
key,
|
||||
label: game.i18n.localize("SKILLS." + key + ".name"),
|
||||
checked: current.includes(key)
|
||||
}))
|
||||
return context
|
||||
}
|
||||
|
||||
/** @override - nettoie le tableau d'Entretien (retire les cases non cochées). */
|
||||
_prepareSubmitData(event, form, formData, updateData) {
|
||||
const result = super._prepareSubmitData(event, form, formData, updateData)
|
||||
if (Array.isArray(result?.system?.maintenance)) {
|
||||
result.system.maintenance = result.system.maintenance.filter(v => typeof v === "string" && v.trim() !== "")
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
// ── Capacité ──────────────────────────────────────────────────────────
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { baseItemSchema } from "./_shared.mjs"
|
||||
|
||||
/**
|
||||
* DataModel pour les items de type "vehicle" (véhicules).
|
||||
* DataModel pour les items de type "vehicle" (véhicules et montures).
|
||||
* Caractéristiques : Rareté, Fiabilité, Distance, Vitesse (croisière/pointe),
|
||||
* Entretien (compétences) et Réserve d'Effort (montures).
|
||||
* @augments {foundry.abstract.TypeDataModel}
|
||||
*/
|
||||
export default class VermineVehicleData extends foundry.abstract.TypeDataModel {
|
||||
@@ -14,6 +16,27 @@ export default class VermineVehicleData extends foundry.abstract.TypeDataModel {
|
||||
const reqInt = { required: true, nullable: false, integer: true }
|
||||
return {
|
||||
...baseItemSchema(),
|
||||
// Fiabilité étendue (1-10) pour les véhicules
|
||||
reliability: new fields.NumberField({ ...reqInt, initial: 5, min: 1, max: 10 }),
|
||||
// Type : "vehicle" (véhicule) ou "mount" (monture)
|
||||
kind: new fields.StringField({ required: true, nullable: false, initial: "vehicle" }),
|
||||
// Distance : km parcourus avec un "plein"
|
||||
distance: new fields.NumberField({ ...reqInt, initial: 0, min: 0 }),
|
||||
// Vitesse : croisière / pointe (durée de la pointe)
|
||||
speed: new fields.SchemaField({
|
||||
cruise: new fields.NumberField({ ...reqInt, initial: 0, min: 0 }),
|
||||
top: new fields.NumberField({ ...reqInt, initial: 0, min: 0 }),
|
||||
topDuration: new fields.StringField({ required: true, nullable: false, initial: "10 min" })
|
||||
}),
|
||||
// Entretien : compétences nécessaires (clés de CONFIG.VERMINE.skills)
|
||||
maintenance: new fields.ArrayField(new fields.StringField({ required: true, nullable: false, initial: "" })),
|
||||
// Réserve d'Effort (montures)
|
||||
effortReserve: new fields.SchemaField({
|
||||
value: new fields.NumberField({ ...reqInt, initial: 0, min: 0 }),
|
||||
min: new fields.NumberField({ ...reqInt, initial: 0, min: 0 }),
|
||||
max: new fields.NumberField({ ...reqInt, initial: 0, min: 0 })
|
||||
}),
|
||||
// Mobilité (héritée)
|
||||
mobility: new fields.NumberField({ ...reqInt, initial: 3, min: 0 })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user