diff --git a/README.md b/README.md index b614beb..d4dd1c3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ### fiche de perso --[ ] création de spécialitées depuis le (+) des compétences +-[X] création de spécialitées depuis le (+) des compétences -[ ] fixer les cases hexas , comprtement chelou , piste = un click à l'air d'envoyer 2 update, verifier le onChange -[ ] dialog d'edition des min-max diff --git a/module/sheets/character-sheet.mjs b/module/sheets/character-sheet.mjs index e52224a..a2d1896 100644 --- a/module/sheets/character-sheet.mjs +++ b/module/sheets/character-sheet.mjs @@ -109,17 +109,26 @@ export class VermineCharacterSheet extends VermineActorSheet { /** @override */ activateListeners(html) { super.activateListeners(html); - // Choose Totem - html.find('.chooseTotem').click(this._onTotemButton.bind(this)); - html.find('.ability .rollable').click(this._onRoll.bind(this)); - html.find('[data-totem-name]').click(this._onClickTotemDice.bind(this)); + //desactiver les inputs si mode jeu if (!this.actor.flags.world?.editMode) { this.disableInputs(html) } + // Choose Totem + html.find('.chooseTotem').click(this._onTotemButton.bind(this)); + //activer lest jets + html.find('.ability .rollable').click(this._onRoll.bind(this)); + //gérer les dés totems + html.find('[data-totem-name]').click(this._onClickTotemDice.bind(this)); + //creation de specialités + html.find('i.add-specialty').click(this.addSpecialty.bind(this)) + } + + //mode jeu/edit en mode jeu on bloque les selects et input disableInputs(html) { for (let input of html.find('input')) { + //préserver le toggle mode jeu/ mode edit if (input.name != "flags.world.editMode") { input.setAttribute('disabled', true) } @@ -129,6 +138,18 @@ export class VermineCharacterSheet extends VermineActorSheet { select.setAttribute('disabled', true) } } + async addSpecialty(ev) { + let skillName = ev.target.closest('.ability').querySelector('label').dataset.label; + let itemData = { + name: `spécialité, ${skillName}`, + type: 'specialty', + system: { + skill: skillName + } + } + let spec = await this.actor.createEmbeddedDocuments("Item", [itemData]); + spec[0].sheet.render(true) + } async _onClickTotemDice(ev) { let el = ev.currentTarget; let totem = el.dataset.totemName; diff --git a/templates/actor/character/character-combat.hbs b/templates/actor/character/character-combat.hbs index 724b5ef..624db3b 100644 --- a/templates/actor/character/character-combat.hbs +++ b/templates/actor/character/character-combat.hbs @@ -102,8 +102,10 @@ {{#iflteq @minorwoundmax @root.system.minorWound.value }} checked {{/iflteq}} - - " /> + " + {{#iflteq @minorwoundmax @root.system.minorWound.value }} + checked="true" + {{/iflteq}} /> {{/repeat}} @@ -124,7 +126,11 @@ checked {{/iflteq}} - " /> + " + {{#iflteq @minorwoundmax @root.system.majorWound.value }} + checked="true" + {{/iflteq}} /> + {{/repeat}} @@ -146,7 +152,10 @@ checked {{/iflteq}} - " /> + " + {{#iflteq @minorwoundmax @root.system.deadlyWound.value }} + checked="true" + {{/iflteq}} /> {{/repeat}}