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}] },
|
||||
});
|
||||
@@ -1,92 +0,0 @@
|
||||
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 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
|
||||
add: { type: [Schemas.Effect], defaultValue: [] },
|
||||
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}] },
|
||||
conditional:{ type: [Schemas.Effect], defaultValue: [] },
|
||||
});
|
||||
|
||||
Schemas.Attributes = new SimpleSchema({
|
||||
//ability scores
|
||||
strength: {type: Schemas.Attribute},
|
||||
dexterity: {type: Schemas.Attribute},
|
||||
constitution: {type: Schemas.Attribute},
|
||||
intelligence: {type: Schemas.Attribute},
|
||||
wisdom: {type: Schemas.Attribute},
|
||||
charisma: {type: Schemas.Attribute},
|
||||
|
||||
//stats
|
||||
hitPoints: {type: Schemas.Attribute},
|
||||
experience: {type: Schemas.Attribute},
|
||||
proficiencyBonus: {type: Schemas.Attribute},
|
||||
speed: {type: Schemas.Attribute},
|
||||
weight: {type: Schemas.Attribute},
|
||||
weightCarried: {type: Schemas.Attribute},
|
||||
age: {type: Schemas.Attribute},
|
||||
ageRate: {type: Schemas.Attribute},
|
||||
armor: {type: Schemas.Attribute},
|
||||
"armor.add": {
|
||||
type: [Schemas.Effect],
|
||||
defaultValue: [
|
||||
{name: "Dexterity Modifier", calculation: "dexterityArmor"}
|
||||
]
|
||||
},
|
||||
|
||||
//resources
|
||||
level1SpellSlots: {type: Schemas.Attribute},
|
||||
level2SpellSlots: {type: Schemas.Attribute},
|
||||
level3SpellSlots: {type: Schemas.Attribute},
|
||||
level4SpellSlots: {type: Schemas.Attribute},
|
||||
level5SpellSlots: {type: Schemas.Attribute},
|
||||
level6SpellSlots: {type: Schemas.Attribute},
|
||||
level7SpellSlots: {type: Schemas.Attribute},
|
||||
level8SpellSlots: {type: Schemas.Attribute},
|
||||
level9SpellSlots: {type: Schemas.Attribute},
|
||||
ki: {type: Schemas.Attribute},
|
||||
sorceryPoints: {type: Schemas.Attribute},
|
||||
rages: {type: Schemas.Attribute},
|
||||
|
||||
|
||||
//hit dice
|
||||
d6HitDice: {type: Schemas.Attribute},
|
||||
d8HitDice: {type: Schemas.Attribute},
|
||||
d10HitDice: {type: Schemas.Attribute},
|
||||
d12HitDice: {type: Schemas.Attribute},
|
||||
|
||||
//vulnerabilities
|
||||
acidMultiplier: {type: Schemas.Vulnerability},
|
||||
bludgeoningMultiplier: {type: Schemas.Vulnerability},
|
||||
coldMultiplier: {type: Schemas.Vulnerability},
|
||||
fireMultiplier: {type: Schemas.Vulnerability},
|
||||
forceMultiplier: {type: Schemas.Vulnerability},
|
||||
lightningMultiplier: {type: Schemas.Vulnerability},
|
||||
necroticMultiplier: {type: Schemas.Vulnerability},
|
||||
piercingMultiplier: {type: Schemas.Vulnerability},
|
||||
poisonMultiplier: {type: Schemas.Vulnerability},
|
||||
psychicMultiplier: {type: Schemas.Vulnerability},
|
||||
radiantMultiplier: {type: Schemas.Vulnerability},
|
||||
slashingMultiplier: {type: Schemas.Vulnerability},
|
||||
thunderMultiplier: {type: Schemas.Vulnerability},
|
||||
});
|
||||
@@ -1,19 +0,0 @@
|
||||
Schemas.Proficiency = new SimpleSchema({
|
||||
name: {type: String},
|
||||
source: {type: String}
|
||||
})
|
||||
|
||||
Schemas.Proficiencies = new SimpleSchema({
|
||||
weapons: {
|
||||
type: [Schemas.Proficiency],
|
||||
defaultValue: []
|
||||
},
|
||||
tools: {
|
||||
type: [Schemas.Proficiency],
|
||||
defaultValue: []
|
||||
},
|
||||
languages: {
|
||||
type: [Schemas.Proficiency],
|
||||
defaultValue: []
|
||||
}
|
||||
});
|
||||
4
rpg-docs/Model/Character/SubSchemas/Proficiency.js
Normal file
4
rpg-docs/Model/Character/SubSchemas/Proficiency.js
Normal file
@@ -0,0 +1,4 @@
|
||||
Schemas.Proficiency = new SimpleSchema({
|
||||
name: {type: String},
|
||||
source: {type: String}
|
||||
})
|
||||
25
rpg-docs/Model/Character/SubSchemas/Skill.js
Normal file
25
rpg-docs/Model/Character/SubSchemas/Skill.js
Normal file
@@ -0,0 +1,25 @@
|
||||
Schemas.Skill = new SimpleSchema({
|
||||
//attribute name that this skill used as base mod for roll
|
||||
ability: { type: String, defaultValue: "" },
|
||||
//multiplied by profBonus and added to base mod
|
||||
//only highest value proficiency is used
|
||||
proficiency: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//added to base mod
|
||||
add: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//multiplied by base + adds
|
||||
mul: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//lower bounds, highest used
|
||||
min: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//upper bounds, lowest used
|
||||
max: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//things giving advantage
|
||||
advantage: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//things giving disadvantage
|
||||
disadvantage: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//added to passive checks only
|
||||
passiveAdd: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//things causing all rolls to fail
|
||||
fail: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//things that only apply sometimes
|
||||
conditional: { type: [Schemas.Effect], defaultValue: [] }
|
||||
});
|
||||
@@ -1,159 +0,0 @@
|
||||
Schemas.Skill = new SimpleSchema({
|
||||
//attribute name that this skill used as base mod for roll
|
||||
ability: { type: String, defaultValue: "" },
|
||||
//multiplied by profBonus and added to base mod
|
||||
//only highest value proficiency is used
|
||||
proficiency: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//added to base mod
|
||||
add: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//multiplied by base + adds
|
||||
mul: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//lower bounds, highest used
|
||||
min: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//upper bounds, lowest used
|
||||
max: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//things giving advantage
|
||||
advantage: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//things giving disadvantage
|
||||
disadvantage: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//added to passive checks only
|
||||
passiveAdd: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//things causing all rolls to fail
|
||||
fail: { type: [Schemas.Effect], defaultValue: [] },
|
||||
//things that only apply sometimes
|
||||
conditional: { type: [Schemas.Effect], defaultValue: [] }
|
||||
});
|
||||
|
||||
Schemas.Skills = new SimpleSchema({
|
||||
//saves
|
||||
strengthSave: {type: Schemas.Skill},
|
||||
"strengthSave.ability": { type: String, defaultValue: "strength" },
|
||||
|
||||
dexteritySave: {type: Schemas.Skill},
|
||||
"dexteritySave.ability": { type: String, defaultValue: "dexterity" },
|
||||
|
||||
constitutionSave:{type: Schemas.Skill},
|
||||
"constitutionSave.ability": { type: String, defaultValue: "constitution" },
|
||||
|
||||
intelligenceSave:{type: Schemas.Skill},
|
||||
"intelligenceSave.ability": { type: String, defaultValue: "intelligence" },
|
||||
|
||||
wisdomSave: {type: Schemas.Skill},
|
||||
"wisdomSave.ability": { type: String, defaultValue: "wisdom" },
|
||||
|
||||
charismaSave: {type: Schemas.Skill},
|
||||
"charismaSave.ability": { type: String, defaultValue: "charisma" },
|
||||
|
||||
|
||||
//skill skills
|
||||
acrobatics: {type: Schemas.Skill},
|
||||
"acrobatics.ability": { type: String, defaultValue: "dexterity" },
|
||||
|
||||
animalHandling: {type: Schemas.Skill},
|
||||
"animalHandling.ability": { type: String, defaultValue: "wisdom" },
|
||||
|
||||
arcana: {type: Schemas.Skill},
|
||||
"arcana.ability": { type: String, defaultValue: "intelligence" },
|
||||
|
||||
athletics: {type: Schemas.Skill},
|
||||
"athletics.ability": { type: String, defaultValue: "strength" },
|
||||
|
||||
deception: {type: Schemas.Skill},
|
||||
"deception.ability": { type: String, defaultValue: "charisma" },
|
||||
|
||||
history: {type: Schemas.Skill},
|
||||
"history.ability": { type: String, defaultValue: "intelligence" },
|
||||
|
||||
insight: {type: Schemas.Skill},
|
||||
"insight.ability": { type: String, defaultValue: "wisdom" },
|
||||
|
||||
intimidation: {type: Schemas.Skill},
|
||||
"intimidation.ability": { type: String, defaultValue: "charisma" },
|
||||
|
||||
investigation: {type: Schemas.Skill},
|
||||
"investigation.ability": { type: String, defaultValue: "intelligence" },
|
||||
|
||||
medicine: {type: Schemas.Skill},
|
||||
"medicine.ability": { type: String, defaultValue: "wisdom" },
|
||||
|
||||
nature: {type: Schemas.Skill},
|
||||
"nature.ability": { type: String, defaultValue: "intelligence" },
|
||||
|
||||
perception: {type: Schemas.Skill},
|
||||
"perception.ability": { type: String, defaultValue: "wisdom" },
|
||||
|
||||
performance: {type: Schemas.Skill},
|
||||
"performance.ability": { type: String, defaultValue: "charisma" },
|
||||
|
||||
persuasion: {type: Schemas.Skill},
|
||||
"persuasion.ability": { type: String, defaultValue: "charisma" },
|
||||
|
||||
religion: {type: Schemas.Skill},
|
||||
"religion.ability": { type: String, defaultValue: "intelligence" },
|
||||
|
||||
sleightOfHand: {type: Schemas.Skill},
|
||||
"sleightOfHand.ability": { type: String, defaultValue: "dexterity" },
|
||||
|
||||
stealth: {type: Schemas.Skill},
|
||||
"stealth.ability": { type: String, defaultValue: "dexterity" },
|
||||
|
||||
survival: {type: Schemas.Skill},
|
||||
"survival.ability": { type: String, defaultValue: "wisdom" },
|
||||
|
||||
|
||||
//Mechanical Skills
|
||||
initiative: {type: Schemas.Skill},
|
||||
"initiative.ability": { type: String, defaultValue: "dexterity" },
|
||||
|
||||
strengthAttack: {type: Schemas.Skill},
|
||||
"strengthAttack.ability": {type: String,defaultValue: "strength"},
|
||||
"strengthAttack.proficiency": {
|
||||
type: [Schemas.Effect],
|
||||
defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
|
||||
},
|
||||
|
||||
dexterityAttack: {type: Schemas.Skill},
|
||||
"dexterityAttack.ability": { type: String, defaultValue: "dexterity" },
|
||||
"dexterityAttack.proficiency": {
|
||||
type: [Schemas.Effect],
|
||||
defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
|
||||
},
|
||||
|
||||
constitutionAttack: {type: Schemas.Skill},
|
||||
"constitutionAttack.ability":{ type: String, defaultValue: "constitution" },
|
||||
"constitutionAttack.proficiency": {
|
||||
type: [Schemas.Effect],
|
||||
defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
|
||||
},
|
||||
|
||||
intelligenceAttack: {type: Schemas.Skill},
|
||||
"intelligenceAttack.ability":{ type: String, defaultValue: "intelligence" },
|
||||
"intelligenceAttack.proficiency": {
|
||||
type: [Schemas.Effect],
|
||||
defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
|
||||
},
|
||||
|
||||
wisdomAttack: {type: Schemas.Skill},
|
||||
"wisdomAttack.ability": { type: String, defaultValue: "wisdom" },
|
||||
"wisdomAttack.proficiency": {
|
||||
type: [Schemas.Effect],
|
||||
defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
|
||||
},
|
||||
|
||||
charismaAttack: {type: Schemas.Skill},
|
||||
"charismaAttack.ability": { type: String, defaultValue: "charisma" },
|
||||
"charismaAttack.proficiency": {
|
||||
type: [Schemas.Effect],
|
||||
defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
|
||||
},
|
||||
|
||||
rangedAttack: {type: Schemas.Skill},
|
||||
"rangedAttack.ability": { type: String, defaultValue: "dexterity" },
|
||||
"rangedAttack.proficiency": {
|
||||
type: [Schemas.Effect],
|
||||
defaultValue: [{_id: Random.id(),name: "Attack Proficiency",value: 1}]
|
||||
},
|
||||
|
||||
dexterityArmor: {type: Schemas.Skill},
|
||||
"dexterityArmor.ability": { type: String, defaultValue: "dexterity" }
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
Schemas.Strings = new SimpleSchema({
|
||||
name: { type: String, defaultValue: "", optional: true },
|
||||
alignment: { type: String, defaultValue: "", optional: true },
|
||||
gender: { type: String, defaultValue: "", optional: true },
|
||||
race: { type: String, defaultValue: "", optional: true },
|
||||
description:{ type: String, defaultValue: "", optional: true },
|
||||
personality:{ type: String, defaultValue: "", optional: true },
|
||||
ideals: { type: String, defaultValue: "", optional: true },
|
||||
bonds: { type: String, defaultValue: "", optional: true },
|
||||
flaws: { type: String, defaultValue: "", optional: true },
|
||||
backstory: { type: String, defaultValue: "", optional: true },
|
||||
notes: { type: String, defaultValue: "", optional: true },
|
||||
});
|
||||
Reference in New Issue
Block a user