mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-17 01:12:18 +00:00
Add gold display function
This commit is contained in:
parent
2eb62de056
commit
f1453d30c4
2 changed files with 22 additions and 0 deletions
|
|
@ -50,6 +50,22 @@ describe('Stats Service', function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe('goldDisplay', function() {
|
||||
it('displays gold', function() {
|
||||
var gold = 30;
|
||||
var goldDisplay = statCalc.goldDisplay(gold);
|
||||
|
||||
expect(goldDisplay).to.eql(30);
|
||||
});
|
||||
|
||||
it('Rounds gold down when given a decimal', function() {
|
||||
var gold = 30.999;
|
||||
var goldDisplay = statCalc.goldDisplay(gold);
|
||||
|
||||
expect(goldDisplay).to.eql(30);
|
||||
});
|
||||
});
|
||||
|
||||
describe('levelBonus', function() {
|
||||
it('calculates bonus as half of level for even numbered level under 100', function() {
|
||||
var level = 50;
|
||||
|
|
|
|||
|
|
@ -20,6 +20,11 @@
|
|||
return display;
|
||||
}
|
||||
|
||||
function goldDisplay(gold) {
|
||||
var display = Math.floor(gold);
|
||||
return display;
|
||||
}
|
||||
|
||||
function mpDisplay(user) {
|
||||
var remainingMP = Math.floor(user.stats.mp);
|
||||
var totalMP = user._statsComputed.maxMP;
|
||||
|
|
@ -75,6 +80,7 @@
|
|||
return {
|
||||
classBonus: classBonus,
|
||||
equipmentStatBonus: equipmentStatBonus,
|
||||
goldDisplay: goldDisplay,
|
||||
hpDisplay: hpDisplay,
|
||||
levelBonus: levelBonus,
|
||||
mpDisplay: mpDisplay
|
||||
|
|
|
|||
Loading…
Reference in a new issue