mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-26 22:13:32 -04:00
Fixed some i18n on the PlayHeroesModal, and started showing special hero skills.
This commit is contained in:
parent
7bbc270f26
commit
b7c2a33ddc
5 changed files with 18 additions and 10 deletions
app
locale
models
templates/play/modal
views
|
@ -314,7 +314,7 @@
|
|||
restricted: "(restricted in this level)"
|
||||
equip: "Equip"
|
||||
unequip: "Unequip"
|
||||
|
||||
|
||||
buy_gems:
|
||||
few_gems: 'A few gems'
|
||||
pile_gems: 'Pile of gems'
|
||||
|
@ -324,6 +324,8 @@
|
|||
choose_hero: "Choose Your Hero"
|
||||
programming_language: "Programming Language"
|
||||
programming_language_description: "Which programming language do you want to use?"
|
||||
default: "Default"
|
||||
experimental: "Experimental"
|
||||
python_blurb: "Simple yet powerful, great for beginners and experts."
|
||||
javascript_blurb: "The language of the web. (Not the same as Java.)"
|
||||
coffeescript_blurb: "Nicer JavaScript syntax."
|
||||
|
|
|
@ -260,7 +260,7 @@ module.exports = class ThangType extends CocoModel
|
|||
createjs.Ticker.removeEventListener 'tick', @tick
|
||||
@tick = null
|
||||
stage
|
||||
|
||||
|
||||
getVectorPortraitStage: (size=100) ->
|
||||
return unless @actions
|
||||
canvas = $("<canvas width='#{size}' height='#{size}'></canvas>")
|
||||
|
@ -336,10 +336,12 @@ module.exports = class ThangType extends CocoModel
|
|||
return console.warn @get('name'), 'is not an equipping hero, but you are asking for its hero stats. (Did you project away components?)'
|
||||
unless movesConfig = _.find(components, original: LevelComponent.MovesID)?.config
|
||||
return console.warn @get('name'), 'is not a moving hero, but you are asking for its hero stats.'
|
||||
unless programmableConfig = _.find(components, original: LevelComponent.ProgrammableID)?.config
|
||||
return console.warn @get('name'), 'is not a Programmable hero, but you are asking for its hero stats.'
|
||||
@classStatAverages ?=
|
||||
attack: {Warrior: 7.5, Ranger: 5, Wizard: 2.5}
|
||||
health: {Warrior: 7.5, Ranger: 5, Wizard: 3.5}
|
||||
stats = {skills: []} # TODO: find skills
|
||||
stats = {}
|
||||
rawNumbers = attack: equipsConfig.attackDamageFactor ? 1, health: equipsConfig.maxHealthFactor ? 1, speed: movesConfig.maxSpeed
|
||||
for prop in ['attack', 'health']
|
||||
stat = rawNumbers[prop]
|
||||
|
@ -349,11 +351,15 @@ module.exports = class ThangType extends CocoModel
|
|||
classSpecificScore = stat * 5
|
||||
classAverage = @classStatAverages[prop][@get('heroClass')]
|
||||
stats[prop] = Math.round(2 * ((classAverage - 2.5) + classSpecificScore / 2)) / 2 / 10
|
||||
|
||||
minSpeed = 4
|
||||
maxSpeed = 16
|
||||
speedRange = maxSpeed - minSpeed
|
||||
speedPoints = rawNumbers.speed - minSpeed
|
||||
stats.speed = Math.round(20 * speedPoints / speedRange) / 2 / 10
|
||||
|
||||
stats.skills = (_.string.titleize(_.string.humanize(skill)) for skill in programmableConfig.programmableProperties when skill isnt 'say')
|
||||
|
||||
stats
|
||||
|
||||
getFrontFacingStats: ->
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
.carousel-indicator-container
|
||||
ol.carousel-indicators
|
||||
for hero, index in heroes
|
||||
li(data-hero-id=hero.get('original'), title=hero.get('name'), data-slide-to=index, data-target="#hero-carousel", class="hero-indicator hero-index-" + index + (hero.locked ? " locked" : ""))
|
||||
li(data-hero-id=hero.get('original'), title=hero.name, data-slide-to=index, data-target="#hero-carousel", class="hero-indicator hero-index-" + index + (hero.locked ? " locked" : ""))
|
||||
.hero-avatar
|
||||
if hero.locked
|
||||
img.lock-indicator(src="/images/pages/game-menu/lock.png")
|
||||
|
|
|
@ -83,7 +83,7 @@ module.exports = class InventoryModal extends ModalView
|
|||
|
||||
# sort into one of the four groups
|
||||
locked = not (item.get('original') in me.items())
|
||||
locked = false if me.get('slug') is 'nick'
|
||||
#locked = false if me.get('slug') is 'nick'
|
||||
|
||||
if locked and item.get('slug') isnt 'simple-boots'
|
||||
@itemGroups.lockedItems.add(item)
|
||||
|
|
|
@ -28,7 +28,7 @@ module.exports = class PlayHeroesModal extends ModalView
|
|||
@confirmButtonI18N = options.confirmButtonI18N ? "common.save"
|
||||
@heroes = new CocoCollection([], {model: ThangType})
|
||||
@heroes.url = '/db/thang.type?view=heroes'
|
||||
@heroes.setProjection ['original','name','slug','soundTriggers','featureImage','gems','heroClass','description','components','extendedName']
|
||||
@heroes.setProjection ['original','name','slug','soundTriggers','featureImage','gems','heroClass','description','components','extendedName','i18n']
|
||||
@heroes.comparator = 'gems'
|
||||
@listenToOnce @heroes, 'sync', @onHeroesLoaded
|
||||
@supermodel.loadCollection(@heroes, 'heroes')
|
||||
|
@ -75,7 +75,7 @@ module.exports = class PlayHeroesModal extends ModalView
|
|||
|
||||
initCodeLanguageList: (hadEverChosenHero) ->
|
||||
@codeLanguageList = [
|
||||
{id: 'python', name: 'Python (Default)'}
|
||||
{id: 'python', name: "Python (#{$.i18n.t('choose_hero.default')})"}
|
||||
{id: 'javascript', name: 'JavaScript'}
|
||||
{id: 'coffeescript', name: 'CoffeeScript'}
|
||||
]
|
||||
|
@ -86,9 +86,9 @@ module.exports = class PlayHeroesModal extends ModalView
|
|||
# Group 1 isn't shown experimental languages in hero modal when launching beginner campaign level
|
||||
testGroup = me.getExperimentalLangGroup()
|
||||
if hadEverChosenHero? or testGroup isnt 1
|
||||
@codeLanguageList.push id: 'clojure', name: 'Clojure (Experimental)'
|
||||
@codeLanguageList.push id: 'lua', name: 'Lua (Experimental)'
|
||||
@codeLanguageList.push id: 'io', name: 'Io (Experimental)'
|
||||
@codeLanguageList.push id: 'clojure', name: "Clojure (#{$.i18n.t('choose_hero.experimental')})"
|
||||
@codeLanguageList.push id: 'lua', name: "Lua (#{$.i18n.t('choose_hero.experimental')})"
|
||||
@codeLanguageList.push id: 'io', name: "Io (#{$.i18n.t('choose_hero.experimental')})"
|
||||
unless hadEverChosenHero? or testGroup is -1
|
||||
window.tracker?.trackEvent 'Heroes Modal', experimentalLangGroup: testGroup
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue