From 6aaa4ebe00659a6c53bb2160fdecf031965090c7 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Fri, 12 Oct 2018 12:35:15 +0200 Subject: [PATCH] Added base values to skills to make implementing non player creatures easier --- app/imports/api/creature/Skills.js | 5 +++++ app/imports/api/creature/creatureComputation.js | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/imports/api/creature/Skills.js b/app/imports/api/creature/Skills.js index 99777fbd..9f8829e5 100644 --- a/app/imports/api/creature/Skills.js +++ b/app/imports/api/creature/Skills.js @@ -40,6 +40,11 @@ skillSchema = new SimpleSchema({ order: { type: Number, }, + baseValue: { + type: Number, + decimal: true, + optional: true, + }, value: { type: Number, decimal: true, diff --git a/app/imports/api/creature/creatureComputation.js b/app/imports/api/creature/creatureComputation.js index 7738a268..29416f57 100644 --- a/app/imports/api/creature/creatureComputation.js +++ b/app/imports/api/creature/creatureComputation.js @@ -230,6 +230,7 @@ function buildCreature(charId){ busyComputing: false, type: "skill", ability: skill.ability, + base: skill.baseValue || 0, result: 0, // For skills the result is the skillMod proficiency: 0, add: 0, @@ -528,9 +529,9 @@ function combineSkill(stat, char){ if (stat.result < stat.min) stat.result = stat.min; if (stat.result > stat.max) stat.result = stat.max; stat.result = Math.floor(stat.result); + if (stat.base > stat.result) stat.result = stat.base; } - /** * combineDamageMultiplier - Combine damageMultiplier's results into final values *