Damage multipliers can now target or exclude tags

This commit is contained in:
Stefan Zermatten
2019-08-06 16:37:38 +02:00
parent 16d61eb708
commit 50621ca269
2 changed files with 22 additions and 5 deletions

View File

@@ -1,5 +1,6 @@
import SimpleSchema from 'simpl-schema';
import DAMAGE_TYPES from '/imports/constants/DAMAGE_TYPES.js';
// TODO consider damage types as an array that applies to multiple types at once
/*
* DamageMultipliers are multipliers that affect how much damage is taken from
@@ -10,11 +11,14 @@ let DamageMultiplierSchema = new SimpleSchema({
type: String,
optional: true,
},
damageTypes: {
type: Array,
defaultValue: [],
},
// The technical, lowercase, single-word name used in formulae
damageType: {
'damageTypes.$': {
type: String,
allowedValues: DAMAGE_TYPES,
defaultValue: 'bludgeoning',
},
// The value of the damage multiplier
value: {
@@ -22,6 +26,22 @@ let DamageMultiplierSchema = new SimpleSchema({
defaultValue: 0.5,
allowedValues: [0, 0.5, 2],
},
// Tags which bypass this multiplier (OR)
excludeTags: {
type: Array,
defaultValue: [],
},
'excludeTags.$': {
type: String,
},
// Tags which must be present to be affected by this multiplier (AND)
targetTags: {
type: Array,
defaultValue: [],
},
'targetTags.$': {
type: String,
},
});
export { DamageMultiplierSchema };

View File

@@ -2,9 +2,6 @@ const DAMAGE_TYPES = Object.freeze([
"bludgeoning",
"piercing",
"slashing",
"magicalBludgeoning",
"magicalPiercing",
"magicalSlashing",
"acid",
"cold",
"fire",