From b4fe33782405b807617e38fec2f3e3da50f04e42 Mon Sep 17 00:00:00 2001 From: Lyle hayhurst Date: Mon, 7 Jun 2021 15:21:35 -0500 Subject: [PATCH] Added characteristics with @cdeendan and @echobold --- src/systems/wfrp4e.js | 38 +++++++++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 5 deletions(-) diff --git a/src/systems/wfrp4e.js b/src/systems/wfrp4e.js index c024b33..d33e3bd 100644 --- a/src/systems/wfrp4e.js +++ b/src/systems/wfrp4e.js @@ -18,6 +18,27 @@ export class wfrp4e { } + + getAbility(token, abilityName) { + return this.getCharacteristics(token, abilityName); + } + + getCharacteristics(token, characteristicName) { + console.log("getCharacteristics(", token, ", ", characteristicName); // TODO: feature-wfrp4 remove + if (characteristicName == undefined ) characteristicName = `AG`; + const characteristic = token.actor.data.data.characteristics[characteristicName.toLowerCase()] + console.log(characteristic); + const val = characteristic.value; + return (val >= 0) ? `+${val}` : val; + } + + getFeatures(token,featureType) { + if (featureType == undefined) featureType = 'any'; + const allItems = token.actor.items; + if (featureType == 'any') return allItems.filter(i => i.type == 'skill' || i.type == 'talent' || i.type == "career" || i.type == 'trait'); + else return allItems.filter(i => i.type == featureType); + } + getHP(token) { return this.getWounds(token); } @@ -58,10 +79,6 @@ export class wfrp4e { return; } - getAbility(token, ability) { - return; - } - getAbilityModifier(token, ability) { return; } @@ -103,7 +120,18 @@ export class wfrp4e { * Roll */ roll(token,roll,options,ability,skill,save) { - return; + console.log("roll(", token, roll, options, ability, skill, save, ")"); + // if (roll == undefined) roll = 'ability'; + if (ability == undefined) ability = 'ag'; + // if (skill == undefined) skill = 'acr'; + // if (save == undefined) save = 'str'; + + // if (roll == 'ability') token.actor.rollAbilityTest(ability,options); + // else if (roll == 'save') token.actor.rollAbilitySave(save,options); + // else if (roll == 'skill') token.actor.rollSkill(skill,options); + // else if (roll == 'initiative') token.actor.rollInitiative(options); + // else if (roll == 'deathSave') token.actor.rollDeathSave(options); + return game.wfrp4e.utility.rollItemMacro(ability, "characteristic", false); } /**