From 4ca23257cb49aa229345338d6921ff1294a9644c Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Wed, 22 Mar 2023 22:43:30 +0100 Subject: [PATCH] Combat tab --- modules/hero6-actor-sheet.js | 6 ++++++ modules/hero6-actor.js | 5 +++++ modules/hero6-utility.js | 9 +++++++++ styles/simple.css | 13 ------------- system.json | 4 ++-- templates/actors/actor-sheet.hbs | 8 ++++---- 6 files changed, 26 insertions(+), 19 deletions(-) diff --git a/modules/hero6-actor-sheet.js b/modules/hero6-actor-sheet.js index 5443d1c..80eaf65 100644 --- a/modules/hero6-actor-sheet.js +++ b/modules/hero6-actor-sheet.js @@ -152,6 +152,12 @@ export class Hero6ActorSheet extends ActorSheet { const characKey = $(event.currentTarget).data("charac-key"); this.actor.rollCharac(characKey); }); + html.find('.roll-direct').click((event) => { + const rollFormula = $(event.currentTarget).data("roll-formula"); + let roll = new Roll(rollFormula).roll({async: false}) + roll.toMessage() + }); + html.find('.roll-item').click((event) => { const li = $(event.currentTarget).parents(".item"); let itemId = li.data("item-id") diff --git a/modules/hero6-actor.js b/modules/hero6-actor.js index 6835934..49edd6f 100644 --- a/modules/hero6-actor.js +++ b/modules/hero6-actor.js @@ -66,6 +66,10 @@ export class Hero6Actor extends Actor { if (this.type == "character") { } } + computeDicesValue() { + this.system.biodata.presenceattack = Hero6Utility.getDerivatedDiceValue(this.system.characteristics.pre.value ) + this.system.characteristics.str.strdice = Hero6Utility.getDerivatedDiceValue(this.system.characteristics.str.value ) + } /* -------------------------------------------- */ prepareDerivedData() { @@ -73,6 +77,7 @@ export class Hero6Actor extends Actor { this.system.encCapacity = this.getEncumbranceCapacity() this.buildContainerTree() this.computeHitPoints() + this.computeDicesValue() } super.prepareDerivedData(); diff --git a/modules/hero6-utility.js b/modules/hero6-utility.js index b6b7e7b..dfd1c7d 100644 --- a/modules/hero6-utility.js +++ b/modules/hero6-utility.js @@ -76,6 +76,15 @@ export class Hero6Utility { }) */ } + + /*-------------------------------------------- */ + static getDerivatedDiceValue(value) { + let dices = Math.floor(value/5) +"d6" + if ( value % 5 > 2) { + dices += "+1d3" + } + return dices + } /*-------------------------------------------- */ static upperFirst(text) { if (typeof text !== 'string') return text diff --git a/styles/simple.css b/styles/simple.css index 439a106..762a766 100644 --- a/styles/simple.css +++ b/styles/simple.css @@ -173,19 +173,6 @@ table { border: 1px solid #7a7971;} grid-template-columns: repeat(12, minmax(0, 1fr)); } -.flex-group-center, -.flex-group-left, -.flex-group-right { - -webkit-box-pack: center; - -ms-flex-pack: center; - justify-content: center; - -webkit-box-align: center; - -ms-flex-align: center; - align-items: center; - text-align: center; - padding: 5px; -} - .flex-group-left { -webkit-box-pack: start; -ms-flex-pack: start; diff --git a/system.json b/system.json index c112067..86d846a 100644 --- a/system.json +++ b/system.json @@ -91,7 +91,7 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.28", + "version": "10.0.29", "compatibility": { "minimum": "10", "verified": "10", @@ -99,7 +99,7 @@ }, "title": "Hero System v6 for FoundrtVTT (Official)", "manifest": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/raw/branch/main/system.json", - "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.17.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-hero-system-6/archive/fvtt-hero-system-6-v10.0.29.zip", "url": "https://www.uberwald.me/gitea/uberwald/", "background": "images/ui/hro6_welcome_page.webp", "id": "fvtt-hero-system-6" diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index d2ee682..0d618a2 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -115,9 +115,9 @@
@@ -246,7 +246,7 @@
-
+