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.
This commit is contained in:
27
rpg-docs/Model/Character/SubSchemas/Attribute.js
Normal file
27
rpg-docs/Model/Character/SubSchemas/Attribute.js
Normal file
@@ -0,0 +1,27 @@
|
||||
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}] },
|
||||
});
|
||||
Reference in New Issue
Block a user