Added UI for weakness/resistance
This commit is contained in:
@@ -61,19 +61,19 @@ Schemas.Character = new SimpleSchema({
|
||||
d12HitDice: {type: Schemas.Attribute},
|
||||
|
||||
//vulnerabilities
|
||||
acidMultiplier: {type: Schemas.Vulnerability},
|
||||
bludgeoningMultiplier: {type: Schemas.Vulnerability},
|
||||
coldMultiplier: {type: Schemas.Vulnerability},
|
||||
fireMultiplier: {type: Schemas.Vulnerability},
|
||||
forceMultiplier: {type: Schemas.Vulnerability},
|
||||
lightningMultiplier: {type: Schemas.Vulnerability},
|
||||
necroticMultiplier: {type: Schemas.Vulnerability},
|
||||
piercingMultiplier: {type: Schemas.Vulnerability},
|
||||
poisonMultiplier: {type: Schemas.Vulnerability},
|
||||
psychicMultiplier: {type: Schemas.Vulnerability},
|
||||
radiantMultiplier: {type: Schemas.Vulnerability},
|
||||
slashingMultiplier: {type: Schemas.Vulnerability},
|
||||
thunderMultiplier: {type: Schemas.Vulnerability},
|
||||
acidMultiplier: {type: Schemas.Attribute},
|
||||
bludgeoningMultiplier: {type: Schemas.Attribute},
|
||||
coldMultiplier: {type: Schemas.Attribute},
|
||||
fireMultiplier: {type: Schemas.Attribute},
|
||||
forceMultiplier: {type: Schemas.Attribute},
|
||||
lightningMultiplier: {type: Schemas.Attribute},
|
||||
necroticMultiplier: {type: Schemas.Attribute},
|
||||
piercingMultiplier: {type: Schemas.Attribute},
|
||||
poisonMultiplier: {type: Schemas.Attribute},
|
||||
psychicMultiplier: {type: Schemas.Attribute},
|
||||
radiantMultiplier: {type: Schemas.Attribute},
|
||||
slashingMultiplier: {type: Schemas.Attribute},
|
||||
thunderMultiplier: {type: Schemas.Attribute},
|
||||
|
||||
|
||||
//skills
|
||||
@@ -178,7 +178,7 @@ var attributeBase = function(charId, statName){
|
||||
check(statName, String);
|
||||
var effects = Effects.find({charId: charId, stat: statName, enabled: true}).fetch();
|
||||
effects = _.groupBy(effects, "operation");
|
||||
var value = 0;
|
||||
var value = _.contains(DAMAGE_MULTIPLIERS, statName)? 1 : 0;
|
||||
|
||||
//start with the highest base value
|
||||
_.each(effects.base, function(effect){
|
||||
|
||||
@@ -11,17 +11,3 @@ Schemas.Attribute = new SimpleSchema({
|
||||
allowedValues: ["longRest", "shortRest"]
|
||||
}
|
||||
});
|
||||
|
||||
//note that to make an invulnerability add a new max of zero value
|
||||
Schemas.Vulnerability = new SimpleSchema({
|
||||
//same as attribute
|
||||
adjustment: {
|
||||
type: Number,
|
||||
defaultValue: 0
|
||||
},
|
||||
reset: {
|
||||
type: String,
|
||||
defaultValue: "longRest",
|
||||
allowedValues: ["longRest", "shortRest"]
|
||||
}
|
||||
});
|
||||
|
||||
@@ -175,7 +175,7 @@ Template.effectEdit.events({
|
||||
if(!detail.isSelected) return;
|
||||
var value = +detail.item.getAttribute("name");
|
||||
if (value == this.value) return;
|
||||
Effects.update(this._id, {$set: {value: value, calculation: ""}});
|
||||
Effects.update(this._id, {$set: {value: value, calculation: "", operation: "mul"}});
|
||||
},
|
||||
"core-select #proficiencyDropDown": function(event){
|
||||
var detail = event.originalEvent.detail;
|
||||
|
||||
@@ -10,6 +10,12 @@
|
||||
editable pin
|
||||
role="slider"
|
||||
></paper-slider>
|
||||
<!--Temp hitpoints go here-->
|
||||
<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}}
|
||||
{{#if multipliers.weaknesses.length}} <div>Weakness: {{#each multipliers.weaknesses}} {{name}} {{/each}}</div>{{/if}}
|
||||
</div>
|
||||
{{#if showDeathSave}}
|
||||
{{#with deathSaveObject}}
|
||||
<div class="padded" layout vertical center>
|
||||
|
||||
@@ -20,8 +20,32 @@ Template.healthCard.helpers({
|
||||
passDisabled: function(num){
|
||||
return !(num === this.pass || num - 1 === this.pass)
|
||||
},
|
||||
dead: function(char){
|
||||
dead: function(){
|
||||
return this.fail >= 3;
|
||||
},
|
||||
multipliers: function(){
|
||||
var char = Characters.findOne(this._id, {fields: {_id: 1} });
|
||||
var multipliers = [
|
||||
{name: "Acid", value: char.attributeValue("acidMultiplier", 1)},
|
||||
{name: "Bludgeoning", value: char.attributeValue("bludgeoningMultiplier", 1)},
|
||||
{name: "Cold", value: char.attributeValue("coldMultiplier", 1)},
|
||||
{name: "Fire", value: char.attributeValue("fireMultiplier", 1)},
|
||||
{name: "Force", value: char.attributeValue("forceMultiplier", 1)},
|
||||
{name: "Lightning", value: char.attributeValue("lightningMultiplier", 1)},
|
||||
{name: "Necrotic", value: char.attributeValue("necroticMultiplier", 1)},
|
||||
{name: "Piercing", value: char.attributeValue("piercingMultiplier", 1)},
|
||||
{name: "Poison", value: char.attributeValue("poisonMultiplier", 1)},
|
||||
{name: "Psychic", value: char.attributeValue("psychicMultiplier", 1)},
|
||||
{name: "Radiant", value: char.attributeValue("radiantMultiplier", 1)},
|
||||
{name: "Slashing", value: char.attributeValue("slashingMultiplier", 1)},
|
||||
{name: "Thunder", value: char.attributeValue("thunderMultiplier", 1)}
|
||||
];
|
||||
multipliers = _.groupBy(multipliers, "value");
|
||||
return {
|
||||
"immunities": multipliers["0"] || [],
|
||||
"resistances": multipliers["0.5"] || [],
|
||||
"weaknesses": multipliers["2"] || []
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
31
rpg-docs/lib/constants/damageTypes.js
Normal file
31
rpg-docs/lib/constants/damageTypes.js
Normal file
@@ -0,0 +1,31 @@
|
||||
DAMAGE_TYPES = {
|
||||
"acid": {name: "Acid"},
|
||||
"bludgeoning": {name: "Bludgeoning"},
|
||||
"cold": {name: "Cold"},
|
||||
"fire": {name: "Fire"},
|
||||
"force": {name: "Force"},
|
||||
"lightning": {name: "Lightning"},
|
||||
"necrotic": {name: "Necrotic"},
|
||||
"piercing": {name: "Piercing"},
|
||||
"poison": {name: "Poison"},
|
||||
"psychic": {name: "Psychic"},
|
||||
"radiant": {name: "Radiant"},
|
||||
"slashing": {name: "Slashing"},
|
||||
"thunder": {name: "Thunder"}
|
||||
};
|
||||
|
||||
DAMAGE_MULTIPLIERS = [
|
||||
"acidMultiplier",
|
||||
"bludgeoningMultiplier",
|
||||
"coldMultiplier",
|
||||
"fireMultiplier",
|
||||
"forceMultiplier",
|
||||
"lightningMultiplier",
|
||||
"necroticMultiplier",
|
||||
"piercingMultiplier",
|
||||
"poisonMultiplier",
|
||||
"psychicMultiplier",
|
||||
"radiantMultiplier",
|
||||
"slashingMultiplier",
|
||||
"thunderMultiplier"
|
||||
];
|
||||
Reference in New Issue
Block a user