Added Resources, improved layout

This commit is contained in:
Thaum
2015-02-17 13:46:35 +00:00
parent d18c58c5ed
commit 9601826475
12 changed files with 221 additions and 26 deletions

View File

@@ -40,4 +40,30 @@ Template.features.events({
var featureId = this._id;
Features.update(featureId, {$set: {used: 0}});
}
});
});
Template.resource.helpers({
cantIncrement: function(){
return !(this.char.attributeValue(this.name) < this.char.attributeBase(this.name));
},
cantDecrement: function(){
return !(this.char.attributeValue(this.name) > 0);
}
});
Template.resource.events({
"tap .resourceUp": function(event){
if(this.char.attributeValue(this.name) < this.char.attributeBase(this.name)){
var modifier = {$inc: {}};
modifier.$inc[this.name + ".adjustment"] = 1;
Characters.update(this.char._id, modifier, {validate: false});
}
},
"tap .resourceDown": function(event){
if(this.char.attributeValue(this.name) > 0){
var modifier = {$inc: {}};
modifier.$inc[this.name + ".adjustment"] = -1;
Characters.update(this.char._id, modifier, {validate: false});
}
}
});