Floor character attribute values
This commit is contained in:
@@ -186,7 +186,7 @@ Schemas.Character = new SimpleSchema({
|
|||||||
|
|
||||||
Characters.attachSchema(Schemas.Character);
|
Characters.attachSchema(Schemas.Character);
|
||||||
|
|
||||||
var attributeBase = function(charId, statName){
|
var attributeBase = preventLoop(function(charId, statName){
|
||||||
check(statName, String);
|
check(statName, String);
|
||||||
//if it's a damage multiplier, we treat it specially
|
//if it's a damage multiplier, we treat it specially
|
||||||
if (_.contains(DAMAGE_MULTIPLIERS, statName)){
|
if (_.contains(DAMAGE_MULTIPLIERS, statName)){
|
||||||
@@ -253,8 +253,8 @@ var attributeBase = function(charId, statName){
|
|||||||
if (result < min) result = min;
|
if (result < min) result = min;
|
||||||
if (result > max) result = max;
|
if (result > max) result = max;
|
||||||
|
|
||||||
return result;
|
return Math.floor(result);
|
||||||
};
|
});
|
||||||
|
|
||||||
if (Meteor.isClient) {
|
if (Meteor.isClient) {
|
||||||
Template.registerHelper("characterCalculate", function(func, charId, input) {
|
Template.registerHelper("characterCalculate", function(func, charId, input) {
|
||||||
@@ -324,9 +324,9 @@ Characters.calculate = {
|
|||||||
value += attribute.adjustment;
|
value += attribute.adjustment;
|
||||||
return value;
|
return value;
|
||||||
}),
|
}),
|
||||||
attributeBase: memoize(preventLoop(function(charId, attributeName){
|
attributeBase: memoize(function(charId, attributeName){
|
||||||
return attributeBase(charId, attributeName);
|
return attributeBase(charId, attributeName);
|
||||||
})),
|
}),
|
||||||
skillMod: memoize(preventLoop(function(charId, skillName){
|
skillMod: memoize(preventLoop(function(charId, skillName){
|
||||||
var skill = Characters.calculate.getField(charId, skillName);
|
var skill = Characters.calculate.getField(charId, skillName);
|
||||||
//get the final value of the ability score
|
//get the final value of the ability score
|
||||||
@@ -369,7 +369,7 @@ Characters.calculate = {
|
|||||||
if (result < min) result = min;
|
if (result < min) result = min;
|
||||||
if (result > max) result = max;
|
if (result > max) result = max;
|
||||||
|
|
||||||
return result;
|
return Math.floor(result);
|
||||||
})),
|
})),
|
||||||
proficiency: memoize(function(charId, skillName){
|
proficiency: memoize(function(charId, skillName){
|
||||||
//return largest value in proficiency array
|
//return largest value in proficiency array
|
||||||
@@ -390,7 +390,7 @@ Characters.calculate = {
|
|||||||
});
|
});
|
||||||
var advantage = Characters.calculate.advantage(charId, skillName);
|
var advantage = Characters.calculate.advantage(charId, skillName);
|
||||||
value += 5 * advantage;
|
value += 5 * advantage;
|
||||||
return value;
|
return Math.floor(value);
|
||||||
}),
|
}),
|
||||||
advantage: memoize(function(charId, skillName){
|
advantage: memoize(function(charId, skillName){
|
||||||
var advantage = Effects.find(
|
var advantage = Effects.find(
|
||||||
|
|||||||
Reference in New Issue
Block a user