Started restructuring the library with attacks, saves, and limited parenting
This commit is contained in:
38
app/imports/api/properties/Attacks.js
Normal file
38
app/imports/api/properties/Attacks.js
Normal file
@@ -0,0 +1,38 @@
|
||||
import SimpleSchema from 'simpl-schema';
|
||||
import AdjustmentSchema from '/imports/api/creature/subSchemas/AdjustmentSchema.js';
|
||||
import { ActionSchema } from '/imports/api/properties/Actions.js';
|
||||
|
||||
// Attacks are special instances of actions
|
||||
let AttackSchema = new SimpleSchema()
|
||||
.extend(ActionSchema)
|
||||
.extend({
|
||||
// What gets added to the d20 roll
|
||||
rollBonus: {
|
||||
type: String,
|
||||
optional: true,
|
||||
},
|
||||
// What damage does it do to the targets
|
||||
adjustments: {
|
||||
type: Array,
|
||||
defaultValue: [],
|
||||
},
|
||||
'adjustments.$': {
|
||||
type: AdjustmentSchema,
|
||||
},
|
||||
// If set reference an item whose quantity is reduced by 1 every time this
|
||||
// attack is rolled
|
||||
ammunition: {
|
||||
type: String,
|
||||
regEx: SimpleSchema.RegEx.Id,
|
||||
optional: true,
|
||||
},
|
||||
// Set better defaults for the action
|
||||
type: {
|
||||
defaultValue: 'attack',
|
||||
},
|
||||
tags: {
|
||||
defaultValue: ['attack'],
|
||||
},
|
||||
});
|
||||
|
||||
export { AttackSchema };
|
||||
Reference in New Issue
Block a user