BattleSim/client/views/battle_actions.jade

64 lines
2.3 KiB
Plaintext
Raw Normal View History

2016-02-01 22:19:30 +00:00
mixin moveButton(forPokemon, i)
- var moveName = forPokemon.get('moves')[i]
- var origName = moveName
- var moveType = forPokemon.get('moveTypes')[i].toLowerCase()
- var pp = forPokemon.get('pp')[i]
- var maxPP = forPokemon.get('maxPP')[i]
- var isEnabled = validMoves.indexOf(moveName) !== -1
- var disabledClass = (!isEnabled ? ' disabled' : '')
- var bigClass = (validMoves.length === 1 ? ' big' : '')
- var spanClass = (validMoves.length === 1 ? 'span12' : 'span6')
if moveName === 'Hidden Power'
- moveType = window.HiddenPower.BW.type(forPokemon.get('ivs'))
- moveName += ' (' + moveType + ')'
- moveType = moveType.toLowerCase()
- var moveClass = moveType + disabledClass + bigClass
div(class = spanClass)
.move.button(class = moveClass, data-move-id = origName)
.main_text= moveName
.meta_info
= pp
small /#{maxPP}
- var validMoves = validActions.moves || []
- var validSwitches = validActions.switches || []
.moves.span8
h2 Moves
- var pokemon = yourTeam.at(0)
- var numMoves = pokemon.get('moves').length
if validMoves.length === 1
//- Display any moves not part of the Pokemon's moveset specially. This
//- includes no PP and automatically considered normal-type, e.g. Struggle.
- var moveIndex = pokemon.get('moves').indexOf(validMoves[0])
.row-fluid
if moveIndex === -1
.span12
.move.button.normal.big(data-move-id = validMoves[0])
.main_text= validMoves[0]
else
+moveButton(pokemon, moveIndex)
else
- for (var i = 0; i < numMoves; i += 2)
.row-fluid
+moveButton(pokemon, i)
if i + 1 < numMoves
+moveButton(pokemon, i + 1)
.mega-evolve.button.hidden Mega Evolve
.switches.span4
h2 Pokemon
- var teamPokemon = yourTeam.get('pokemon')
- for (var j = 0, len = teamPokemon.length; j < len; j += 3)
.row-fluid
- for (var i = j; i < j + 3; i++)
- var pokemon = teamPokemon.at(i)
- var isEnabled = validSwitches.indexOf(i) !== -1
- var disabledClass = (!isEnabled ? 'disabled' : '')
if pokemon
.span4
.switch.button(class = disabledClass, data-slot = i)
.pokemon_icon(style = window.PokemonIconBackground(pokemon))
.show_spinner.flex-center.fill.bg-faded-white.hidden
!= window.JST['spinner']()