Fixed bug with skillMod calculation

This commit is contained in:
Thaum
2015-01-28 12:12:43 +00:00
parent 7b8fec8e8a
commit 848902c358
2 changed files with 3 additions and 6 deletions

View File

@@ -349,7 +349,7 @@ Characters.helpers({
var mod = +getMod(ability)
//multiply proficiency bonus by largest value in proficiency array
var prof = this.proficiency(skill);
var prof = this.proficiency(skillName);
//add multiplied proficiency bonus to modifier
mod += prof * this.attributeValue("proficiencyBonus");

View File

@@ -36,6 +36,7 @@ Items.helpers({
});
//keep effects sycned with items
//if an item's equipped state changes, update related effects' enabled state
Items.find({}, {fields: {equipped: 1}}).observeChanges({
added: function(id, fields){
Effects.find({ type: "equipment", sourceId: id, enabled: {$ne: fields.equipped} },
@@ -48,14 +49,10 @@ Items.find({}, {fields: {equipped: 1}}).observeChanges({
{fields: {enabled: 1} }).forEach(function(effect){
Effects.update(effect._id, {$set: {enabled: fields.equipped}})
});
},
removed: function(id){
Effects.find({type: "equipment", sourceId: id}, {fields: {_id: 1} }).forEach(function(effect){
Effects.remove(effect._id);
});
}
});
//if an effect's type, source or enabled state change, keep the enabled state up to date with the item's equipped state
Effects.find({type: "equipment"}, {fields: {type: 1, enabled: 1, sourceId: 1}}).observe({
added: function(newEffect){
var item = Items.findOne(newEffect.sourceId, {fields: {equipped: 1}});