improves rounding for boss hp and player pending damage - partial fix for #8368 (#9749)

* improves rounding for boss hp and player pending damage

* use floor filter function for user's pending damage for party page and tavern boss
This commit is contained in:
Alys
2018-03-31 20:57:37 +10:00
committed by Matteo Pagliazzi
parent bd07f3cd38
commit 338781f57b
4 changed files with 11 additions and 7 deletions

View File

@@ -55,10 +55,12 @@ div
.row.boss-details
.col-6
span.float-left
| {{parseFloat(group.quest.progress.hp).toFixed(2)}} / {{parseFloat(questData.boss.hp).toFixed(2)}}
| {{ Math.ceil(parseFloat(group.quest.progress.hp) * 100) / 100 }} / {{ parseFloat(questData.boss.hp).toFixed(2) }}
// current boss hp uses ceil so you don't underestimate damage needed to end quest
.col-6(v-if='userIsOnQuest')
// @TODO: Why do we not sync quset progress on the group doc? Each user could have different progress
span.float-right {{parseFloat(user.party.quest.progress.up).toFixed(1) || 0}} pending damage
// @TODO: Why do we not sync quest progress on the group doc? Each user could have different progress.
span.float-right {{ user.party.quest.progress.up | floor(10) }} {{ $t('pendingDamageLabel') }}
// player's pending damage uses floor so you don't overestimate damage you've already done
.row.rage-bar-row(v-if='questData.boss.rage')
.col-12
.grey-progress-bar

View File

@@ -765,7 +765,8 @@ export default {
},
pendingDamage () {
if (!this.user.party.quest.progress.up) return 0;
return parseFloat(this.user.party.quest.progress.up).toFixed(1);
return this.$options.filters.floor(this.user.party.quest.progress.up, 10);
// keep user's pending damage consistent with how it's displayed on the party page
},
bossCurrentHealth () {
if (!this.group.quest.progress.hp) return 0;

View File

@@ -1,3 +1,3 @@
export default function floor (val) {
return Math.floor(val * 100) / 100;
}
export default function floor (val, power = 100) {
return Math.floor(val * power) / power;
}

View File

@@ -123,6 +123,7 @@
"buyQuestBundle": "Buy Quest Bundle",
"noQuestToStart": "Cant find a quest to start? Try checking out the Quest Shop in the Market for new releases!",
"pendingDamage": "<%= damage %> pending damage",
"pendingDamageLabel": "pending damage",
"bossHealth": "<%= currentHealth %> / <%= maxHealth %> Health",
"rageAttack": "Rage Attack:",
"bossRage": "<%= currentRage %> / <%= maxRage %> Rage",