From 2da3d19dbee4ad2d72924070dc31385b1fc45456 Mon Sep 17 00:00:00 2001 From: LeRatierBretonnien Date: Mon, 2 Jan 2023 14:54:59 +0100 Subject: [PATCH] Better rolls + perks --- modules/dark-stars-actor-sheet.js | 1 + modules/dark-stars-actor.js | 11 +++++++---- modules/dark-stars-utility.js | 7 +++++-- system.json | 4 ++-- templates/actors/actor-sheet.hbs | 27 ++++++++++++++++++++++++++ templates/chat/chat-generic-result.hbs | 18 ++++++++++++----- 6 files changed, 55 insertions(+), 13 deletions(-) diff --git a/modules/dark-stars-actor-sheet.js b/modules/dark-stars-actor-sheet.js index 0a971b2..58050c1 100644 --- a/modules/dark-stars-actor-sheet.js +++ b/modules/dark-stars-actor-sheet.js @@ -38,6 +38,7 @@ export class DarkStarsActorSheet extends ActorSheet { system: actorData, limited: this.object.limited, skills: this.actor.getSkills( ), + perks: this.actor.getPerks( ), weapons: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getWeapons()) ), armors: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getArmors())), shields: this.actor.checkAndPrepareEquipments( duplicate(this.actor.getShields())), diff --git a/modules/dark-stars-actor.js b/modules/dark-stars-actor.js index d344b86..bac56b6 100644 --- a/modules/dark-stars-actor.js +++ b/modules/dark-stars-actor.js @@ -202,6 +202,13 @@ export class DarkStarsActor extends Actor { DarkStarsUtility.sortArrayObjectsByName(comp) return comp } + + /* -------------------------------------------- */ + getPerks() { + let comp = duplicate(this.items.filter(item => item.type == 'perk') || []) + DarkStarsUtility.sortArrayObjectsByName(comp) + return comp + } /* -------------------------------------------- */ async equipItem(itemId) { @@ -567,10 +574,6 @@ export class DarkStarsActor extends Actor { rollSkill(skillId) { let skill = this.items.get(skillId) if (skill) { - if (skill.system.islore && skill.system.level == 0) { - ui.notifications.warn("You can't use Lore Skills with a SL of 0.") - return - } skill = duplicate(skill) this.updateSkill(skill) let rollData = this.getCommonRollData() diff --git a/modules/dark-stars-utility.js b/modules/dark-stars-utility.js index afb09f9..5c4a50c 100644 --- a/modules/dark-stars-utility.js +++ b/modules/dark-stars-utility.js @@ -271,8 +271,11 @@ export class DarkStarsUtility { } rollData.roll = myRoll rollData.diceResult = myRoll.total - rollData.isSuccess = rollData.diceResult <= rollData.percentValue - rollData.isFailure = rollData.diceResult > rollData.percentValue + rollData.isCriticalSuccess = rollData.diceResult <= rollData.skill.derivated.value + rollData.isCriticalFailure = rollData.diceResult == 100 + rollData.isSuccess = rollData.diceResult == 1 || rollData.diceResult <= rollData.percentValue + rollData.isFailure = rollData.diceResult == 100 || rollData.diceResult > rollData.percentValue + rollData.degrees = Math.floor(rollData.percentValue/10) - Math.floor(rollData.diceResult/10) let msg = await this.createChatWithRollMode(rollData.alias, { content: await renderTemplate(`systems/fvtt-dark-stars/templates/chat/chat-generic-result.hbs`, rollData) diff --git a/system.json b/system.json index bcc3a59..1105d76 100644 --- a/system.json +++ b/system.json @@ -100,7 +100,7 @@ "styles": [ "styles/simple.css" ], - "version": "10.0.13", + "version": "10.0.14", "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.13.zip", + "download": "https://www.uberwald.me/gitea/uberwald/fvtt-dark-stars/archive/fvtt-dark-stars-v10.0.14.zip", "url": "https://www.uberwald.me/gitea/uberwald/", "background": "images/ui/dark_stars_welcome_page.webp", "id": "fvtt-dark-stars" diff --git a/templates/actors/actor-sheet.hbs b/templates/actors/actor-sheet.hbs index 69d1566..3461e66 100644 --- a/templates/actors/actor-sheet.hbs +++ b/templates/actors/actor-sheet.hbs @@ -16,6 +16,7 @@