Added standard effects

This commit is contained in:
Thaum
2015-03-04 13:41:30 +00:00
parent 7747a97f1d
commit 76ba6b441e
2 changed files with 38 additions and 26 deletions

View File

@@ -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});

View File

@@ -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
});
}
});