From 76ba6b441e724c586cf0fc7bfd1996885e890caf Mon Sep 17 00:00:00 2001 From: Thaum Date: Wed, 4 Mar 2015 13:41:30 +0000 Subject: [PATCH] Added standard effects --- rpg-docs/Model/Character/Characters.js | 27 +------------------ rpg-docs/Model/Character/Effects.js | 37 ++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/rpg-docs/Model/Character/Characters.js b/rpg-docs/Model/Character/Characters.js index d248f7cd..2ef5f0fc 100644 --- a/rpg-docs/Model/Character/Characters.js +++ b/rpg-docs/Model/Character/Characters.js @@ -197,31 +197,6 @@ Schemas.Character = new SimpleSchema({ Characters.attachSchema(Schemas.Character); -//TODO on creating a new character, these effects need to be set up -/* -"hitPoints.effects": { - type: [Schemas.Effect], - defaultValue: [ - {name: "Constitution modifier for each level", calculation: "level * constitutionMod", operation: "add", type: "inate"} - ] - }, - "proficiencyBonus.effects": { - type: [Schemas.Effect], - defaultValue: [ - {name: "Proficiency bonus by level", calculation: "floor(level / 4 + 1.75)", operation: "add", type: "inate"} - ] - }, - "armor.effects": { - type: [Schemas.Effect], - defaultValue: [ - {name: "Dexterity Modifier", calculation: "dexterityArmor", operation: "add", type: "inate"} - ] - }, - {type: "inate", name: "Resistance doesn't stack", operation: "min", value: 0.5}, - {type: "inate", name: "Vulnerability doesn't stack", operation: "max", value: 2} - {stat: "armor", name: "Natural Armor", value: 10, operation: "base", type: "inate"}} -*/ - var attributeBase = function(charId, statName){ check(statName, String); var effects = Effects.find({charId: charId, stat: statName, enabled: true}).fetch(); @@ -473,7 +448,7 @@ Characters.before.remove(function (userId, character) { Buffs .remove({charId: character._id}); Classes .remove({charId: character._id}); Effects .remove({charId: character._id}); - Experience .remove({charId: character._id}); + Experiences .remove({charId: character._id}); Features .remove({charId: character._id}); Notes .remove({charId: character._id}); Proficiencies .remove({charId: character._id}); diff --git a/rpg-docs/Model/Character/Effects.js b/rpg-docs/Model/Character/Effects.js index 160bd963..5afbf118 100644 --- a/rpg-docs/Model/Character/Effects.js +++ b/rpg-docs/Model/Character/Effects.js @@ -53,3 +53,40 @@ Schemas.Effect = new SimpleSchema({ }); Effects.attachSchema(Schemas.Effect); + +Characters.after.insert(function (userId, char) { + if(Meteor.isServer){ + Effects.insert({ + charId: char._id, + type: "inate", + name: "Constitution modifier for each level", + stat: "hitPoints", + operation: "add", + calculation: "level * constitutionMod" + }); + Effects.insert({ + charId: char._id, + type: "inate", + name: "Proficiency bonus by level", + stat: "proficiencyBonus", + operation: "add", + calculation: "floor(level / 4 + 1.75)" + }); + Effects.insert({ + charId: char._id, + type: "inate", + name: "Dexterity Armor Bonus", + stat: "armor", + operation: "add", + calculation: "dexterityArmor" + }); + Effects.insert({ + charId: char._id, + type: "inate", + name: "Natural Armor", + stat: "armor", + operation: "base", + value: 10 + }); + } +});