Implemented Features and Items granting effects, actions, attacks and spells

This commit is contained in:
Thaum
2015-01-06 12:25:58 +00:00
parent c55f2c51ab
commit 2d70119ee0
48 changed files with 625 additions and 442 deletions

View File

@@ -0,0 +1,27 @@
Meteor.methods({
updateEffect: function (charId, attributeName, effectId, newEffect) {
var selector = {_id: charId};
selector[attributeName + ".effects._id"] = effectId;
var setter = {};
setter[attributeName + ".effects.$"] = newEffect
Characters.update(
selector,
{ $set: setter }
)
}
});
//pull a single effect by stat and id
pullEffect = function(id, effect){
var pullObject = {};
pullObject[effect.stat + ".effects"] = {_id: effect._id};
Characters.update(id, {$pull: pullObject });
}
pushEffect = function(id, effect){
var pushObject = {};
pushObject[effect.stat + ".effects"] = effect;
Characters.update(id, {$push: pushObject});
}