diff --git a/CHANGELOG.md b/CHANGELOG.md index 63b41bb..4648d92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ - versions condensées des méthodes (@kristov) - renommage des templates - image actors par défaut +- image des créatures +- ajout du totem et de l'apprentissage dans les capacités ## 0.1.8 - refactoring sheet vers actor diff --git a/lang/en.json b/lang/en.json index c3bdaf4..e934fff 100644 --- a/lang/en.json +++ b/lang/en.json @@ -164,6 +164,7 @@ "type_character": "Personnage", "type_npc": "PNJ", "type_creature": "Créature", + "type": "Type", "group_members": "Membres", "encounters": "Rencontres", "road": "La Route", @@ -209,7 +210,8 @@ "evolutions": "Adaptations", "new_vehicle": "Nouveau véhicule", "vehicles": "Véhicules", - "new_objective": "Nouvel objectif" + "new_objective": "Nouvel objectif", + "learning": "Apprentissage" }, "ABILITIES": { "vigor": { "name": "Vigueur"}, diff --git a/module/documents/item.mjs b/module/documents/item.mjs index 77a4724..3ed5165 100644 --- a/module/documents/item.mjs +++ b/module/documents/item.mjs @@ -11,6 +11,24 @@ export class VermineItem extends Item { // preparation methods overridden (such as prepareBaseData()). super.prepareData(); } + prepareBaseData(){ + const actorType = (this.actor !== null) ? this.actor.type : 'character'; + + switch (this.type){ + case 'ability': + if (this.system.type == "") { + // console.log('je suis une capacité, avec pour sous-type', this.system.type, actorType); + this.system.type = actorType; + } + if (this.system.totem == "" && this.actor !== null && this.actor.system.identity.totem != "") { + // console.log('je suis une capacité, avec pour sous-type', this.system.type, actorType); + this.system.totem = this.actor.system.identity.totem; + } + break; + default: + break; + } + } /** * Prepare a data object which is passed to any Roll formulas which are created related to this Item diff --git a/module/sheets/actor-sheet.mjs b/module/sheets/actor-sheet.mjs index b429f9a..eda2f88 100644 --- a/module/sheets/actor-sheet.mjs +++ b/module/sheets/actor-sheet.mjs @@ -9,12 +9,12 @@ export class VermineActorSheet extends ActorSheet { /** @override */ static get defaultOptions() { return mergeObject(super.defaultOptions, { - classes: ["vermine2047", "sheet", "actor"], + /*classes: ["vermine2047", "sheet", "actor"], template: "systems/vermine2047/templates/actor/actor-sheet.hbs", height: 800, width: 690, resizable: false, - tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }] + tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }]*/ }); } diff --git a/module/sheets/character-sheet.mjs b/module/sheets/character-sheet.mjs index 52d94e0..b32901d 100644 --- a/module/sheets/character-sheet.mjs +++ b/module/sheets/character-sheet.mjs @@ -12,7 +12,7 @@ export class VermineCharacterSheet extends VermineActorSheet { /** @override */ static get defaultOptions() { return mergeObject(super.defaultOptions, { - classes: ["vermine2047", "sheet", "actor"], + classes: ["vermine2047", "sheet", "character", "actor"], template: "systems/vermine2047/templates/actor/actor-sheet.hbs", width: 600, height: 600, diff --git a/module/sheets/creature-sheet.mjs b/module/sheets/creature-sheet.mjs index 5a96966..674dafe 100644 --- a/module/sheets/creature-sheet.mjs +++ b/module/sheets/creature-sheet.mjs @@ -10,10 +10,10 @@ export class VermineCreatureSheet extends ActorSheet { /** @override */ static get defaultOptions() { return mergeObject(super.defaultOptions, { - classes: ["vermine2047", "sheet", "actor"], + classes: ["vermine2047", "sheet", "actor", "creature"], template: "systems/vermine2047/templates/actor/actor-sheet.hbs", - width: 600, - height: 600, + width: 300, + height: 300, tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }] }); } @@ -92,6 +92,33 @@ export class VermineCreatureSheet extends ActorSheet { /** @override */ activateListeners(html) { super.activateListeners(html); + + html.find('.item-create').click(this._onItemCreate.bind(this)); } + async _onItemCreate(event) { + event.preventDefault(); + const header = event.currentTarget; + // Get the type of item to create. + const type = header.dataset.type; + // Grab any data associated with this control. + const data = duplicate(header.dataset); + // Initialize a default name. + // const name = `New ${type.capitalize()}`; + const name = game.i18n.localize('ITEMS.new_' + type); + + console.log('onItemCreate child', data.type, this.actor.type); + // Prepare the item object. + const itemData = { + name: name, + type: type, + system: data + }; + // Remove the type from the dataset since it's in the itemData.type prop. + delete itemData.system["type"]; + + // Finally, create the item! + return await Item.create(itemData, {parent: this.actor}); + } + } diff --git a/module/sheets/item-sheet.mjs b/module/sheets/item-sheet.mjs index 2866a23..f4ec937 100644 --- a/module/sheets/item-sheet.mjs +++ b/module/sheets/item-sheet.mjs @@ -45,6 +45,7 @@ export class VermineItemSheet extends ItemSheet { // Add the actor's data to context.data for easier access, as well as flags. context.system = itemData.system; context.flags = itemData.flags; + context.config = CONFIG.VERMINE; return context; } diff --git a/module/sheets/npc-group.mjs b/module/sheets/npc-group.mjs index f434e47..aa57bd2 100644 --- a/module/sheets/npc-group.mjs +++ b/module/sheets/npc-group.mjs @@ -11,10 +11,10 @@ export class VermineGroupSheet extends VermineActorSheet { /** @override */ static get defaultOptions() { return mergeObject(super.defaultOptions, { - classes: ["vermine2047", "sheet", "actor"], + classes: ["vermine2047", "sheet", "actor", "group"], template: "systems/vermine2047/templates/actor/actor-sheet.hbs", - width: 600, - height: 600, + width: 500, + height: 500, tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }] }); } @@ -88,41 +88,19 @@ export class VermineGroupSheet extends VermineActorSheet { * @return {undefined} */ _prepareItems(context) { - // Initialize containers. - const abilities = []; - const specialties = []; - const backgrounds = []; - const evolutions = []; - const traumas = []; + context.specialties = this.actor.itemTypes['specialty']; + context.backgrounds = this.actor.itemTypes['background']; + context.evolutions = this.actor.itemTypes['evolution']; + context.traumas = this.actor.itemTypes['trauma']; + + context.gear = this.actor.itemTypes['item']; + context.weapons = this.actor.itemTypes['weapon']; + context.defenses = this.actor.itemTypes['defense']; + context.vehicles = this.actor.itemTypes['vehicle']; + context.totem_abilities = this.actor.itemTypes['ability'].filter(i=>i.system.type === 'totem'); + context.abilities = this.actor.itemTypes['ability'].filter(i=>i.system.type !== 'totem'); - // Iterate through items, allocating to containers - for (let i of context.items) { - i.img = i.img || DEFAULT_TOKEN; - if (i.type === 'ability') { - abilities.push(i); - } - else if (i.type === 'specialty') { - specialties.push(i); - } - else if (i.type === 'background') { - backgrounds.push(i); - } - else if (i.type === 'evolution') { - evolutions.push(i); - } - else if (i.type === 'trauma') { - traumas.push(i); - } - - } - - // Assign and return - context.abilities = abilities; - context.specialties = specialties; - context.backgrounds = backgrounds; - context.evolutions = evolutions; - context.traumas = traumas; context.members = []; context.encounters = []; @@ -134,13 +112,6 @@ export class VermineGroupSheet extends VermineActorSheet { context.encounters.push(game.actors.get(encounterId)); } - context.gear = this.actor.itemTypes['item']; - context.weapons = this.actor.itemTypes['weapon']; - context.defenses = this.actor.itemTypes['defense']; - context.vehicles = this.actor.itemTypes['vehicle']; - - context.totem_abilities = this.actor.itemTypes['ability'].filter(i=>i.type !== 'totem'); - context.abilities = this.actor.itemTypes['ability'].filter(i=>i.type === 'totem'); } diff --git a/module/sheets/npc-sheet.mjs b/module/sheets/npc-sheet.mjs index 9a2891f..3c8f783 100644 --- a/module/sheets/npc-sheet.mjs +++ b/module/sheets/npc-sheet.mjs @@ -10,10 +10,10 @@ export class VermineNpcSheet extends VermineActorSheet { /** @override */ static get defaultOptions() { return mergeObject(super.defaultOptions, { - classes: ["vermine2047", "sheet", "actor"], + classes: ["vermine2047", "sheet", "actor", "npc"], template: "systems/vermine2047/templates/actor/actor-sheet.hbs", - width: 600, - height: 600, + width: 400, + height: 400, tabs: [{ navSelector: ".sheet-tabs", contentSelector: ".sheet-body", initial: "features" }] }); } diff --git a/module/system/handlebars-manager.mjs b/module/system/handlebars-manager.mjs index d92dd7f..3febad6 100644 --- a/module/system/handlebars-manager.mjs +++ b/module/system/handlebars-manager.mjs @@ -8,15 +8,10 @@ // Actor partials. - "systems/vermine2047/templates/actor/parts/actor-id.hbs", - "systems/vermine2047/templates/actor/parts/actor-totem.hbs", - "systems/vermine2047/templates/actor/parts/character-features.hbs", - "systems/vermine2047/templates/actor/parts/character-header.hbs", + "systems/vermine2047/templates/actor/parts/actor-features.hbs", "systems/vermine2047/templates/actor/parts/actor-items.hbs", "systems/vermine2047/templates/actor/parts/actor-weapons.hbs", "systems/vermine2047/templates/actor/parts/actor-defenses.hbs", - "systems/vermine2047/templates/actor/parts/actor-stories.hbs", - "systems/vermine2047/templates/actor/parts/actor-combat.hbs", // Character partials. "systems/vermine2047/templates/actor/character/character-id.hbs", diff --git a/system.json b/system.json index 84f3b74..467d51a 100644 --- a/system.json +++ b/system.json @@ -2,7 +2,7 @@ "id": "vermine2047", "title": "Vermine 2047", "description": "The Vermine 2047 system for FoundryVTT!", - "version": "0.1.8", + "version": "0.1.9", "compatibility": { "minimum": "10", "verified": "10.287", diff --git a/template.json b/template.json index ac452fc..18da50e 100644 --- a/template.json +++ b/template.json @@ -383,6 +383,11 @@ "creature": { "templates": ["base"], "skills": "", + "modes": { + "survival": true, + "nightmare": true, + "apocalypse": false + }, "pattern": { "value": 1, "min": 1, @@ -437,7 +442,12 @@ }, "ability": { "templates": ["list"], - "type": "character", + "type": "", + "totem": "", + "learn": { + "threshold":5, + "hindrance":0 + }, "level": { "value": 1, "min": 1, diff --git a/templates/actor/group/group-experience.hbs b/templates/actor/group/group-experience.hbs index a2d9b45..255eb5f 100644 --- a/templates/actor/group/group-experience.hbs +++ b/templates/actor/group/group-experience.hbs @@ -7,7 +7,6 @@
    {{#each members as |actor id|}}
  1. - {{ log actor }} diff --git a/templates/item/item-ability-sheet.html b/templates/item/item-ability-sheet.html index 7475713..78cc7ef 100644 --- a/templates/item/item-ability-sheet.html +++ b/templates/item/item-ability-sheet.html @@ -14,16 +14,34 @@
    {{editor system.description target="system.description" rollData=rollData button=true owner=owner editable=editable}}