Skill base values now work in a way consistent with attribute base values
This commit is contained in:
@@ -72,8 +72,11 @@ function combineSkill(stat, aggregator, memo){
|
||||
}
|
||||
// Multiply the proficiency bonus by the actual proficiency
|
||||
profBonus *= stat.proficiency;
|
||||
// Base value
|
||||
stat.baseValue = aggregator.statBaseValue;
|
||||
stat.baseValueErrors = aggregator.baseValueErrors;
|
||||
// Combine everything to get the final result
|
||||
let result = (stat.abilityMod + profBonus + aggregator.add) * aggregator.mul;
|
||||
let result = (aggregator.base + stat.abilityMod + profBonus + aggregator.add) * aggregator.mul;
|
||||
if (result < aggregator.min) result = aggregator.min;
|
||||
if (result > aggregator.max) result = aggregator.max;
|
||||
if (aggregator.set !== undefined) {
|
||||
@@ -103,6 +106,7 @@ function combineSkill(stat, aggregator, memo){
|
||||
stat.rollBonuses = aggregator.rollBonus;
|
||||
// Hide
|
||||
stat.hide = aggregator.hasNoEffects &&
|
||||
stat.baseValue === undefined &&
|
||||
stat.proficiency == 0 ||
|
||||
undefined;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import VARIABLE_NAME_REGEX from '/imports/constants/VARIABLE_NAME_REGEX.js';
|
||||
import ErrorSchema from '/imports/api/properties/subSchemas/ErrorSchema.js';
|
||||
|
||||
/*
|
||||
* Skills are anything that results in a modifier to be added to a D20
|
||||
@@ -37,9 +38,9 @@ let SkillSchema = new SimpleSchema({
|
||||
],
|
||||
defaultValue: 'skill',
|
||||
},
|
||||
// If the baseValue is higher than the computed value, it will be used as `value`
|
||||
baseValue: {
|
||||
type: Number,
|
||||
// The starting value, before effects
|
||||
baseValueCalculation: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
// The base proficiency of this skill
|
||||
@@ -59,6 +60,18 @@ let ComputedOnlySkillSchema = new SimpleSchema({
|
||||
value: {
|
||||
type: Number,
|
||||
defaultValue: 0,
|
||||
},
|
||||
// The result of baseValueCalculation
|
||||
baseValue: {
|
||||
type: SimpleSchema.oneOf(Number, String, Boolean),
|
||||
optional: true,
|
||||
},
|
||||
baseValueErrors: {
|
||||
type: Array,
|
||||
optional: true,
|
||||
},
|
||||
'baseValueErrors.$': {
|
||||
type: ErrorSchema,
|
||||
},
|
||||
// Computed value added by the ability
|
||||
abilityMod: {
|
||||
|
||||
Reference in New Issue
Block a user