From 7ceada98fb5c463ded739c9d7b86ac9054aa408e Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Sat, 31 Dec 2022 10:22:49 +0100 Subject: [PATCH] Actor sheet v1.1 --- modules/dark-stars-actor-sheet.js | 35 +++++--------------------- modules/dark-stars-actor.js | 11 ++++++-- system.json | 4 +-- template.json | 1 + templates/actors/actor-sheet.hbs | 10 +++++++- templates/apps/roll-dialog-generic.hbs | 4 +++ templates/items/item-skill-sheet.hbs | 4 +++ 7 files changed, 35 insertions(+), 34 deletions(-) diff --git a/modules/dark-stars-actor-sheet.js b/modules/dark-stars-actor-sheet.js index e02bddd..0a971b2 100644 --- a/modules/dark-stars-actor-sheet.js +++ b/modules/dark-stars-actor-sheet.js @@ -93,17 +93,6 @@ export class DarkStarsActorSheet extends ActorSheet { this.actor.createEmbeddedDocuments('Item', [{ name: "NewItem", type: dataType }], { renderSheet: true }) }) - html.find('.equip-activate').click(ev => { - const li = $(ev.currentTarget).parents(".item") - let itemId = li.data("item-id") - this.actor.equipActivate( itemId) - }); - html.find('.equip-deactivate').click(ev => { - const li = $(ev.currentTarget).parents(".item") - let itemId = li.data("item-id") - this.actor.equipDeactivate( itemId) - }); - html.find('.subactor-edit').click(ev => { const li = $(ev.currentTarget).parents(".item"); let actorId = li.data("actor-id"); @@ -116,6 +105,12 @@ export class DarkStarsActorSheet extends ActorSheet { let actorId = li.data("actor-id"); this.actor.delSubActor(actorId); }); + + html.find('.skill-used-id').change(event => { + const li = $(event.currentTarget).parents(".item"); + this.actor.setSkillUsed( li.data("item-id"), event.currentTarget.checked ); + } ); + html.find('.quantity-minus').click(event => { const li = $(event.currentTarget).parents(".item"); this.actor.incDecQuantity( li.data("item-id"), -1 ); @@ -134,10 +129,6 @@ export class DarkStarsActorSheet extends ActorSheet { this.actor.incDecAmmo( li.data("item-id"), +1 ) } ); - html.find('.roll-ability').click((event) => { - const abilityKey = $(event.currentTarget).data("ability-key"); - this.actor.rollAbility(abilityKey); - }); html.find('.roll-skill').click((event) => { const li = $(event.currentTarget).parents(".item") const skillId = li.data("item-id") @@ -149,20 +140,6 @@ export class DarkStarsActorSheet extends ActorSheet { const skillId = li.data("item-id") this.actor.rollWeapon(skillId) }); - html.find('.roll-armor-die').click((event) => { - this.actor.rollArmorDie() - }); - html.find('.roll-shield-die').click((event) => { - this.actor.rollShieldDie() - }); - html.find('.roll-target-die').click((event) => { - this.actor.rollDefenseRanged() - }); - - html.find('.roll-save').click((event) => { - const saveKey = $(event.currentTarget).data("save-key") - this.actor.rollSave(saveKey) - }); html.find('.lock-unlock-sheet').click((event) => { diff --git a/modules/dark-stars-actor.js b/modules/dark-stars-actor.js index f5b7019..d344b86 100644 --- a/modules/dark-stars-actor.js +++ b/modules/dark-stars-actor.js @@ -98,7 +98,6 @@ export class DarkStarsActor extends Actor { this.computeDerivated() this.buildContainerTree() this.computeHitPoints() - this.computeEffortPoints() } super.prepareDerivedData(); @@ -179,10 +178,18 @@ export class DarkStarsActor extends Actor { return item; } + /* -------------------------------------------- */ + setSkillUsed( skillId, checked) { + let skill = this.items.get(skillId) + if(skill) { + this.updateEmbeddedDocuments('Item', [ {_id: skill.id, 'system.used': checked} ]) + } + } + /* -------------------------------------------- */ updateSkill(skill) { skill.derivated = duplicate(this.system.derivated[skill.system.base]) - skill.total = skill.derivated.value + skill.system.bonus + skill.total = skill.system.value + skill.derivated.value + skill.system.bonus } /* -------------------------------------------- */ diff --git a/system.json b/system.json index f4119e0..bcc3a59 100644 --- a/system.json +++ b/system.json @@ -100,7 +100,7 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.12", + "version": "10.0.13", "compatibility": { "minimum": "10", "verified": "10", @@ -108,7 +108,7 @@ }, "title": "Dark Stars RPG", "manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-dark-stars/raw/branch/main/system.json", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-dark-stars/archive/fvtt-dark-stars-v10.0.12.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-dark-stars/archive/fvtt-dark-stars-v10.0.13.zip", "url": "https://www.uberwald.me/gitea/uberwald/", "background": "images/ui/dark_stars_welcome_page.webp", "id": "fvtt-dark-stars" diff --git a/template.json b/template.json index f237fd5..7880997 100644 --- a/template.json +++ b/template.json @@ -277,6 +277,7 @@ ], "skill": { "base": "", + "value": 0, "bonus": 0, "used": false, "description": "" diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index 9c1152a..69d1566 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -74,6 +74,9 @@

+ + + @@ -83,6 +86,9 @@ + + + @@ -92,9 +98,11 @@ {{skill.name}} + {{skill.system.value}} {{skill.derivated.label}} ({{skill.derivated.value}}) {{skill.system.bonus}} - {{skill.total}} + {{skill.total}}% +
diff --git a/templates/apps/roll-dialog-generic.hbs b/templates/apps/roll-dialog-generic.hbs index 13a07f5..56f79e4 100644 --- a/templates/apps/roll-dialog-generic.hbs +++ b/templates/apps/roll-dialog-generic.hbs @@ -26,6 +26,10 @@ Bonus/Malus : +
  • + +
  • +