Added attack/health/speed tooltip explanations on hero picker stat comparison bars.

This commit is contained in:
Nick Winter 2015-02-26 08:02:22 -08:00
parent 0339d9077a
commit 7d2c99acd7
3 changed files with 21 additions and 4 deletions
app
locale
models
templates/play/modal

View file

@ -455,6 +455,14 @@
blocks: "Blocks" # As in "this shield blocks this much damage"
backstab: "Backstab" # As in "this dagger does this much backstab damage"
skills: "Skills"
attack_1: "Deals"
attack_2: "of listed"
attack_3: "weapon damage."
health_1: "Gains"
health_2: "of listed"
health_3: "armor health."
speed_1: "Moves at"
speed_2: "meters per second."
available_for_purchase: "Available for Purchase" # Shows up when you have unlocked, but not purchased, a hero in the hero store
level_to_unlock: "Level to unlock:" # Label for which level you have to beat to unlock a particular hero (click a locked hero in the store to see)
restricted_to_certain_heroes: "Only certain heroes can play this level."

View file

@ -356,13 +356,22 @@ module.exports = class ThangType extends CocoModel
else
classSpecificScore = stat * 5
classAverage = @classStatAverages[prop][@get('heroClass')]
stats[prop] = Math.round(2 * ((classAverage - 2.5) + classSpecificScore / 2)) / 2 / 10
stats[prop] =
relative: Math.round(2 * ((classAverage - 2.5) + classSpecificScore / 2)) / 2 / 10
absolute: stat
pieces = ($.i18n.t "choose_hero.#{prop}_#{num}" for num in [1 .. 3])
percent = Math.round(stat * 100) + '%'
className = $.i18n.t "general.#{_.string.slugify @get('heroClass')}"
stats[prop].description = [pieces[0], percent, pieces[1], className, pieces[2]].join ' '
minSpeed = 4
maxSpeed = 16
speedRange = maxSpeed - minSpeed
speedPoints = rawNumbers.speed - minSpeed
stats.speed = Math.round(20 * speedPoints / speedRange) / 2 / 10
stats.speed =
relative: Math.round(20 * speedPoints / speedRange) / 2 / 10
absolute: rawNumbers.speed
description: "#{$.i18n.t 'choose_hero.speed_1'} #{rawNumbers.speed} #{$.i18n.t 'choose_hero.speed_2'}"
stats.skills = (_.string.titleize(_.string.humanize(skill)) for skill in programmableConfig.programmableProperties when skill isnt 'say')

View file

@ -52,11 +52,11 @@
.stat-label(data-i18n='choose_hero.skills')
.stat-value= hero.stats.skills.join(', ')
for stat in ['attack', 'health', 'speed']
.hero-stat-row(class=stat)
.hero-stat-row(class=stat, title=hero.stats[stat].description)
.stat-label(data-i18n='choose_hero.'+stat)
.stat-value
.stat-progress
.stat-progress-bar(style="width: " + (parseInt(hero.stats[stat]*100)) + "%")
.stat-progress-bar(style="width: " + (parseInt(hero.stats[stat].relative * 100)) + "%")
a.left(role="button", data-slide="prev", href="#hero-carousel")
span.glyphicon.glyphicon-play