Files
DiceCloud/rpg-docs/Model/Character/SubSchemas/Attribute.js
Thaum ca7a625534 Consolidated all sub-documents into character document to improve granularity significantly
Because just the top-level field changing invalidates everything in the sub-document, a single attribute change would trigger a re-calculation on all attributes and their dependents. This change should significantly improve performance.
2014-11-20 09:02:10 +00:00

27 lines
933 B
JavaScript

Schemas.Attribute = new SimpleSchema({
//the unmodified value of the attribute
//should be zero for most attributes after a long rest
base: {
type: Number,
defaultValue: 0
},
//effect arrays
add: { type: [Schemas.Effect], defaultValue: [] },
mul: { type: [Schemas.Effect], defaultValue: [] },
min: { type: [Schemas.Effect], defaultValue: [] },
max: { type: [Schemas.Effect], defaultValue: [] },
conditional:{ type: [Schemas.Effect], defaultValue: [] }
});
//note that to make an invulnerability add a new max of zero value
Schemas.Vulnerability = new SimpleSchema({
//same as attribute
base: {
type: Number,
defaultValue: 0
},
//effect arrays
mul: { type: [Schemas.Effect], defaultValue: [] },
min: { type: [Schemas.Effect], defaultValue: [{name: "Resistance doesn't stack", value: 0.5}] },
max: { type: [Schemas.Effect], defaultValue: [{name: "Vulnerability doesn't stack", value: 2}] },
});