Merge pull request #168 from Frogvall/master

Adding advantage/disadvantage arrows to initiative stat card
This commit is contained in:
Stefan Zermatten
2018-08-23 11:34:02 +02:00
committed by GitHub
3 changed files with 23 additions and 1 deletions

View File

@@ -14,3 +14,17 @@
min-width: 72px;
padding: 16px;
}
.stat-card .advantage{
background-image: url(/png/advantage/greenUp.png);
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}
.stat-card .disadvantage{
background-image: url(/png/advantage/redDown.png);
background-size: contain;
background-repeat: no-repeat;
background-position: center;
}

View File

@@ -3,7 +3,9 @@
<paper-material class="stat-card layout horizontal {{#if bounce}}bounce{{/if}}">
<div class="numbers paper-font-display1">
{{#if isSkill}}
{{prefix}}{{skillMod}}
<div class="{{advantage}}">
{{prefix}}{{skillMod}}
</div>
{{else}}
{{prefix}}{{characterCalculate "attributeValue" ../_id stat}}
{{/if}}

View File

@@ -6,4 +6,10 @@ Template.statCard.helpers({
)
);
},
advantage: function(){
var charId = Template.parentData()._id;
var advantage = Characters.calculate.advantage(charId, this.stat);
if (advantage > 0) return "advantage";
if (advantage < 0) return "disadvantage";
},
});