mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
Add calculation for equipment stat bonus
This commit is contained in:
@@ -7,7 +7,7 @@ var expect = chai.expect;
|
||||
var statCalc = require('../../common/script/methods/statCalculations');
|
||||
|
||||
describe('stat calculation functions', function() {
|
||||
describe('calculateLevelStatBonus', function() {
|
||||
describe('levelBonus', function() {
|
||||
it('calculates bonus as half of level for even numbered level under 100', function() {
|
||||
var level = 50;
|
||||
var bonus = statCalc.levelBonus(level);
|
||||
@@ -32,4 +32,25 @@ describe('stat calculation functions', function() {
|
||||
expect(bonus).to.eql(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('equipmentStatBonus', function() {
|
||||
it('tallies up stats from euqipment that is equipped', function() {
|
||||
var equippedGear = {
|
||||
"weapon" : "weapon_special_1",
|
||||
"shield" : "shield_special_1",
|
||||
"head" : "head_special_1",
|
||||
"armor" : "armor_special_1"
|
||||
};
|
||||
|
||||
var strStat = statCalc.equipmentStatBonus('str', equippedGear);
|
||||
var conStat = statCalc.equipmentStatBonus('con', equippedGear);
|
||||
var intStat = statCalc.equipmentStatBonus('int', equippedGear);
|
||||
var perStat = statCalc.equipmentStatBonus('per', equippedGear);
|
||||
|
||||
expect(strStat).to.eql(24);
|
||||
expect(conStat).to.eql(24);
|
||||
expect(intStat).to.eql(24);
|
||||
expect(perStat).to.eql(24);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user