Skillrows overhauled to material design specs

This commit is contained in:
Thaum
2015-02-03 14:06:51 +00:00
parent 58917ce3db
commit 63df21934d
5 changed files with 42 additions and 66 deletions

View File

@@ -1,40 +1,22 @@
Template.skillRow.helpers({
profIcon: function(skill){
profIcon: function(){
var prof = Template.parentData(1).proficiency(this.skill);
if(prof > 0 && prof < 1) return "profHalf.png";
if(prof === 1) return "profSingle.png";
if(prof > 1) return "profDouble.png";
return "profNone.png";
if(prof > 0 && prof < 1) return "image:brightness-2";
if(prof === 1) return "image:brightness-1";
if(prof > 1) return "av:album";
return "radio-button-off";
},
failSkill: function(){
var skill = Template.parentData(1).getField(this.skill);
_.each(skill.effets, function(effect){
if (effect.operation === "fail"){
return true;
}
})
return false;
var charId = Template.parentData(1)._id;
return Effects.find({charId: charId, stat: this.skill, enabled: true, operation: "fail"}).count();
},
advantage: function(){
var adv = 0;
var disadv = 0;
var skill = Template.parentData(1).getField(this.skill);
_.each(skill.effets, function(effect){
if (effect.operation === "advantage"){
adv ++;
} else if (effect.operation === "disadvantage") {
disadv ++;
}
})
if(adv > 0 && disadv === 0) return "advantage";
if(disadv > 0 && adv === 0) return "disadvantage";
var advantage = Template.parentData(1).advantage(this.skill);
if(advantage > 0) return "advantage";
if(advantage < 0) return "disadvantage";
},
conditionals: function(){
var skill = Template.parentData(1).getField(this.skill);
_.each(skill.effets, function(effect){
if (effect.operation === "conditional"){
return "conditionals";
}
})
conditionalCount: function(){
var charId = Template.parentData(1)._id;
return Effects.find({charId: charId, stat: this.skill, enabled: true, operation: "conditional"}).count();
}
});