Improved action and attack schemas
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeChild} from "/imports/api/parenting.js";
|
||||
import {makeChild} from '/imports/api/parenting.js';
|
||||
import AdjustmentSchema from '/imports/api/creature/subSchemas/AdjustmentSchema.js';
|
||||
import DamageSchema from '/imports/api/creature/subSchemas/DamageSchema.js';
|
||||
|
||||
let Actions = new Mongo.Collection("actions");
|
||||
let Actions = new Mongo.Collection('actions');
|
||||
|
||||
/*
|
||||
* Actions are given to a character by items and features
|
||||
@@ -18,6 +20,10 @@ let actionSchema = schema({
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
enabled: {
|
||||
type: Boolean,
|
||||
defaultValue: true,
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
optional: true,
|
||||
@@ -25,22 +31,29 @@ let actionSchema = schema({
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
allowedValues: ["action, bonus, reaction, free"],
|
||||
defaultValue: "action",
|
||||
allowedValues: ['action', 'bonus', 'reaction', 'free'],
|
||||
defaultValue: 'action',
|
||||
},
|
||||
//the immediate impact of doing this action (eg. -1 rages)
|
||||
adjustments: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
},
|
||||
"adjustments.$": {
|
||||
type: Object,
|
||||
'adjustments.$': {
|
||||
type: AdjustmentSchema,
|
||||
},
|
||||
damages: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
},
|
||||
'damages.$': {
|
||||
type: DamageSchema,
|
||||
},
|
||||
});
|
||||
|
||||
Actions.attachSchema(actionSchema);
|
||||
|
||||
// Actions.attachBehaviour("softRemovable");
|
||||
makeChild(Actions);
|
||||
// Actions.attachBehaviour('softRemovable');
|
||||
makeChild(Actions, ["name", "enabled"]);
|
||||
|
||||
export default Actions
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
import {makeChild} from "/imports/api/parenting.js";
|
||||
import DamageSchema from '/imports/api/creature/subSchemas/DamageSchema.js';
|
||||
|
||||
let Attacks = new Mongo.Collection("attacks");
|
||||
|
||||
@@ -30,30 +31,12 @@ attackSchema = schema({
|
||||
optional: true,
|
||||
trim: false,
|
||||
},
|
||||
damage: {
|
||||
type: String,
|
||||
defaultValue: "1d8 + {strengthMod}",
|
||||
optional: true,
|
||||
trim: false,
|
||||
damages: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
},
|
||||
damageType: {
|
||||
type: String,
|
||||
allowedValues: [
|
||||
"bludgeoning",
|
||||
"piercing",
|
||||
"slashing",
|
||||
"acid",
|
||||
"cold",
|
||||
"fire",
|
||||
"force",
|
||||
"lightning",
|
||||
"necrotic",
|
||||
"poison",
|
||||
"psychic",
|
||||
"radiant",
|
||||
"thunder",
|
||||
],
|
||||
defaultValue: "slashing",
|
||||
'damages.$': {
|
||||
type: DamageSchema,
|
||||
},
|
||||
enabled: {
|
||||
type: Boolean,
|
||||
|
||||
15
app/imports/api/creature/subSchemas/AdjustmentSchema.js
Normal file
15
app/imports/api/creature/subSchemas/AdjustmentSchema.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
const AdjustmentSchema = schema({
|
||||
stat: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
roll: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
});
|
||||
|
||||
export default AdjustmentSchema;
|
||||
31
app/imports/api/creature/subSchemas/DamageSchema.js
Normal file
31
app/imports/api/creature/subSchemas/DamageSchema.js
Normal file
@@ -0,0 +1,31 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import schema from '/imports/api/schema.js';
|
||||
|
||||
const DamageSchema = schema({
|
||||
type: {
|
||||
type: String,
|
||||
allowedValues: [
|
||||
"bludgeoning",
|
||||
"piercing",
|
||||
"slashing",
|
||||
"acid",
|
||||
"cold",
|
||||
"fire",
|
||||
"force",
|
||||
"lightning",
|
||||
"necrotic",
|
||||
"poison",
|
||||
"psychic",
|
||||
"radiant",
|
||||
"thunder",
|
||||
],
|
||||
defaultValue: "slashing",
|
||||
},
|
||||
roll: {
|
||||
type: String,
|
||||
optional: true,
|
||||
defaultValue: '1d8 + strengthMod',
|
||||
},
|
||||
});
|
||||
|
||||
export default DamageSchema;
|
||||
@@ -55,11 +55,6 @@
|
||||
StatsTab,
|
||||
CharacterTreeView,
|
||||
},
|
||||
watch: {
|
||||
charId(newValue){
|
||||
console.log(newValue)
|
||||
},
|
||||
},
|
||||
data(){return {
|
||||
theme,
|
||||
tab: 0,
|
||||
|
||||
Reference in New Issue
Block a user