Added character list. Fixed TempHP
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
<template name="healthCard">
|
||||
<paper-shadow class="card container healthCard" hero-id="main" {{detailHero}} layout horizontal wrap>
|
||||
<div class="green white-text subhead padded leftRound" layout horizontal center>
|
||||
<div class="green white-text subhead padded leftRound" layout vertical center-justified>
|
||||
Hit Points
|
||||
<paper-icon-button class="white54" id="addTempHP" icon="add"></paper-icon-button>
|
||||
</div>
|
||||
<div class="padded" flex layout vertical center-justified style="min-width: 180px;">
|
||||
<paper-slider id="hitPointSlider"
|
||||
@@ -10,7 +11,14 @@
|
||||
editable pin
|
||||
role="slider"
|
||||
></paper-slider>
|
||||
<!--Temp hitpoints go here-->
|
||||
{{#each tempHitPoints}}
|
||||
<paper-slider class="tempHitPointSlider"
|
||||
value={{left}}
|
||||
max={{maximum}}
|
||||
editable pin
|
||||
role="slider"
|
||||
></paper-slider>
|
||||
{{/each}}
|
||||
<div class="caption">
|
||||
{{#if multipliers.immunities.length}} <div>Immune: {{#each multipliers.immunities}} {{name}} {{/each}}</div>{{/if}}
|
||||
{{#if multipliers.resistances.length}}<div>Resistance: {{#each multipliers.resistances}} {{name}} {{/each}}</div>{{/if}}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
Template.healthCard.helpers({
|
||||
tempHitPoints: function(){
|
||||
return TemporaryHitPoints.find({charId: this._id});
|
||||
},
|
||||
showDeathSave: function(){
|
||||
return this.attributeValue("hitPoints") <= 0;
|
||||
},
|
||||
@@ -55,6 +58,15 @@ Template.healthCard.events({
|
||||
var adjustment = value - this.attributeBase("hitPoints");
|
||||
Characters.update(this._id, {$set: {"hitPoints.adjustment": adjustment}});
|
||||
},
|
||||
"change .tempHitPointSlider": function(event){
|
||||
var value = event.currentTarget.value;
|
||||
var used = this.maximum - value;
|
||||
TemporaryHitPoints.update(this._id, {$set: {"used": used}});
|
||||
},
|
||||
"tap #addTempHP": function(event){
|
||||
var max = prompt("Add temporary hitpoints", "10");
|
||||
TemporaryHitPoints.insert({charId: this._id, maximum: max, used: 0});
|
||||
},
|
||||
"tap .failBubble": function(event){
|
||||
if(event.currentTarget.disabled) return;
|
||||
var char = Template.parentData();
|
||||
|
||||
Reference in New Issue
Block a user