Implemented item attack summaries

This commit is contained in:
Thaum
2015-04-16 11:52:17 +00:00
parent 7cd353894c
commit e6487c9416
9 changed files with 49 additions and 18 deletions

View File

@@ -161,6 +161,14 @@ paper-button {
right: 24px;
}
.wideTable td {
padding: 4px 8px 4px 8px;
}
.wideTable table {
padding: 8px;
}
paper-fab-menu /deep/ .container {
padding: 24px !important;
}
@@ -219,6 +227,10 @@ paper-slider {
margin-bottom: 16px;
}
.spaceAfter {
margin-bottom: 8px;
}
.s {
padding: 0 0 16px 0;
}

View File

@@ -0,0 +1,17 @@
<template name="attackView">
<div class="attackView" layout horizontal>
<div class="headline rightPadded" layout horizontal center>
{{evaluateSigned charId attackBonus}}
</div>
<div layout vertical>
<div>
{{damageDice}}&nbsp;{{{evaluateSignedSpaced charId damageBonus}}}&nbsp;{{damageType}}
</div>
{{#if details}}
<div class="caption">
{{details}}
</div>
{{/if}}
</div>
</div>
</template>

View File

@@ -1,3 +1,11 @@
<template name="attacksViewList">
Attacks view list goes here
{{#if attacks.count}}
<hr style="margin: 16px 0 16px 0;">
<div class="attacks">
<h2 class="spaceAfter">Attacks</h2>
{{#each attacks}}
{{> attackView}}
{{/each}}
</div>
{{/if}}
</template>

View File

@@ -0,0 +1,5 @@
Template.attacksViewList.helpers({
attacks: function(){
return Attacks.find({"parent.id": this.parentId, charId: this.charId});
}
});

View File

@@ -1,7 +0,0 @@
.effects td {
padding: 4px 8px 4px 8px;
}
.effects table {
padding: 8px;
}

View File

@@ -109,6 +109,7 @@ Template.effectView.helpers({
operationName: function(){
if(this.operation === "proficiency") return null;
if(stats[this.stat].group === "Weakness/Resistance") return null;
if(this.operation === "add" && evaluateEffect(this.charId, this) < 0) return null;
return operations[this.operation] && operations[this.operation].name || "No Operation";
},
statValue: function(){
@@ -128,6 +129,6 @@ Template.effectView.helpers({
if(this.value == 2 || this.calculation == 2) return "Vulnerability";
if(this.value == 0 || this.calculation == 0) return "Immunity";
}
return this.calculation || this.value;
return evaluateEffect(this.charId, this);
}
});

View File

@@ -3,8 +3,8 @@
{{#if effects.count}}
<hr style="margin: 16px 0 16px 0;">
<div class="effects">
<h2>Effects</h2>
<table>
<h2 class="spaceAfter">Effects</h2>
<table class="wideTable">
{{#each effects}}
{{>effectView}}
{{/each}}

View File

@@ -1,10 +1,5 @@
Template.effectsViewList.helpers({
effects: function(){
if(this.parentId){
return Effects.find({"parent.id": this.parentId, charId: this.charId}, {fields: {parent: 0}});
} else if(this.stat){
return Effects.find({charId: this.charId, stat: this.stat});
}
return Effects.find({"parent.id": this.parentId, charId: this.charId}, {fields: {parent: 0}});
}
});

View File

@@ -24,7 +24,7 @@
<div class="prewrap">{{description}}</div>
{{/if}}
{{> effectsViewList charId=charId parentId=_id}}
{{> attacksViewList}}
{{> attacksViewList charId=charId parentId=_id}}
</template>
<template name="itemEdit">