Data changes to make attacks top level objects
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import { Random } from 'meteor/random';
|
||||
import DAMAGE_TYPES from '/imports/constants/DAMAGE_TYPES.js';
|
||||
|
||||
const AdjustmentSchema = new SimpleSchema({
|
||||
_id: {
|
||||
@@ -10,8 +9,8 @@ const AdjustmentSchema = new SimpleSchema({
|
||||
if (!this.isSet) return Random.id();
|
||||
}
|
||||
},
|
||||
// The roll that determines how much to damage the attribute
|
||||
damage: {
|
||||
// The roll that determines how much to change the attribute
|
||||
adjustment: {
|
||||
type: String,
|
||||
optional: true,
|
||||
defaultValue: '1',
|
||||
@@ -31,12 +30,6 @@ const AdjustmentSchema = new SimpleSchema({
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
// If set, the type of damage this adjustment causes
|
||||
damageType: {
|
||||
type: String,
|
||||
allowedValues: DAMAGE_TYPES,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
export default AdjustmentSchema;
|
||||
|
||||
36
app/imports/api/properties/subSchemas/DamageSchema.js
Normal file
36
app/imports/api/properties/subSchemas/DamageSchema.js
Normal file
@@ -0,0 +1,36 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import { Random } from 'meteor/random';
|
||||
import DAMAGE_TYPES from '/imports/constants/DAMAGE_TYPES.js';
|
||||
|
||||
const DamageSchema = new SimpleSchema({
|
||||
_id: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
autoValue(){
|
||||
if (!this.isSet) return Random.id();
|
||||
}
|
||||
},
|
||||
// The roll that determines how much to damage the attribute
|
||||
damage: {
|
||||
type: String,
|
||||
optional: true,
|
||||
defaultValue: '1d8 + strength.modifier',
|
||||
},
|
||||
// Who this adjustment applies to
|
||||
target: {
|
||||
type: String,
|
||||
defaultValue: 'every',
|
||||
allowedValues: [
|
||||
'self', // the character who took the action
|
||||
'each', // rolled once for `each` target
|
||||
'every', // rolled once and applied to `every` target
|
||||
],
|
||||
},
|
||||
damageType: {
|
||||
type: String,
|
||||
allowedValues: DAMAGE_TYPES,
|
||||
defaultValue: 'slashing',
|
||||
},
|
||||
});
|
||||
|
||||
export default DamageSchema;
|
||||
37
app/imports/api/properties/subSchemas/RollResultsSchema.js
Normal file
37
app/imports/api/properties/subSchemas/RollResultsSchema.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import AdjustmentSchema from '/imports/api/properties/subSchemas/AdjustmentSchema.js';
|
||||
import DamageSchema from '/imports/api/properties/subSchemas/AdjustmentSchema.js';
|
||||
import { StoredBuffWithIdSchema } from '/imports/api/properties/Buffs.js';
|
||||
|
||||
let RollResultsSchema = new SimpleSchema ({
|
||||
// Expression of whether or not to apply the roll
|
||||
// Evaluates to an expression which gets compared to the roll
|
||||
// or a number which the roll must equal
|
||||
comparison: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
damages: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
},
|
||||
'damages.$': {
|
||||
type: DamageSchema,
|
||||
},
|
||||
adjustments: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
},
|
||||
'adjustments.$': {
|
||||
type: AdjustmentSchema,
|
||||
},
|
||||
buffs: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
},
|
||||
'buffs.$': {
|
||||
type: StoredBuffWithIdSchema,
|
||||
},
|
||||
});
|
||||
|
||||
export { RollResultsSchema };
|
||||
Reference in New Issue
Block a user