diff --git a/rpg-docs/Model/Character/Effects.js b/rpg-docs/Model/Character/Effects.js index 44cc8036..e2d7118f 100644 --- a/rpg-docs/Model/Character/Effects.js +++ b/rpg-docs/Model/Character/Effects.js @@ -59,71 +59,74 @@ Schemas.Effect = new SimpleSchema({ Effects.attachSchema(Schemas.Effect); -if (Meteor.isServer) Characters.after.insert(function(userId, char) { - Effects.insert({ - charId: char._id, - name: "Constitution modifier for each level", - stat: "hitPoints", - operation: "add", - calculation: "level * constitutionMod", - parent: { - id: char._id, - collection: "Characters", - group: "Inate", - }, - }); - Effects.insert({ - charId: char._id, - name: "Proficiency bonus by level", - stat: "proficiencyBonus", - operation: "add", - calculation: "floor(level / 4 + 1.75)", - parent: { - id: char._id, - collection: "Characters", - group: "Inate", - }, - }); - Effects.insert({ - charId: char._id, - name: "Dexterity Armor Bonus", - stat: "armor", - operation: "add", - calculation: "dexterityArmor", - parent: { - id: char._id, - collection: "Characters", - group: "Inate", - }, - }); - Effects.insert({ - charId: char._id, - name: "Natural Armor", - stat: "armor", - operation: "base", - value: 10, - parent: { - id: char._id, - collection: "Characters", - group: "Inate", - }, - }); - Effects.insert({ - charId: char._id, - name: "Natural Carrying Capacity", - stat: "carryMultiplier", - operation: "base", - value: "1", - parent: { - id: char._id, - collection: "Characters", - group: "Inate", - }, - }); -}); - Effects.attachBehaviour("softRemovable"); makeChild(Effects, ["enabled"]); //children of lots of things Effects.allow(CHARACTER_SUBSCHEMA_ALLOW); Effects.deny(CHARACTER_SUBSCHEMA_DENY); + +//give characters default character effects +Characters.after.insert(function(userId, char) { + if (Meteor.isServer) { + Effects.insert({ + charId: char._id, + name: "Constitution modifier for each level", + stat: "hitPoints", + operation: "add", + calculation: "level * constitutionMod", + parent: { + id: char._id, + collection: "Characters", + group: "Inate", + }, + }); + Effects.insert({ + charId: char._id, + name: "Proficiency bonus by level", + stat: "proficiencyBonus", + operation: "add", + calculation: "floor(level / 4 + 1.75)", + parent: { + id: char._id, + collection: "Characters", + group: "Inate", + }, + }); + Effects.insert({ + charId: char._id, + name: "Dexterity Armor Bonus", + stat: "armor", + operation: "add", + calculation: "dexterityArmor", + parent: { + id: char._id, + collection: "Characters", + group: "Inate", + }, + }); + Effects.insert({ + charId: char._id, + name: "Natural Armor", + stat: "armor", + operation: "base", + value: 10, + parent: { + id: char._id, + collection: "Characters", + group: "Inate", + }, + }); + Effects.insert({ + charId: char._id, + name: "Natural Carrying Capacity", + stat: "carryMultiplier", + operation: "base", + value: "1", + parent: { + id: char._id, + collection: "Characters", + group: "Inate", + }, + }); + } +}); diff --git a/rpg-docs/Model/Character/Features.js b/rpg-docs/Model/Character/Features.js index 24a2b5e9..29b8c7d5 100644 --- a/rpg-docs/Model/Character/Features.js +++ b/rpg-docs/Model/Character/Features.js @@ -35,3 +35,81 @@ makeParent(Features, ["name", "enabled"]); //parents of effects and attacks Features.allow(CHARACTER_SUBSCHEMA_ALLOW); Features.deny(CHARACTER_SUBSCHEMA_DENY); + +//give characters default feature of base ability scores of 10 +Characters.after.insert(function(userId, char) { + if (Meteor.isServer){ + var featureId = Features.insert({ + name: "Base Ability Scores", + charId: char._id, + enabled: true, + alwaysEnabled: true, + }); + Effects.insert({ + stat: "strength", + charId: char._id, + parent: { + id: featureId, + collection: "Features", + }, + operation: "base", + value: 10, + enabled: true, + }); + Effects.insert({ + stat: "dexterity", + charId: char._id, + parent: { + id: featureId, + collection: "Features", + }, + operation: "base", + value: 10, + enabled: true, + }); + Effects.insert({ + stat: "constitution", + charId: char._id, + parent: { + id: featureId, + collection: "Features", + }, + operation: "base", + value: 10, + enabled: true, + }); + Effects.insert({ + stat: "intelligence", + charId: char._id, + parent: { + id: featureId, + collection: "Features", + }, + operation: "base", + value: 10, + enabled: true, + }); + Effects.insert({ + stat: "wisdom", + charId: char._id, + parent: { + id: featureId, + collection: "Features", + }, + operation: "base", + value: 10, + enabled: true, + }); + Effects.insert({ + stat: "charisma", + charId: char._id, + parent: { + id: featureId, + collection: "Features", + }, + operation: "base", + value: 10, + enabled: true, + }); + } +});