Added Smogon tiering system, made team invisible clause, sorted all pokemon
This commit is contained in:
parent
d7316d5799
commit
398d23a0d6
|
@ -119,6 +119,9 @@ a, .fake_link
|
||||||
.team-pbv
|
.team-pbv
|
||||||
font-size 0.75em
|
font-size 0.75em
|
||||||
|
|
||||||
|
.team-tier
|
||||||
|
font-size 0.75em
|
||||||
|
|
||||||
// Typography
|
// Typography
|
||||||
|
|
||||||
.monospace
|
.monospace
|
||||||
|
|
|
@ -33,7 +33,7 @@ $pokemon-list-height = 50px
|
||||||
top $header
|
top $header
|
||||||
bottom 0
|
bottom 0
|
||||||
background-color $body-color
|
background-color $body-color
|
||||||
width: 150px
|
width: 160px
|
||||||
|
|
||||||
ul
|
ul
|
||||||
list-style-type none
|
list-style-type none
|
||||||
|
@ -365,6 +365,9 @@ $pokemon-list-height = 50px
|
||||||
.team-pbv
|
.team-pbv
|
||||||
margin-top -5px
|
margin-top -5px
|
||||||
|
|
||||||
|
.team-tier
|
||||||
|
margin-top -5px
|
||||||
|
|
||||||
textarea.textarea_modal
|
textarea.textarea_modal
|
||||||
box-sizing border-box
|
box-sizing border-box
|
||||||
width 100%
|
width 100%
|
||||||
|
|
|
@ -19,7 +19,8 @@ class @Battle extends Backbone.AssociatedModel
|
||||||
@updateQueue = []
|
@updateQueue = []
|
||||||
{@numActive, spectators} = attributes
|
{@numActive, spectators} = attributes
|
||||||
@spectators = new UserList(spectators) unless !spectators
|
@spectators = new UserList(spectators) unless !spectators
|
||||||
@set('generation', Formats[@get('format')].generation)
|
allformats = window.PokeBattle.conditions.Formats()
|
||||||
|
@set('generation', allformats[@get('format')].generation)
|
||||||
@set('notifications', 0)
|
@set('notifications', 0)
|
||||||
@set('turn', 0)
|
@set('turn', 0)
|
||||||
@set('teams', [{hidden: true}, {hidden: true}])
|
@set('teams', [{hidden: true}, {hidden: true}])
|
||||||
|
|
|
@ -135,7 +135,6 @@ class @Pokemon extends Backbone.Model
|
||||||
|
|
||||||
# Map each move name to a move object
|
# Map each move name to a move object
|
||||||
return _(learnset).map (moveName) ->
|
return _(learnset).map (moveName) ->
|
||||||
console.log(moveName)
|
|
||||||
move = _(MoveData[moveName]).clone()
|
move = _(MoveData[moveName]).clone()
|
||||||
move['name'] = moveName
|
move['name'] = moveName
|
||||||
move
|
move
|
||||||
|
@ -213,6 +212,10 @@ class @Pokemon extends Backbone.Model
|
||||||
gen = @getGeneration()
|
gen = @getGeneration()
|
||||||
PokeBattle.PBV.determinePBV(gen, @attributes)
|
PokeBattle.PBV.determinePBV(gen, @attributes)
|
||||||
|
|
||||||
|
getTier: ->
|
||||||
|
gen = @getGeneration()
|
||||||
|
PokeBattle.Tier.determineTier(gen, @attributes)
|
||||||
|
|
||||||
setPP: (moveIndex, newPP) ->
|
setPP: (moveIndex, newPP) ->
|
||||||
array = _.clone(@get('pp'))
|
array = _.clone(@get('pp'))
|
||||||
array[moveIndex] = newPP
|
array[moveIndex] = newPP
|
||||||
|
|
|
@ -66,8 +66,9 @@ class @Team extends Backbone.AssociatedModel
|
||||||
|
|
||||||
getFormat: =>
|
getFormat: =>
|
||||||
format = @get('generation') # TODO: Migrate to format
|
format = @get('generation') # TODO: Migrate to format
|
||||||
format = DEFAULT_FORMAT if format not of Formats
|
allformats = window.PokeBattle.conditions.Formats()
|
||||||
Formats[format]
|
format = DEFAULT_FORMAT if format not of allformats
|
||||||
|
allformats[format]
|
||||||
|
|
||||||
getGeneration: (generation) ->
|
getGeneration: (generation) ->
|
||||||
gen = generation || @getFormat().generation
|
gen = generation || @getFormat().generation
|
||||||
|
@ -79,6 +80,11 @@ class @Team extends Backbone.AssociatedModel
|
||||||
pokemon = @get('pokemon').toJSON()
|
pokemon = @get('pokemon').toJSON()
|
||||||
PokeBattle.PBV.determinePBV(gen, pokemon)
|
PokeBattle.PBV.determinePBV(gen, pokemon)
|
||||||
|
|
||||||
|
getTier: =>
|
||||||
|
gen = @getGeneration()
|
||||||
|
pokemon = @get('pokemon').toJSON()
|
||||||
|
PokeBattle.Tier.determineTier(gen, pokemon)
|
||||||
|
|
||||||
getMaxPBV: =>
|
getMaxPBV: =>
|
||||||
{conditions} = @getFormat()
|
{conditions} = @getFormat()
|
||||||
if Conditions.PBV_1000 in conditions
|
if Conditions.PBV_1000 in conditions
|
||||||
|
@ -91,6 +97,23 @@ class @Team extends Backbone.AssociatedModel
|
||||||
hasPBV: =>
|
hasPBV: =>
|
||||||
@getMaxPBV() > 0
|
@getMaxPBV() > 0
|
||||||
|
|
||||||
|
hasTier: =>
|
||||||
|
typeof @getMaxTier() != 'undefined'
|
||||||
|
|
||||||
|
getMaxTierName: =>
|
||||||
|
{conditions} = @getFormat()
|
||||||
|
for condition in conditions
|
||||||
|
tiername = _.invert(Conditions)[condition]
|
||||||
|
if (tiername.search /TIER_/) == 0
|
||||||
|
tier = tiername.replace /TIER_/, ""
|
||||||
|
tier
|
||||||
|
|
||||||
|
getMaxTier: =>
|
||||||
|
tiername = @getMaxTierName()
|
||||||
|
if tiername
|
||||||
|
tier = PokeBattle.Tier.Tiers[tiername]
|
||||||
|
tier
|
||||||
|
|
||||||
getNonNullPokemon: =>
|
getNonNullPokemon: =>
|
||||||
@get('pokemon').where(isNull: false)
|
@get('pokemon').where(isNull: false)
|
||||||
|
|
||||||
|
|
|
@ -185,6 +185,9 @@ class @BattleView extends Backbone.View
|
||||||
$this.popover(options)
|
$this.popover(options)
|
||||||
|
|
||||||
pokemonPopover: ($this, pokemon) =>
|
pokemonPopover: ($this, pokemon) =>
|
||||||
|
if @isIllusioned(pokemon)
|
||||||
|
pokemon = pokemon.getTeam().attributes.pokemon.at(pokemon.getTeam().attributes.pokemon.length - 1)
|
||||||
|
|
||||||
displayName = pokemon.get('species')
|
displayName = pokemon.get('species')
|
||||||
displayName += " @ #{pokemon.get('item')}" if pokemon.has('item')
|
displayName += " @ #{pokemon.get('item')}" if pokemon.has('item')
|
||||||
displayName += "<br>"
|
displayName += "<br>"
|
||||||
|
|
|
@ -56,13 +56,13 @@ class @PokemonEditView extends Backbone.View
|
||||||
@onPokemonChange = attributes.onPokemonChange
|
@onPokemonChange = attributes.onPokemonChange
|
||||||
|
|
||||||
setFormat: (format) =>
|
setFormat: (format) =>
|
||||||
format = Formats[format] || Formats[DEFAULT_FORMAT]
|
allformats = window.PokeBattle.conditions.Formats()
|
||||||
|
format = allformats[format] || allformats[DEFAULT_FORMAT]
|
||||||
@setGeneration(format.generation)
|
@setGeneration(format.generation)
|
||||||
# TODO: Set PBV limit based on conditions
|
# TODO: Set PBV limit based on conditions
|
||||||
|
|
||||||
changeSort:(e) =>
|
changeSort:(e) =>
|
||||||
sort = $(e.currentTarget).val()
|
sort = $(e.currentTarget).val()
|
||||||
console.log(sort)
|
|
||||||
if sort =="Default Sort"
|
if sort =="Default Sort"
|
||||||
@sortSpecieslist("Default")
|
@sortSpecieslist("Default")
|
||||||
else if sort == "Sort by Dexnumber"
|
else if sort == "Sort by Dexnumber"
|
||||||
|
@ -74,10 +74,11 @@ class @PokemonEditView extends Backbone.View
|
||||||
else if sort == "Invert Alphabetically"
|
else if sort == "Invert Alphabetically"
|
||||||
@sortSpecieslist("pokename", true)
|
@sortSpecieslist("pokename", true)
|
||||||
|
|
||||||
|
|
||||||
sortSpecieslist: (option, reverse) =>
|
sortSpecieslist: (option, reverse) =>
|
||||||
{MoveData, SpeciesData, ItemData} = @generation
|
{MoveData, SpeciesData, ItemData} = @generation
|
||||||
if option == "Default"
|
if option == "Default"
|
||||||
sortedlist = @getSpecies
|
sortedlist = @getSpecies()
|
||||||
else
|
else
|
||||||
sortedlist = @sortObject(SpeciesData, option, reverse)
|
sortedlist = @sortObject(SpeciesData, option, reverse)
|
||||||
@speciesList = (species for species, data of sortedlist)
|
@speciesList = (species for species, data of sortedlist)
|
||||||
|
@ -123,6 +124,9 @@ class @PokemonEditView extends Backbone.View
|
||||||
setTeamPBV: (pbv) =>
|
setTeamPBV: (pbv) =>
|
||||||
@teamPBV = pbv
|
@teamPBV = pbv
|
||||||
|
|
||||||
|
setTeamTier: (tier) =>
|
||||||
|
@teamTier = tier
|
||||||
|
|
||||||
changeSpecies: (e) =>
|
changeSpecies: (e) =>
|
||||||
return if not @onPokemonChange
|
return if not @onPokemonChange
|
||||||
species = $(e.currentTarget).val()
|
species = $(e.currentTarget).val()
|
||||||
|
@ -363,8 +367,13 @@ class @PokemonEditView extends Backbone.View
|
||||||
attachSelectize(@$el.find(".species_list"),
|
attachSelectize(@$el.find(".species_list"),
|
||||||
render:
|
render:
|
||||||
option: (item, escape) =>
|
option: (item, escape) =>
|
||||||
|
team = @pokemon.getTeam()
|
||||||
|
if team.hasPBV()
|
||||||
pbv = PokeBattle.PBV.determinePBV(@generation, species: item.value)
|
pbv = PokeBattle.PBV.determinePBV(@generation, species: item.value)
|
||||||
return "<div class='clearfix'>#{item.text}<div class='pbv'>#{pbv}</div></div>"
|
return "<div class='clearfix'>#{item.text}<div class='pbv'>#{pbv}</div></div>"
|
||||||
|
else if team.hasTier()
|
||||||
|
tier = PokeBattle.Tier.determineTier(@generation, species: item.value)
|
||||||
|
return "<div class='clearfix'>#{item.text}<div class='tier'>#{tier.humanName}</div></div>"
|
||||||
)
|
)
|
||||||
attachSelectize(@$el.find(".selected_item"))
|
attachSelectize(@$el.find(".selected_item"))
|
||||||
return this
|
return this
|
||||||
|
@ -374,7 +383,7 @@ class @PokemonEditView extends Backbone.View
|
||||||
@renderNonStats()
|
@renderNonStats()
|
||||||
@renderStats()
|
@renderStats()
|
||||||
@renderMoves()
|
@renderMoves()
|
||||||
@renderPBV()
|
@renderFormat()
|
||||||
|
|
||||||
# Disable entering values if this is a NullPokemon
|
# Disable entering values if this is a NullPokemon
|
||||||
$elements = @$el.find("input, select").not(".species input, .species select")
|
$elements = @$el.find("input, select").not(".species input, .species select")
|
||||||
|
@ -385,14 +394,33 @@ class @PokemonEditView extends Backbone.View
|
||||||
|
|
||||||
renderPBV: =>
|
renderPBV: =>
|
||||||
individualPBV = @pokemon.getPBV()
|
individualPBV = @pokemon.getPBV()
|
||||||
@$(".individual-pbv").text(individualPBV)
|
@$(".individual-format").text(individualPBV)
|
||||||
|
|
||||||
team = @pokemon.getTeam()
|
team = @pokemon.getTeam()
|
||||||
if team && team.hasPBV()
|
|
||||||
pbv = team.getPBV()
|
pbv = team.getPBV()
|
||||||
maxPBV = team.getMaxPBV()
|
maxPBV = team.getMaxPBV()
|
||||||
@$(".total-pbv").text(pbv).toggleClass("red", pbv > maxPBV)
|
@$(".total-format").text(pbv).toggleClass("red", pbv > maxPBV)
|
||||||
@$(".max-pbv").text(maxPBV)
|
@$(".max-format").text(maxPBV)
|
||||||
|
|
||||||
|
renderTier: =>
|
||||||
|
individualTier = @pokemon.getTier()
|
||||||
|
@$('.individual-format').text(individualTier.humanName)
|
||||||
|
|
||||||
|
team = @pokemon.getTeam()
|
||||||
|
if team
|
||||||
|
teamtier = team.getTier()
|
||||||
|
tier = team.getTier()
|
||||||
|
maxTier = team.getMaxTier()
|
||||||
|
@$(".total-format").text(teamtier.humanName).toggleClass("red", teamtier.tierRank > maxTier.tierRank)
|
||||||
|
@$(".max-format").text(maxTier.humanName)
|
||||||
|
|
||||||
|
|
||||||
|
renderFormat: =>
|
||||||
|
team = @pokemon.getTeam()
|
||||||
|
if team and team.hasPBV()
|
||||||
|
@renderPBV()
|
||||||
|
else if team and team.hasTier()
|
||||||
|
@renderTier()
|
||||||
|
|
||||||
renderSpecies: =>
|
renderSpecies: =>
|
||||||
@disableEventsAndExecute =>
|
@disableEventsAndExecute =>
|
||||||
|
@ -402,6 +430,11 @@ class @PokemonEditView extends Backbone.View
|
||||||
@$(".selected_shininess").toggleClass("selected", @pokemon.get('shiny') == true)
|
@$(".selected_shininess").toggleClass("selected", @pokemon.get('shiny') == true)
|
||||||
@$(".selected_happiness").toggleClass("selected", @pokemon.get("happiness") == 0)
|
@$(".selected_happiness").toggleClass("selected", @pokemon.get("happiness") == 0)
|
||||||
|
|
||||||
|
|
||||||
|
getTeam: =>
|
||||||
|
@pokemon.getTeam()
|
||||||
|
|
||||||
|
|
||||||
renderNonStats: =>
|
renderNonStats: =>
|
||||||
$nonStats = @$el.find(".non-stats")
|
$nonStats = @$el.find(".non-stats")
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,8 @@ class @TeambuilderView extends Backbone.View
|
||||||
onPokemonChange: (newPokemon) =>
|
onPokemonChange: (newPokemon) =>
|
||||||
team = @getSelectedTeam()
|
team = @getSelectedTeam()
|
||||||
team.replace(@selectedPokemon, newPokemon)
|
team.replace(@selectedPokemon, newPokemon)
|
||||||
@renderPBV()
|
@renderTier()
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
clickTeam: (e) =>
|
clickTeam: (e) =>
|
||||||
|
@ -72,7 +73,7 @@ class @TeambuilderView extends Backbone.View
|
||||||
@listenTo(team, 'add:pokemon remove:pokemon', @renderPokemonList)
|
@listenTo(team, 'add:pokemon remove:pokemon', @renderPokemonList)
|
||||||
@listenTo(team, 'reset:pokemon', (=> @changeTeam(team)))
|
@listenTo(team, 'reset:pokemon', (=> @changeTeam(team)))
|
||||||
@listenTo(team, 'change nested-change reset:pokemon add:pokemon remove:pokemon', @dirty)
|
@listenTo(team, 'change nested-change reset:pokemon add:pokemon remove:pokemon', @dirty)
|
||||||
@listenTo(team, 'change:pokemon[*] reset:pokemon add:pokemon remove:pokemon', @renderPBV)
|
@listenTo(team, 'change:pokemon[*] reset:pokemon add:pokemon remove:pokemon', @renderTier, @renderPBV)
|
||||||
|
|
||||||
# A temporary flag to attach until the teambuilder view is refactored
|
# A temporary flag to attach until the teambuilder view is refactored
|
||||||
team.attachedTeambuildEvents = true
|
team.attachedTeambuildEvents = true
|
||||||
|
@ -152,6 +153,13 @@ class @TeambuilderView extends Backbone.View
|
||||||
$link = $(e.currentTarget)
|
$link = $(e.currentTarget)
|
||||||
format = $link.data('format')
|
format = $link.data('format')
|
||||||
team = @getSelectedTeam()
|
team = @getSelectedTeam()
|
||||||
|
realformat = window.PokeBattle.conditions.Formats_[format]
|
||||||
|
console.log(team.hasPBV())
|
||||||
|
console.log(team.hasTier())
|
||||||
|
if realformat.tierBased and team.hasPBV()
|
||||||
|
console.log('this')
|
||||||
|
else if !realformat.tierBased and team.hasTier()
|
||||||
|
console.log('that')
|
||||||
if format != team.get('generation')
|
if format != team.get('generation')
|
||||||
team.set('generation', format)
|
team.set('generation', format)
|
||||||
@renderTeam()
|
@renderTeam()
|
||||||
|
@ -210,7 +218,7 @@ class @TeambuilderView extends Backbone.View
|
||||||
@$('.save_team').addClass('disabled')
|
@$('.save_team').addClass('disabled')
|
||||||
|
|
||||||
render: =>
|
render: =>
|
||||||
@$el.html @template(pokemon: @getSelectedTeam(), selected: @selectedPokemon)
|
@$el.html @template(pokemon: @getSelectedTeam(), selected: @selectedPokemon, window: window)
|
||||||
@renderTeams()
|
@renderTeams()
|
||||||
|
|
||||||
renderTeams: =>
|
renderTeams: =>
|
||||||
|
@ -257,9 +265,17 @@ class @TeambuilderView extends Backbone.View
|
||||||
@pokemonEditView.setTeamPBV(totalPBV)
|
@pokemonEditView.setTeamPBV(totalPBV)
|
||||||
@pokemonEditView.renderPBV()
|
@pokemonEditView.renderPBV()
|
||||||
|
|
||||||
|
renderTier: (pokemon) =>
|
||||||
|
if pokemon
|
||||||
|
individualTier = pokemon.getTier()
|
||||||
|
totalTier = @getSelectedTeam().getTier()
|
||||||
|
@pokemonEditView.setTeamTier(totalTier)
|
||||||
|
@pokemonEditView.renderTier()
|
||||||
|
|
||||||
renderFormat: =>
|
renderFormat: =>
|
||||||
|
allformats = window.PokeBattle.conditions.Formats()
|
||||||
format = @getSelectedTeam().get("generation")
|
format = @getSelectedTeam().get("generation")
|
||||||
format = DEFAULT_FORMAT if format not of Formats
|
format = DEFAULT_FORMAT if format not of allformats
|
||||||
text = @$(".change-format-dropdown a[data-format='#{format}']").text()
|
text = @$(".change-format-dropdown a[data-format='#{format}']").text()
|
||||||
@$(".current-format").text(text)
|
@$(".current-format").text(text)
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,10 @@ p
|
||||||
.dropdown
|
.dropdown
|
||||||
.select.select-format(data-toggle = "dropdown")
|
.select.select-format(data-toggle = "dropdown")
|
||||||
ul.dropdown-menu.format-dropdown(role = "menu")
|
ul.dropdown-menu.format-dropdown(role = "menu")
|
||||||
|
- var allformats = window.PokeBattle.conditions.Formats()
|
||||||
|
each format in allformats
|
||||||
li
|
li
|
||||||
a.select-format-dropdown-item(data-format="insur1000") 1000 PBV Insurgence
|
a.select-format-dropdown-item(data-format="#{format.name}") #{format.humanName}
|
||||||
li
|
|
||||||
a.select-format-dropdown-item(data-format="xy1000") 1000 PBV XY
|
|
||||||
li
|
|
||||||
a.select-format-dropdown-item(data-format="xy500") 500 PBV XY
|
|
||||||
|
|
||||||
p
|
p
|
||||||
strong Select a team:
|
strong Select a team:
|
||||||
|
|
|
@ -5,6 +5,14 @@ if team.hasPBV()
|
||||||
else
|
else
|
||||||
span.red= team.getPBV()
|
span.red= team.getPBV()
|
||||||
| /#{team.getMaxPBV()}
|
| /#{team.getMaxPBV()}
|
||||||
|
else if team.hasTier()
|
||||||
|
.team-tier Tier:
|
||||||
|
if team.getTier().tierRank <= team.getMaxTier().tierRank
|
||||||
|
= team.getTier().humanName
|
||||||
|
else
|
||||||
|
span.red= team.getTier().humanName
|
||||||
|
| /#{team.getMaxTier().humanName}
|
||||||
|
|
||||||
.team_icons.clearfix
|
.team_icons.clearfix
|
||||||
each pokemon, i in team.get('pokemon').models
|
each pokemon, i in team.get('pokemon').models
|
||||||
- var style = window.PokemonIconBackground(pokemon)
|
- var style = window.PokemonIconBackground(pokemon)
|
||||||
|
|
|
@ -5,13 +5,11 @@
|
||||||
.team_meta_buttons
|
.team_meta_buttons
|
||||||
.dropdown.change-format-dropdown.left
|
.dropdown.change-format-dropdown.left
|
||||||
.current-format.button.dropdown-toggle(data-toggle="dropdown")
|
.current-format.button.dropdown-toggle(data-toggle="dropdown")
|
||||||
|
- var allformats = window.PokeBattle.conditions.Formats()
|
||||||
ul.dropdown-menu(role="menu")
|
ul.dropdown-menu(role="menu")
|
||||||
|
for format in allformats
|
||||||
li
|
li
|
||||||
a(href="#", data-format="insur1000") 1000 PBV Insurgence
|
a(href="#", data-format="#{format.name}") #{format.humanName}
|
||||||
li
|
|
||||||
a(href="#", data-format="xy1000") 1000 PBV XY
|
|
||||||
li
|
|
||||||
a(href="#", data-format="xy500") 500 PBV XY
|
|
||||||
.button.button_blue.save_team.disabled Save
|
.button.button_blue.save_team.disabled Save
|
||||||
.button.go_back Back
|
.button.go_back Back
|
||||||
.navigation
|
.navigation
|
||||||
|
|
|
@ -25,16 +25,15 @@ mixin printStat(statName, keyName)
|
||||||
each species in speciesList
|
each species in speciesList
|
||||||
option(value=species)= species
|
option(value=species)= species
|
||||||
.species-info
|
.species-info
|
||||||
|
|
||||||
.non-stats
|
.non-stats
|
||||||
.teambuilder_row.pbv-row
|
.teambuilder_row.format_row
|
||||||
.teambuilder_col.non-stat-label PBV:
|
.teambuilder_col.non-stat.label.formatname
|
||||||
.teambuilder_col
|
.teambuilder_col
|
||||||
span.individual-pbv
|
span.individual-format
|
||||||
.right
|
.right
|
||||||
span.total-pbv
|
span.total-format
|
||||||
/
|
/
|
||||||
span.max-pbv
|
span.max-format
|
||||||
.teambuilder_row
|
.teambuilder_row
|
||||||
.teambuilder_col.non-stat-label Nickname:
|
.teambuilder_col.non-stat-label Nickname:
|
||||||
.teambuilder_col
|
.teambuilder_col
|
||||||
|
|
|
@ -7,6 +7,11 @@ each pokemon, i in pokemonList
|
||||||
em.name Empty
|
em.name Empty
|
||||||
else
|
else
|
||||||
.name= pokemon.get("species")
|
.name= pokemon.get("species")
|
||||||
|
if pokemon.getTeam().hasPBV()
|
||||||
.pokemon-pbv
|
.pokemon-pbv
|
||||||
| PBV:
|
| PBV:
|
||||||
span.pbv-value= pokemon.getPBV()
|
span.pbv-value= pokemon.getPBV()
|
||||||
|
else if pokemon.getTeam().hasTier()
|
||||||
|
.pokemon-pbv
|
||||||
|
| Tier:
|
||||||
|
span.pbv-value= pokemon.getTier().humanName
|
|
@ -31,6 +31,7 @@ a:hover,.fake_link:hover{color:#bd4f00}
|
||||||
.loading-container{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.7);color:#fff;font-size:4em;text-align:center;z-index:99;display:table;width:100%;height:100%}
|
.loading-container{position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,0.7);color:#fff;font-size:4em;text-align:center;z-index:99;display:table;width:100%;height:100%}
|
||||||
.loading-message{display:table-cell;vertical-align:middle}
|
.loading-message{display:table-cell;vertical-align:middle}
|
||||||
.team-pbv{font-size:.75em}
|
.team-pbv{font-size:.75em}
|
||||||
|
.team-tier{font-size:.75em}
|
||||||
.monospace{font-family:"Monaco",monospace}
|
.monospace{font-family:"Monaco",monospace}
|
||||||
abbr{border-bottom:1px dotted #333}
|
abbr{border-bottom:1px dotted #333}
|
||||||
.italic{font-style:italic}
|
.italic{font-style:italic}
|
||||||
|
@ -455,7 +456,7 @@ h1{font-family:"PT Sans Narrow","Helvetica Neue",sans-serif;font-size:2em;font-w
|
||||||
.teambuilder select,.teambuilder input{margin-bottom:0 !important;width:100%}
|
.teambuilder select,.teambuilder input{margin-bottom:0 !important;width:100%}
|
||||||
.teambuilder .meta-info{max-width:1368px}
|
.teambuilder .meta-info{max-width:1368px}
|
||||||
.teambuilder .meta-info .left-side,.teambuilder .meta-info .right-side{float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
|
.teambuilder .meta-info .left-side,.teambuilder .meta-info .right-side{float:left;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}
|
||||||
.teambuilder .navigation{position:absolute;top:50px;bottom:0;background-color:rgba(223,231,232,0.5);width:150px;}
|
.teambuilder .navigation{position:absolute;top:50px;bottom:0;background-color:rgba(223,231,232,0.5);width:160px;}
|
||||||
.teambuilder .navigation ul{list-style-type:none;padding:0;margin:0}
|
.teambuilder .navigation ul{list-style-type:none;padding:0;margin:0}
|
||||||
.teambuilder .navigation li,.teambuilder .navigation .nav-button{display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding-left:1em;height:50px;line-height:50px;font-size:14px}
|
.teambuilder .navigation li,.teambuilder .navigation .nav-button{display:block;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding-left:1em;height:50px;line-height:50px;font-size:14px}
|
||||||
.teambuilder .navigation li:hover,.teambuilder .navigation .nav-button:hover{cursor:pointer;background-color:rgba(0,0,0,0.1)}
|
.teambuilder .navigation li:hover,.teambuilder .navigation .nav-button:hover{cursor:pointer;background-color:rgba(0,0,0,0.1)}
|
||||||
|
@ -532,6 +533,7 @@ h1{font-family:"PT Sans Narrow","Helvetica Neue",sans-serif;font-size:2em;font-w
|
||||||
.teambuilder .display_teams .add-new-team{margin:10px}
|
.teambuilder .display_teams .add-new-team{margin:10px}
|
||||||
.teambuilder .display_teams .team-meta{font-size:.75em;text-align:right;margin-top:10px}
|
.teambuilder .display_teams .team-meta{font-size:.75em;text-align:right;margin-top:10px}
|
||||||
.teambuilder .display_teams .team-pbv{margin-top:-5px}
|
.teambuilder .display_teams .team-pbv{margin-top:-5px}
|
||||||
|
.teambuilder .display_teams .team-tier{margin-top:-5px}
|
||||||
textarea.textarea_modal{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%;height:300px}
|
textarea.textarea_modal{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;width:100%;height:300px}
|
||||||
@media screen and (max-width: 1268px){.teambuilder .meta-info .left-side,.teambuilder .meta-info .right-side{display:block;width:100%}
|
@media screen and (max-width: 1268px){.teambuilder .meta-info .left-side,.teambuilder .meta-info .right-side{display:block;width:100%}
|
||||||
.teambuilder .non-stats{margin:0 !important}
|
.teambuilder .non-stats{margin:0 !important}
|
||||||
|
|
412
public/js/app.js
412
public/js/app.js
|
@ -272,6 +272,10 @@
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
var self, _base;
|
||||||
|
|
||||||
|
self = (typeof window !== "undefined" && window !== null ? (_base = window.PokeBattle).conditions != null ? _base.conditions : _base.conditions = {} : this);
|
||||||
|
|
||||||
this.Conditions = {
|
this.Conditions = {
|
||||||
TEAM_PREVIEW: 1,
|
TEAM_PREVIEW: 1,
|
||||||
RATED_BATTLE: 2,
|
RATED_BATTLE: 2,
|
||||||
|
@ -284,7 +288,14 @@
|
||||||
UNRELEASED_BAN: 9,
|
UNRELEASED_BAN: 9,
|
||||||
PRANKSTER_SWAGGER_CLAUSE: 10,
|
PRANKSTER_SWAGGER_CLAUSE: 10,
|
||||||
PBV_500: 11,
|
PBV_500: 11,
|
||||||
VISIBLE_TEAM: 12
|
VISIBLE_TEAM: 12,
|
||||||
|
TIER_LC: 13,
|
||||||
|
TIER_PU: 14,
|
||||||
|
TIER_NU: 15,
|
||||||
|
TIER_RU: 16,
|
||||||
|
TIER_UU: 17,
|
||||||
|
TIER_OU: 18,
|
||||||
|
TIER_Uber: 19
|
||||||
};
|
};
|
||||||
|
|
||||||
this.SelectableConditions = [this.Conditions.VISIBLE_TEAM, this.Conditions.TIMED_BATTLE, this.Conditions.SLEEP_CLAUSE, this.Conditions.EVASION_CLAUSE, this.Conditions.SPECIES_CLAUSE, this.Conditions.PRANKSTER_SWAGGER_CLAUSE, this.Conditions.OHKO_CLAUSE, this.Conditions.UNRELEASED_BAN];
|
this.SelectableConditions = [this.Conditions.VISIBLE_TEAM, this.Conditions.TIMED_BATTLE, this.Conditions.SLEEP_CLAUSE, this.Conditions.EVASION_CLAUSE, this.Conditions.SPECIES_CLAUSE, this.Conditions.PRANKSTER_SWAGGER_CLAUSE, this.Conditions.OHKO_CLAUSE, this.Conditions.UNRELEASED_BAN];
|
||||||
|
@ -304,65 +315,109 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.Formats = {
|
self.PresetFormats = {
|
||||||
insur1000: {
|
insur1000: {
|
||||||
|
name: 'insur1000',
|
||||||
humanName: 'Insurgence 1000',
|
humanName: 'Insurgence 1000',
|
||||||
generation: 'in',
|
generation: 'in',
|
||||||
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW]
|
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW],
|
||||||
|
playable: true,
|
||||||
|
priority: 5,
|
||||||
|
tierBased: false
|
||||||
},
|
},
|
||||||
xy1000: {
|
xy1000: {
|
||||||
|
name: 'xy1000',
|
||||||
humanName: '1,000 PBV XY',
|
humanName: '1,000 PBV XY',
|
||||||
generation: 'xy',
|
generation: 'xy',
|
||||||
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW]
|
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW],
|
||||||
|
playable: true,
|
||||||
|
priority: 10,
|
||||||
|
tierBased: false
|
||||||
},
|
},
|
||||||
xy500: {
|
xy500: {
|
||||||
|
name: 'xy500',
|
||||||
humanName: '500 PBV XY',
|
humanName: '500 PBV XY',
|
||||||
generation: 'xy',
|
generation: 'xy',
|
||||||
conditions: [this.Conditions.PBV_500, this.Conditions.TEAM_PREVIEW]
|
conditions: [this.Conditions.PBV_500, this.Conditions.TEAM_PREVIEW],
|
||||||
|
playable: true,
|
||||||
|
priority: 10,
|
||||||
|
tierBased: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.DEFAULT_FORMAT = 'insur1000';
|
this.GenerationCondition = {
|
||||||
|
'in': {
|
||||||
this.tiers = {
|
conditionname: 'insur',
|
||||||
PA: {
|
humanName: 'Insurgence'
|
||||||
humanName: "Pathetic",
|
|
||||||
tierRank: 0
|
|
||||||
},
|
|
||||||
LC: {
|
|
||||||
humanName: "Little Cup",
|
|
||||||
tierRank: 1
|
|
||||||
},
|
|
||||||
PU: {
|
|
||||||
humanName: "Poorly Used",
|
|
||||||
tierRank: 2
|
|
||||||
},
|
|
||||||
NU: {
|
|
||||||
humanName: "Never Used",
|
|
||||||
tierRank: 3
|
|
||||||
},
|
|
||||||
RU: {
|
|
||||||
humanName: "Rarely Used",
|
|
||||||
tierRank: 4
|
|
||||||
},
|
|
||||||
UU: {
|
|
||||||
humanName: "Under Used",
|
|
||||||
tierRank: 5
|
|
||||||
},
|
|
||||||
OU: {
|
|
||||||
humanName: "Over Used",
|
|
||||||
tierRank: 6
|
|
||||||
},
|
|
||||||
Uber: {
|
|
||||||
humanName: "Ubers",
|
|
||||||
tierRank: 7
|
|
||||||
},
|
|
||||||
AG: {
|
|
||||||
humanName: "Anything Goes",
|
|
||||||
tierRank: 8
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.Formats_ = {};
|
||||||
|
|
||||||
|
self.Formats = function() {
|
||||||
|
if (Object.keys(this.Formats_).length === 0) {
|
||||||
|
this.setFormats();
|
||||||
|
return this.Formats_;
|
||||||
|
} else {
|
||||||
|
return this.Formats_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.setFormats = function() {
|
||||||
|
var Tiers, conditions, finalobj, format, formatname, gen, humanname, key, newformats, playablegens, priority, sortedformatsarr, tier, tierData, tierbased, _, _conditions, _i, _j, _len, _len1;
|
||||||
|
playablegens = ['in'];
|
||||||
|
newformats = this.PresetFormats;
|
||||||
|
if (typeof window !== "undefined" && window !== null) {
|
||||||
|
Tiers = window.PokeBattle.Tier.Tiers;
|
||||||
|
conditions = Conditions;
|
||||||
|
_ = window._;
|
||||||
|
} else {
|
||||||
|
Tiers = require('./tier').Tiers;
|
||||||
|
conditions = this.Conditions;
|
||||||
|
_ = require('underscore')._;
|
||||||
|
}
|
||||||
|
for (key in conditions) {
|
||||||
|
if ((key.search(/TIER_/)) === 0) {
|
||||||
|
tier = key.replace(/TIER_/, "");
|
||||||
|
tierData = Tiers[tier];
|
||||||
|
if (tierData.playable) {
|
||||||
|
for (_i = 0, _len = playablegens.length; _i < _len; _i++) {
|
||||||
|
gen = playablegens[_i];
|
||||||
|
tierbased = true;
|
||||||
|
if (typeof window !== "undefined" && window !== null) {
|
||||||
|
formatname = GenerationCondition[gen].conditionname + tier;
|
||||||
|
_conditions = [Conditions[key], Conditions.TEAM_PREVIEW];
|
||||||
|
priority = tierData.priority;
|
||||||
|
humanname = "" + GenerationCondition[gen].humanName + " " + tierData.humanName;
|
||||||
|
} else {
|
||||||
|
formatname = this.GenerationCondition[gen].conditionname + tier;
|
||||||
|
_conditions = [this.Conditions[key], this.Conditions.TEAM_PREVIEW];
|
||||||
|
priority = tierData.priority;
|
||||||
|
humanname = "" + this.GenerationCondition[gen].humanName + " " + tierData.humanName;
|
||||||
|
}
|
||||||
|
newformats[formatname] = {
|
||||||
|
name: formatname,
|
||||||
|
humanName: humanname,
|
||||||
|
generation: gen,
|
||||||
|
conditions: _conditions,
|
||||||
|
priority: priority,
|
||||||
|
tierBased: tierbased
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sortedformatsarr = _.sortBy(newformats, 'priority');
|
||||||
|
finalobj = {};
|
||||||
|
for (_j = 0, _len1 = sortedformatsarr.length; _j < _len1; _j++) {
|
||||||
|
format = sortedformatsarr[_j];
|
||||||
|
finalobj[format.name] = format;
|
||||||
|
}
|
||||||
|
return this.Formats_ = finalobj;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.DEFAULT_FORMAT = 'insurOU';
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
@ -934,6 +989,124 @@
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var Tiers, actualtiers, conditions, self, _, _base, _ref;
|
||||||
|
|
||||||
|
self = (typeof window !== "undefined" && window !== null ? (_base = window.PokeBattle).Tier != null ? _base.Tier : _base.Tier = {} : this);
|
||||||
|
|
||||||
|
if (typeof window === "undefined" || window === null) {
|
||||||
|
Tiers = require('./conditions').Tiers;
|
||||||
|
_ = require('underscore')._;
|
||||||
|
actualtiers = Tiers;
|
||||||
|
} else {
|
||||||
|
conditions = (_ref = window.conditions) != null ? _ref : {};
|
||||||
|
actualtiers = Tiers;
|
||||||
|
_ = window._;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.Tiers = {
|
||||||
|
Unsorted: {
|
||||||
|
name: "Unsorted",
|
||||||
|
humanName: "Unsorted",
|
||||||
|
tierRank: -1,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
PA: {
|
||||||
|
name: "PA",
|
||||||
|
humanName: "Pathetic",
|
||||||
|
tierRank: 0,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
LC: {
|
||||||
|
name: "LC",
|
||||||
|
humanName: "Little Cup",
|
||||||
|
tierRank: 1,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
PU: {
|
||||||
|
name: "PU",
|
||||||
|
humanName: "Poorly Used",
|
||||||
|
tierRank: 2,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
NU: {
|
||||||
|
name: "NU",
|
||||||
|
humanName: "Never Used",
|
||||||
|
tierRank: 3,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
RU: {
|
||||||
|
name: "RU",
|
||||||
|
humanName: "Rarely Used",
|
||||||
|
tierRank: 4,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
UU: {
|
||||||
|
name: "UU",
|
||||||
|
humanName: "Under Used",
|
||||||
|
tierRank: 5,
|
||||||
|
playable: true,
|
||||||
|
priority: 1
|
||||||
|
},
|
||||||
|
OU: {
|
||||||
|
name: "OU",
|
||||||
|
humanName: "Over Used",
|
||||||
|
tierRank: 6,
|
||||||
|
playable: true,
|
||||||
|
priority: 0
|
||||||
|
},
|
||||||
|
Uber: {
|
||||||
|
name: "Uber",
|
||||||
|
humanName: "Ubers",
|
||||||
|
tierRank: 7,
|
||||||
|
playable: true,
|
||||||
|
priority: 2
|
||||||
|
},
|
||||||
|
AG: {
|
||||||
|
name: "AG",
|
||||||
|
humanName: "Anything Goes",
|
||||||
|
tierRank: 8,
|
||||||
|
playable: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.determineTier = function(genData, pokemonArray) {
|
||||||
|
var actualtier, forme, item, mega, megaForme, megaSpecies, pokemon, species, speciesData, tier, tierdata, tierrank, _i, _len, _ref1, _ref2;
|
||||||
|
actualtiers = this.Tiers;
|
||||||
|
if (!(pokemonArray instanceof Array)) {
|
||||||
|
pokemonArray = [pokemonArray];
|
||||||
|
}
|
||||||
|
tierrank = -1;
|
||||||
|
for (_i = 0, _len = pokemonArray.length; _i < _len; _i++) {
|
||||||
|
pokemon = pokemonArray[_i];
|
||||||
|
species = pokemon.species;
|
||||||
|
forme = pokemon.forme || "default";
|
||||||
|
item = pokemon.item;
|
||||||
|
speciesData = genData != null ? genData.FormeData[species] : void 0;
|
||||||
|
mega = genData != null ? (_ref1 = genData.ItemData[item]) != null ? _ref1.mega : void 0 : void 0;
|
||||||
|
if (mega) {
|
||||||
|
megaSpecies = mega[0], megaForme = mega[1];
|
||||||
|
if (species === megaSpecies) {
|
||||||
|
forme = megaForme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tier = (speciesData != null ? (_ref2 = speciesData[forme]) != null ? _ref2.tier[0] : void 0 : void 0) || 'Unsorted';
|
||||||
|
tierdata = actualtiers[tier];
|
||||||
|
if (typeof tierdata === 'undefined') {
|
||||||
|
tierdata = actualtiers['Unsorted'];
|
||||||
|
}
|
||||||
|
if (tierdata.tierRank > tierrank) {
|
||||||
|
tierrank = tierdata.tierRank;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
actualtier = _.findWhere(actualtiers, {
|
||||||
|
tierRank: tierrank
|
||||||
|
});
|
||||||
|
return actualtier;
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(this);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var self;
|
var self;
|
||||||
|
|
||||||
|
@ -1486,7 +1659,6 @@
|
||||||
learnset = learnableMoves(window.Generations, this.attributes, generation);
|
learnset = learnableMoves(window.Generations, this.attributes, generation);
|
||||||
return _(learnset).map(function(moveName) {
|
return _(learnset).map(function(moveName) {
|
||||||
var move;
|
var move;
|
||||||
console.log(moveName);
|
|
||||||
move = _(MoveData[moveName]).clone();
|
move = _(MoveData[moveName]).clone();
|
||||||
move['name'] = moveName;
|
move['name'] = moveName;
|
||||||
return move;
|
return move;
|
||||||
|
@ -1592,6 +1764,12 @@
|
||||||
return PokeBattle.PBV.determinePBV(gen, this.attributes);
|
return PokeBattle.PBV.determinePBV(gen, this.attributes);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Pokemon.prototype.getTier = function() {
|
||||||
|
var gen;
|
||||||
|
gen = this.getGeneration();
|
||||||
|
return PokeBattle.Tier.determineTier(gen, this.attributes);
|
||||||
|
};
|
||||||
|
|
||||||
Pokemon.prototype.setPP = function(moveIndex, newPP) {
|
Pokemon.prototype.setPP = function(moveIndex, newPP) {
|
||||||
var array;
|
var array;
|
||||||
array = _.clone(this.get('pp'));
|
array = _.clone(this.get('pp'));
|
||||||
|
@ -1894,8 +2072,12 @@
|
||||||
this.sync = __bind(this.sync, this);
|
this.sync = __bind(this.sync, this);
|
||||||
this.hasNonNullPokemon = __bind(this.hasNonNullPokemon, this);
|
this.hasNonNullPokemon = __bind(this.hasNonNullPokemon, this);
|
||||||
this.getNonNullPokemon = __bind(this.getNonNullPokemon, this);
|
this.getNonNullPokemon = __bind(this.getNonNullPokemon, this);
|
||||||
|
this.getMaxTier = __bind(this.getMaxTier, this);
|
||||||
|
this.getMaxTierName = __bind(this.getMaxTierName, this);
|
||||||
|
this.hasTier = __bind(this.hasTier, this);
|
||||||
this.hasPBV = __bind(this.hasPBV, this);
|
this.hasPBV = __bind(this.hasPBV, this);
|
||||||
this.getMaxPBV = __bind(this.getMaxPBV, this);
|
this.getMaxPBV = __bind(this.getMaxPBV, this);
|
||||||
|
this.getTier = __bind(this.getTier, this);
|
||||||
this.getPBV = __bind(this.getPBV, this);
|
this.getPBV = __bind(this.getPBV, this);
|
||||||
this.getFormat = __bind(this.getFormat, this);
|
this.getFormat = __bind(this.getFormat, this);
|
||||||
this.clone = __bind(this.clone, this);
|
this.clone = __bind(this.clone, this);
|
||||||
|
@ -2003,12 +2185,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Team.prototype.getFormat = function() {
|
Team.prototype.getFormat = function() {
|
||||||
var format;
|
var allformats, format;
|
||||||
format = this.get('generation');
|
format = this.get('generation');
|
||||||
if (!(format in Formats)) {
|
allformats = window.PokeBattle.conditions.Formats();
|
||||||
|
if (!(format in allformats)) {
|
||||||
format = DEFAULT_FORMAT;
|
format = DEFAULT_FORMAT;
|
||||||
}
|
}
|
||||||
return Formats[format];
|
return allformats[format];
|
||||||
};
|
};
|
||||||
|
|
||||||
Team.prototype.getGeneration = function(generation) {
|
Team.prototype.getGeneration = function(generation) {
|
||||||
|
@ -2025,6 +2208,13 @@
|
||||||
return PokeBattle.PBV.determinePBV(gen, pokemon);
|
return PokeBattle.PBV.determinePBV(gen, pokemon);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Team.prototype.getTier = function() {
|
||||||
|
var gen, pokemon;
|
||||||
|
gen = this.getGeneration();
|
||||||
|
pokemon = this.get('pokemon').toJSON();
|
||||||
|
return PokeBattle.Tier.determineTier(gen, pokemon);
|
||||||
|
};
|
||||||
|
|
||||||
Team.prototype.getMaxPBV = function() {
|
Team.prototype.getMaxPBV = function() {
|
||||||
var conditions, _ref, _ref1;
|
var conditions, _ref, _ref1;
|
||||||
conditions = this.getFormat().conditions;
|
conditions = this.getFormat().conditions;
|
||||||
|
@ -2041,6 +2231,32 @@
|
||||||
return this.getMaxPBV() > 0;
|
return this.getMaxPBV() > 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Team.prototype.hasTier = function() {
|
||||||
|
return typeof this.getMaxTier() !== 'undefined';
|
||||||
|
};
|
||||||
|
|
||||||
|
Team.prototype.getMaxTierName = function() {
|
||||||
|
var condition, conditions, tier, tiername, _i, _len;
|
||||||
|
conditions = this.getFormat().conditions;
|
||||||
|
for (_i = 0, _len = conditions.length; _i < _len; _i++) {
|
||||||
|
condition = conditions[_i];
|
||||||
|
tiername = _.invert(Conditions)[condition];
|
||||||
|
if ((tiername.search(/TIER_/)) === 0) {
|
||||||
|
tier = tiername.replace(/TIER_/, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tier;
|
||||||
|
};
|
||||||
|
|
||||||
|
Team.prototype.getMaxTier = function() {
|
||||||
|
var tier, tiername;
|
||||||
|
tiername = this.getMaxTierName();
|
||||||
|
if (tiername) {
|
||||||
|
tier = PokeBattle.Tier.Tiers[tiername];
|
||||||
|
}
|
||||||
|
return tier;
|
||||||
|
};
|
||||||
|
|
||||||
Team.prototype.getNonNullPokemon = function() {
|
Team.prototype.getNonNullPokemon = function() {
|
||||||
return this.get('pokemon').where({
|
return this.get('pokemon').where({
|
||||||
isNull: false
|
isNull: false
|
||||||
|
@ -2161,13 +2377,14 @@
|
||||||
_.extend(Battle.prototype, PokeBattle.mixins.BattleProtocolParser);
|
_.extend(Battle.prototype, PokeBattle.mixins.BattleProtocolParser);
|
||||||
|
|
||||||
Battle.prototype.initialize = function(attributes) {
|
Battle.prototype.initialize = function(attributes) {
|
||||||
var spectators;
|
var allformats, spectators;
|
||||||
this.updateQueue = [];
|
this.updateQueue = [];
|
||||||
this.numActive = attributes.numActive, spectators = attributes.spectators;
|
this.numActive = attributes.numActive, spectators = attributes.spectators;
|
||||||
if (!!spectators) {
|
if (!!spectators) {
|
||||||
this.spectators = new UserList(spectators);
|
this.spectators = new UserList(spectators);
|
||||||
}
|
}
|
||||||
this.set('generation', Formats[this.get('format')].generation);
|
allformats = window.PokeBattle.conditions.Formats();
|
||||||
|
this.set('generation', allformats[this.get('format')].generation);
|
||||||
this.set('notifications', 0);
|
this.set('notifications', 0);
|
||||||
this.set('turn', 0);
|
this.set('turn', 0);
|
||||||
this.set('teams', [
|
this.set('teams', [
|
||||||
|
@ -2962,6 +3179,9 @@
|
||||||
|
|
||||||
BattleView.prototype.pokemonPopover = function($this, pokemon) {
|
BattleView.prototype.pokemonPopover = function($this, pokemon) {
|
||||||
var displayName, options, type, _i, _len, _ref;
|
var displayName, options, type, _i, _len, _ref;
|
||||||
|
if (this.isIllusioned(pokemon)) {
|
||||||
|
pokemon = pokemon.getTeam().attributes.pokemon.at(pokemon.getTeam().attributes.pokemon.length - 1);
|
||||||
|
}
|
||||||
displayName = pokemon.get('species');
|
displayName = pokemon.get('species');
|
||||||
if (pokemon.has('item')) {
|
if (pokemon.has('item')) {
|
||||||
displayName += " @ " + (pokemon.get('item'));
|
displayName += " @ " + (pokemon.get('item'));
|
||||||
|
@ -5243,7 +5463,10 @@
|
||||||
this.renderMoves = __bind(this.renderMoves, this);
|
this.renderMoves = __bind(this.renderMoves, this);
|
||||||
this.renderStats = __bind(this.renderStats, this);
|
this.renderStats = __bind(this.renderStats, this);
|
||||||
this.renderNonStats = __bind(this.renderNonStats, this);
|
this.renderNonStats = __bind(this.renderNonStats, this);
|
||||||
|
this.getTeam = __bind(this.getTeam, this);
|
||||||
this.renderSpecies = __bind(this.renderSpecies, this);
|
this.renderSpecies = __bind(this.renderSpecies, this);
|
||||||
|
this.renderFormat = __bind(this.renderFormat, this);
|
||||||
|
this.renderTier = __bind(this.renderTier, this);
|
||||||
this.renderPBV = __bind(this.renderPBV, this);
|
this.renderPBV = __bind(this.renderPBV, this);
|
||||||
this.renderPokemon = __bind(this.renderPokemon, this);
|
this.renderPokemon = __bind(this.renderPokemon, this);
|
||||||
this.render = __bind(this.render, this);
|
this.render = __bind(this.render, this);
|
||||||
|
@ -5273,6 +5496,7 @@
|
||||||
this.changeShiny = __bind(this.changeShiny, this);
|
this.changeShiny = __bind(this.changeShiny, this);
|
||||||
this.changeNickname = __bind(this.changeNickname, this);
|
this.changeNickname = __bind(this.changeNickname, this);
|
||||||
this.changeSpecies = __bind(this.changeSpecies, this);
|
this.changeSpecies = __bind(this.changeSpecies, this);
|
||||||
|
this.setTeamTier = __bind(this.setTeamTier, this);
|
||||||
this.setTeamPBV = __bind(this.setTeamPBV, this);
|
this.setTeamPBV = __bind(this.setTeamPBV, this);
|
||||||
this.setPokemon = __bind(this.setPokemon, this);
|
this.setPokemon = __bind(this.setPokemon, this);
|
||||||
this.setGeneration = __bind(this.setGeneration, this);
|
this.setGeneration = __bind(this.setGeneration, this);
|
||||||
|
@ -5325,14 +5549,15 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
PokemonEditView.prototype.setFormat = function(format) {
|
PokemonEditView.prototype.setFormat = function(format) {
|
||||||
format = Formats[format] || Formats[DEFAULT_FORMAT];
|
var allformats;
|
||||||
|
allformats = window.PokeBattle.conditions.Formats();
|
||||||
|
format = allformats[format] || allformats[DEFAULT_FORMAT];
|
||||||
return this.setGeneration(format.generation);
|
return this.setGeneration(format.generation);
|
||||||
};
|
};
|
||||||
|
|
||||||
PokemonEditView.prototype.changeSort = function(e) {
|
PokemonEditView.prototype.changeSort = function(e) {
|
||||||
var sort;
|
var sort;
|
||||||
sort = $(e.currentTarget).val();
|
sort = $(e.currentTarget).val();
|
||||||
console.log(sort);
|
|
||||||
if (sort === "Default Sort") {
|
if (sort === "Default Sort") {
|
||||||
return this.sortSpecieslist("Default");
|
return this.sortSpecieslist("Default");
|
||||||
} else if (sort === "Sort by Dexnumber") {
|
} else if (sort === "Sort by Dexnumber") {
|
||||||
|
@ -5350,7 +5575,7 @@
|
||||||
var ItemData, MoveData, SpeciesData, data, sortedlist, species, _ref;
|
var ItemData, MoveData, SpeciesData, data, sortedlist, species, _ref;
|
||||||
_ref = this.generation, MoveData = _ref.MoveData, SpeciesData = _ref.SpeciesData, ItemData = _ref.ItemData;
|
_ref = this.generation, MoveData = _ref.MoveData, SpeciesData = _ref.SpeciesData, ItemData = _ref.ItemData;
|
||||||
if (option === "Default") {
|
if (option === "Default") {
|
||||||
sortedlist = this.getSpecies;
|
sortedlist = this.getSpecies();
|
||||||
} else {
|
} else {
|
||||||
sortedlist = this.sortObject(SpeciesData, option, reverse);
|
sortedlist = this.sortObject(SpeciesData, option, reverse);
|
||||||
}
|
}
|
||||||
|
@ -5430,6 +5655,10 @@
|
||||||
return this.teamPBV = pbv;
|
return this.teamPBV = pbv;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PokemonEditView.prototype.setTeamTier = function(tier) {
|
||||||
|
return this.teamTier = tier;
|
||||||
|
};
|
||||||
|
|
||||||
PokemonEditView.prototype.changeSpecies = function(e) {
|
PokemonEditView.prototype.changeSpecies = function(e) {
|
||||||
var species;
|
var species;
|
||||||
if (!this.onPokemonChange) {
|
if (!this.onPokemonChange) {
|
||||||
|
@ -5756,11 +5985,19 @@
|
||||||
render: {
|
render: {
|
||||||
option: (function(_this) {
|
option: (function(_this) {
|
||||||
return function(item, escape) {
|
return function(item, escape) {
|
||||||
var pbv;
|
var pbv, team, tier;
|
||||||
|
team = _this.pokemon.getTeam();
|
||||||
|
if (team.hasPBV()) {
|
||||||
pbv = PokeBattle.PBV.determinePBV(_this.generation, {
|
pbv = PokeBattle.PBV.determinePBV(_this.generation, {
|
||||||
species: item.value
|
species: item.value
|
||||||
});
|
});
|
||||||
return "<div class='clearfix'>" + item.text + "<div class='pbv'>" + pbv + "</div></div>";
|
return "<div class='clearfix'>" + item.text + "<div class='pbv'>" + pbv + "</div></div>";
|
||||||
|
} else if (team.hasTier()) {
|
||||||
|
tier = PokeBattle.Tier.determineTier(_this.generation, {
|
||||||
|
species: item.value
|
||||||
|
});
|
||||||
|
return "<div class='clearfix'>" + item.text + "<div class='tier'>" + tier.humanName + "</div></div>";
|
||||||
|
}
|
||||||
};
|
};
|
||||||
})(this)
|
})(this)
|
||||||
}
|
}
|
||||||
|
@ -5775,7 +6012,7 @@
|
||||||
this.renderNonStats();
|
this.renderNonStats();
|
||||||
this.renderStats();
|
this.renderStats();
|
||||||
this.renderMoves();
|
this.renderMoves();
|
||||||
this.renderPBV();
|
this.renderFormat();
|
||||||
$elements = this.$el.find("input, select").not(".species input, .species select");
|
$elements = this.$el.find("input, select").not(".species input, .species select");
|
||||||
$elements.prop("disabled", this.pokemon.isNull);
|
$elements.prop("disabled", this.pokemon.isNull);
|
||||||
setSelectizeDisabled($elements, this.pokemon.isNull);
|
setSelectizeDisabled($elements, this.pokemon.isNull);
|
||||||
|
@ -5785,13 +6022,35 @@
|
||||||
PokemonEditView.prototype.renderPBV = function() {
|
PokemonEditView.prototype.renderPBV = function() {
|
||||||
var individualPBV, maxPBV, pbv, team;
|
var individualPBV, maxPBV, pbv, team;
|
||||||
individualPBV = this.pokemon.getPBV();
|
individualPBV = this.pokemon.getPBV();
|
||||||
this.$(".individual-pbv").text(individualPBV);
|
this.$(".individual-format").text(individualPBV);
|
||||||
team = this.pokemon.getTeam();
|
team = this.pokemon.getTeam();
|
||||||
if (team && team.hasPBV()) {
|
|
||||||
pbv = team.getPBV();
|
pbv = team.getPBV();
|
||||||
maxPBV = team.getMaxPBV();
|
maxPBV = team.getMaxPBV();
|
||||||
this.$(".total-pbv").text(pbv).toggleClass("red", pbv > maxPBV);
|
this.$(".total-format").text(pbv).toggleClass("red", pbv > maxPBV);
|
||||||
return this.$(".max-pbv").text(maxPBV);
|
return this.$(".max-format").text(maxPBV);
|
||||||
|
};
|
||||||
|
|
||||||
|
PokemonEditView.prototype.renderTier = function() {
|
||||||
|
var individualTier, maxTier, team, teamtier, tier;
|
||||||
|
individualTier = this.pokemon.getTier();
|
||||||
|
this.$('.individual-format').text(individualTier.humanName);
|
||||||
|
team = this.pokemon.getTeam();
|
||||||
|
if (team) {
|
||||||
|
teamtier = team.getTier();
|
||||||
|
tier = team.getTier();
|
||||||
|
maxTier = team.getMaxTier();
|
||||||
|
this.$(".total-format").text(teamtier.humanName).toggleClass("red", teamtier.tierRank > maxTier.tierRank);
|
||||||
|
return this.$(".max-format").text(maxTier.humanName);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
PokemonEditView.prototype.renderFormat = function() {
|
||||||
|
var team;
|
||||||
|
team = this.pokemon.getTeam();
|
||||||
|
if (team && team.hasPBV()) {
|
||||||
|
return this.renderPBV();
|
||||||
|
} else if (team && team.hasTier()) {
|
||||||
|
return this.renderTier();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5811,6 +6070,10 @@
|
||||||
})(this));
|
})(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PokemonEditView.prototype.getTeam = function() {
|
||||||
|
return this.pokemon.getTeam();
|
||||||
|
};
|
||||||
|
|
||||||
PokemonEditView.prototype.renderNonStats = function() {
|
PokemonEditView.prototype.renderNonStats = function() {
|
||||||
var $nonStats, displayedGenders, populateSelect;
|
var $nonStats, displayedGenders, populateSelect;
|
||||||
$nonStats = this.$el.find(".non-stats");
|
$nonStats = this.$el.find(".non-stats");
|
||||||
|
@ -5941,6 +6204,7 @@
|
||||||
this.validateImportedTeam = __bind(this.validateImportedTeam, this);
|
this.validateImportedTeam = __bind(this.validateImportedTeam, this);
|
||||||
this.renderImportTeamModal = __bind(this.renderImportTeamModal, this);
|
this.renderImportTeamModal = __bind(this.renderImportTeamModal, this);
|
||||||
this.renderFormat = __bind(this.renderFormat, this);
|
this.renderFormat = __bind(this.renderFormat, this);
|
||||||
|
this.renderTier = __bind(this.renderTier, this);
|
||||||
this.renderPBV = __bind(this.renderPBV, this);
|
this.renderPBV = __bind(this.renderPBV, this);
|
||||||
this.renderPokemon = __bind(this.renderPokemon, this);
|
this.renderPokemon = __bind(this.renderPokemon, this);
|
||||||
this.renderPokemonList = __bind(this.renderPokemonList, this);
|
this.renderPokemonList = __bind(this.renderPokemonList, this);
|
||||||
|
@ -6029,7 +6293,7 @@
|
||||||
var team;
|
var team;
|
||||||
team = _this.getSelectedTeam();
|
team = _this.getSelectedTeam();
|
||||||
team.replace(_this.selectedPokemon, newPokemon);
|
team.replace(_this.selectedPokemon, newPokemon);
|
||||||
return _this.renderPBV();
|
return _this.renderTier();
|
||||||
};
|
};
|
||||||
})(this)
|
})(this)
|
||||||
});
|
});
|
||||||
|
@ -6067,7 +6331,7 @@
|
||||||
};
|
};
|
||||||
})(this)));
|
})(this)));
|
||||||
this.listenTo(team, 'change nested-change reset:pokemon add:pokemon remove:pokemon', this.dirty);
|
this.listenTo(team, 'change nested-change reset:pokemon add:pokemon remove:pokemon', this.dirty);
|
||||||
this.listenTo(team, 'change:pokemon[*] reset:pokemon add:pokemon remove:pokemon', this.renderPBV);
|
this.listenTo(team, 'change:pokemon[*] reset:pokemon add:pokemon remove:pokemon', this.renderTier, this.renderPBV);
|
||||||
return team.attachedTeambuildEvents = true;
|
return team.attachedTeambuildEvents = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -6176,10 +6440,18 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
TeambuilderView.prototype.changeTeamFormat = function(e) {
|
TeambuilderView.prototype.changeTeamFormat = function(e) {
|
||||||
var $link, format, team;
|
var $link, format, realformat, team;
|
||||||
$link = $(e.currentTarget);
|
$link = $(e.currentTarget);
|
||||||
format = $link.data('format');
|
format = $link.data('format');
|
||||||
team = this.getSelectedTeam();
|
team = this.getSelectedTeam();
|
||||||
|
realformat = window.PokeBattle.conditions.Formats_[format];
|
||||||
|
console.log(team.hasPBV());
|
||||||
|
console.log(team.hasTier());
|
||||||
|
if (realformat.tierBased && team.hasPBV()) {
|
||||||
|
console.log('this');
|
||||||
|
} else if (!realformat.tierBased && team.hasTier()) {
|
||||||
|
console.log('that');
|
||||||
|
}
|
||||||
if (format !== team.get('generation')) {
|
if (format !== team.get('generation')) {
|
||||||
team.set('generation', format);
|
team.set('generation', format);
|
||||||
this.renderTeam();
|
this.renderTeam();
|
||||||
|
@ -6251,7 +6523,8 @@
|
||||||
TeambuilderView.prototype.render = function() {
|
TeambuilderView.prototype.render = function() {
|
||||||
this.$el.html(this.template({
|
this.$el.html(this.template({
|
||||||
pokemon: this.getSelectedTeam(),
|
pokemon: this.getSelectedTeam(),
|
||||||
selected: this.selectedPokemon
|
selected: this.selectedPokemon,
|
||||||
|
window: window
|
||||||
}));
|
}));
|
||||||
return this.renderTeams();
|
return this.renderTeams();
|
||||||
};
|
};
|
||||||
|
@ -6311,10 +6584,21 @@
|
||||||
return this.pokemonEditView.renderPBV();
|
return this.pokemonEditView.renderPBV();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TeambuilderView.prototype.renderTier = function(pokemon) {
|
||||||
|
var individualTier, totalTier;
|
||||||
|
if (pokemon) {
|
||||||
|
individualTier = pokemon.getTier();
|
||||||
|
}
|
||||||
|
totalTier = this.getSelectedTeam().getTier();
|
||||||
|
this.pokemonEditView.setTeamTier(totalTier);
|
||||||
|
return this.pokemonEditView.renderTier();
|
||||||
|
};
|
||||||
|
|
||||||
TeambuilderView.prototype.renderFormat = function() {
|
TeambuilderView.prototype.renderFormat = function() {
|
||||||
var format, text;
|
var allformats, format, text;
|
||||||
|
allformats = window.PokeBattle.conditions.Formats();
|
||||||
format = this.getSelectedTeam().get("generation");
|
format = this.getSelectedTeam().get("generation");
|
||||||
if (!(format in Formats)) {
|
if (!(format in allformats)) {
|
||||||
format = DEFAULT_FORMAT;
|
format = DEFAULT_FORMAT;
|
||||||
}
|
}
|
||||||
text = this.$(".change-format-dropdown a[data-format='" + format + "']").text();
|
text = this.$(".change-format-dropdown a[data-format='" + format + "']").text();
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -272,6 +272,10 @@
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
var self, _base;
|
||||||
|
|
||||||
|
self = (typeof window !== "undefined" && window !== null ? (_base = window.PokeBattle).conditions != null ? _base.conditions : _base.conditions = {} : this);
|
||||||
|
|
||||||
this.Conditions = {
|
this.Conditions = {
|
||||||
TEAM_PREVIEW: 1,
|
TEAM_PREVIEW: 1,
|
||||||
RATED_BATTLE: 2,
|
RATED_BATTLE: 2,
|
||||||
|
@ -284,7 +288,14 @@
|
||||||
UNRELEASED_BAN: 9,
|
UNRELEASED_BAN: 9,
|
||||||
PRANKSTER_SWAGGER_CLAUSE: 10,
|
PRANKSTER_SWAGGER_CLAUSE: 10,
|
||||||
PBV_500: 11,
|
PBV_500: 11,
|
||||||
VISIBLE_TEAM: 12
|
VISIBLE_TEAM: 12,
|
||||||
|
TIER_LC: 13,
|
||||||
|
TIER_PU: 14,
|
||||||
|
TIER_NU: 15,
|
||||||
|
TIER_RU: 16,
|
||||||
|
TIER_UU: 17,
|
||||||
|
TIER_OU: 18,
|
||||||
|
TIER_Uber: 19
|
||||||
};
|
};
|
||||||
|
|
||||||
this.SelectableConditions = [this.Conditions.VISIBLE_TEAM, this.Conditions.TIMED_BATTLE, this.Conditions.SLEEP_CLAUSE, this.Conditions.EVASION_CLAUSE, this.Conditions.SPECIES_CLAUSE, this.Conditions.PRANKSTER_SWAGGER_CLAUSE, this.Conditions.OHKO_CLAUSE, this.Conditions.UNRELEASED_BAN];
|
this.SelectableConditions = [this.Conditions.VISIBLE_TEAM, this.Conditions.TIMED_BATTLE, this.Conditions.SLEEP_CLAUSE, this.Conditions.EVASION_CLAUSE, this.Conditions.SPECIES_CLAUSE, this.Conditions.PRANKSTER_SWAGGER_CLAUSE, this.Conditions.OHKO_CLAUSE, this.Conditions.UNRELEASED_BAN];
|
||||||
|
@ -304,65 +315,109 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.Formats = {
|
self.PresetFormats = {
|
||||||
insur1000: {
|
insur1000: {
|
||||||
|
name: 'insur1000',
|
||||||
humanName: 'Insurgence 1000',
|
humanName: 'Insurgence 1000',
|
||||||
generation: 'in',
|
generation: 'in',
|
||||||
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW]
|
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW],
|
||||||
|
playable: true,
|
||||||
|
priority: 5,
|
||||||
|
tierBased: false
|
||||||
},
|
},
|
||||||
xy1000: {
|
xy1000: {
|
||||||
|
name: 'xy1000',
|
||||||
humanName: '1,000 PBV XY',
|
humanName: '1,000 PBV XY',
|
||||||
generation: 'xy',
|
generation: 'xy',
|
||||||
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW]
|
conditions: [this.Conditions.PBV_1000, this.Conditions.TEAM_PREVIEW],
|
||||||
|
playable: true,
|
||||||
|
priority: 10,
|
||||||
|
tierBased: false
|
||||||
},
|
},
|
||||||
xy500: {
|
xy500: {
|
||||||
|
name: 'xy500',
|
||||||
humanName: '500 PBV XY',
|
humanName: '500 PBV XY',
|
||||||
generation: 'xy',
|
generation: 'xy',
|
||||||
conditions: [this.Conditions.PBV_500, this.Conditions.TEAM_PREVIEW]
|
conditions: [this.Conditions.PBV_500, this.Conditions.TEAM_PREVIEW],
|
||||||
|
playable: true,
|
||||||
|
priority: 10,
|
||||||
|
tierBased: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.DEFAULT_FORMAT = 'insur1000';
|
this.GenerationCondition = {
|
||||||
|
'in': {
|
||||||
this.tiers = {
|
conditionname: 'insur',
|
||||||
PA: {
|
humanName: 'Insurgence'
|
||||||
humanName: "Pathetic",
|
|
||||||
tierRank: 0
|
|
||||||
},
|
|
||||||
LC: {
|
|
||||||
humanName: "Little Cup",
|
|
||||||
tierRank: 1
|
|
||||||
},
|
|
||||||
PU: {
|
|
||||||
humanName: "Poorly Used",
|
|
||||||
tierRank: 2
|
|
||||||
},
|
|
||||||
NU: {
|
|
||||||
humanName: "Never Used",
|
|
||||||
tierRank: 3
|
|
||||||
},
|
|
||||||
RU: {
|
|
||||||
humanName: "Rarely Used",
|
|
||||||
tierRank: 4
|
|
||||||
},
|
|
||||||
UU: {
|
|
||||||
humanName: "Under Used",
|
|
||||||
tierRank: 5
|
|
||||||
},
|
|
||||||
OU: {
|
|
||||||
humanName: "Over Used",
|
|
||||||
tierRank: 6
|
|
||||||
},
|
|
||||||
Uber: {
|
|
||||||
humanName: "Ubers",
|
|
||||||
tierRank: 7
|
|
||||||
},
|
|
||||||
AG: {
|
|
||||||
humanName: "Anything Goes",
|
|
||||||
tierRank: 8
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
self.Formats_ = {};
|
||||||
|
|
||||||
|
self.Formats = function() {
|
||||||
|
if (Object.keys(this.Formats_).length === 0) {
|
||||||
|
this.setFormats();
|
||||||
|
return this.Formats_;
|
||||||
|
} else {
|
||||||
|
return this.Formats_;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.setFormats = function() {
|
||||||
|
var Tiers, conditions, finalobj, format, formatname, gen, humanname, key, newformats, playablegens, priority, sortedformatsarr, tier, tierData, tierbased, _, _conditions, _i, _j, _len, _len1;
|
||||||
|
playablegens = ['in'];
|
||||||
|
newformats = this.PresetFormats;
|
||||||
|
if (typeof window !== "undefined" && window !== null) {
|
||||||
|
Tiers = window.PokeBattle.Tier.Tiers;
|
||||||
|
conditions = Conditions;
|
||||||
|
_ = window._;
|
||||||
|
} else {
|
||||||
|
Tiers = require('./tier').Tiers;
|
||||||
|
conditions = this.Conditions;
|
||||||
|
_ = require('underscore')._;
|
||||||
|
}
|
||||||
|
for (key in conditions) {
|
||||||
|
if ((key.search(/TIER_/)) === 0) {
|
||||||
|
tier = key.replace(/TIER_/, "");
|
||||||
|
tierData = Tiers[tier];
|
||||||
|
if (tierData.playable) {
|
||||||
|
for (_i = 0, _len = playablegens.length; _i < _len; _i++) {
|
||||||
|
gen = playablegens[_i];
|
||||||
|
tierbased = true;
|
||||||
|
if (typeof window !== "undefined" && window !== null) {
|
||||||
|
formatname = GenerationCondition[gen].conditionname + tier;
|
||||||
|
_conditions = [Conditions[key], Conditions.TEAM_PREVIEW];
|
||||||
|
priority = tierData.priority;
|
||||||
|
humanname = "" + GenerationCondition[gen].humanName + " " + tierData.humanName;
|
||||||
|
} else {
|
||||||
|
formatname = this.GenerationCondition[gen].conditionname + tier;
|
||||||
|
_conditions = [this.Conditions[key], this.Conditions.TEAM_PREVIEW];
|
||||||
|
priority = tierData.priority;
|
||||||
|
humanname = "" + this.GenerationCondition[gen].humanName + " " + tierData.humanName;
|
||||||
|
}
|
||||||
|
newformats[formatname] = {
|
||||||
|
name: formatname,
|
||||||
|
humanName: humanname,
|
||||||
|
generation: gen,
|
||||||
|
conditions: _conditions,
|
||||||
|
priority: priority,
|
||||||
|
tierBased: tierbased
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sortedformatsarr = _.sortBy(newformats, 'priority');
|
||||||
|
finalobj = {};
|
||||||
|
for (_j = 0, _len1 = sortedformatsarr.length; _j < _len1; _j++) {
|
||||||
|
format = sortedformatsarr[_j];
|
||||||
|
finalobj[format.name] = format;
|
||||||
|
}
|
||||||
|
return this.Formats_ = finalobj;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.DEFAULT_FORMAT = 'insurOU';
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
@ -934,6 +989,124 @@
|
||||||
|
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
|
(function() {
|
||||||
|
var Tiers, actualtiers, conditions, self, _, _base, _ref;
|
||||||
|
|
||||||
|
self = (typeof window !== "undefined" && window !== null ? (_base = window.PokeBattle).Tier != null ? _base.Tier : _base.Tier = {} : this);
|
||||||
|
|
||||||
|
if (typeof window === "undefined" || window === null) {
|
||||||
|
Tiers = require('./conditions').Tiers;
|
||||||
|
_ = require('underscore')._;
|
||||||
|
actualtiers = Tiers;
|
||||||
|
} else {
|
||||||
|
conditions = (_ref = window.conditions) != null ? _ref : {};
|
||||||
|
actualtiers = Tiers;
|
||||||
|
_ = window._;
|
||||||
|
}
|
||||||
|
|
||||||
|
self.Tiers = {
|
||||||
|
Unsorted: {
|
||||||
|
name: "Unsorted",
|
||||||
|
humanName: "Unsorted",
|
||||||
|
tierRank: -1,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
PA: {
|
||||||
|
name: "PA",
|
||||||
|
humanName: "Pathetic",
|
||||||
|
tierRank: 0,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
LC: {
|
||||||
|
name: "LC",
|
||||||
|
humanName: "Little Cup",
|
||||||
|
tierRank: 1,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
PU: {
|
||||||
|
name: "PU",
|
||||||
|
humanName: "Poorly Used",
|
||||||
|
tierRank: 2,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
NU: {
|
||||||
|
name: "NU",
|
||||||
|
humanName: "Never Used",
|
||||||
|
tierRank: 3,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
RU: {
|
||||||
|
name: "RU",
|
||||||
|
humanName: "Rarely Used",
|
||||||
|
tierRank: 4,
|
||||||
|
playable: false
|
||||||
|
},
|
||||||
|
UU: {
|
||||||
|
name: "UU",
|
||||||
|
humanName: "Under Used",
|
||||||
|
tierRank: 5,
|
||||||
|
playable: true,
|
||||||
|
priority: 1
|
||||||
|
},
|
||||||
|
OU: {
|
||||||
|
name: "OU",
|
||||||
|
humanName: "Over Used",
|
||||||
|
tierRank: 6,
|
||||||
|
playable: true,
|
||||||
|
priority: 0
|
||||||
|
},
|
||||||
|
Uber: {
|
||||||
|
name: "Uber",
|
||||||
|
humanName: "Ubers",
|
||||||
|
tierRank: 7,
|
||||||
|
playable: true,
|
||||||
|
priority: 2
|
||||||
|
},
|
||||||
|
AG: {
|
||||||
|
name: "AG",
|
||||||
|
humanName: "Anything Goes",
|
||||||
|
tierRank: 8,
|
||||||
|
playable: false
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.determineTier = function(genData, pokemonArray) {
|
||||||
|
var actualtier, forme, item, mega, megaForme, megaSpecies, pokemon, species, speciesData, tier, tierdata, tierrank, _i, _len, _ref1, _ref2;
|
||||||
|
actualtiers = this.Tiers;
|
||||||
|
if (!(pokemonArray instanceof Array)) {
|
||||||
|
pokemonArray = [pokemonArray];
|
||||||
|
}
|
||||||
|
tierrank = -1;
|
||||||
|
for (_i = 0, _len = pokemonArray.length; _i < _len; _i++) {
|
||||||
|
pokemon = pokemonArray[_i];
|
||||||
|
species = pokemon.species;
|
||||||
|
forme = pokemon.forme || "default";
|
||||||
|
item = pokemon.item;
|
||||||
|
speciesData = genData != null ? genData.FormeData[species] : void 0;
|
||||||
|
mega = genData != null ? (_ref1 = genData.ItemData[item]) != null ? _ref1.mega : void 0 : void 0;
|
||||||
|
if (mega) {
|
||||||
|
megaSpecies = mega[0], megaForme = mega[1];
|
||||||
|
if (species === megaSpecies) {
|
||||||
|
forme = megaForme;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tier = (speciesData != null ? (_ref2 = speciesData[forme]) != null ? _ref2.tier[0] : void 0 : void 0) || 'Unsorted';
|
||||||
|
tierdata = actualtiers[tier];
|
||||||
|
if (typeof tierdata === 'undefined') {
|
||||||
|
tierdata = actualtiers['Unsorted'];
|
||||||
|
}
|
||||||
|
if (tierdata.tierRank > tierrank) {
|
||||||
|
tierrank = tierdata.tierRank;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
actualtier = _.findWhere(actualtiers, {
|
||||||
|
tierRank: tierrank
|
||||||
|
});
|
||||||
|
return actualtier;
|
||||||
|
};
|
||||||
|
|
||||||
|
}).call(this);
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
var self;
|
var self;
|
||||||
|
|
||||||
|
@ -1486,7 +1659,6 @@
|
||||||
learnset = learnableMoves(window.Generations, this.attributes, generation);
|
learnset = learnableMoves(window.Generations, this.attributes, generation);
|
||||||
return _(learnset).map(function(moveName) {
|
return _(learnset).map(function(moveName) {
|
||||||
var move;
|
var move;
|
||||||
console.log(moveName);
|
|
||||||
move = _(MoveData[moveName]).clone();
|
move = _(MoveData[moveName]).clone();
|
||||||
move['name'] = moveName;
|
move['name'] = moveName;
|
||||||
return move;
|
return move;
|
||||||
|
@ -1592,6 +1764,12 @@
|
||||||
return PokeBattle.PBV.determinePBV(gen, this.attributes);
|
return PokeBattle.PBV.determinePBV(gen, this.attributes);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Pokemon.prototype.getTier = function() {
|
||||||
|
var gen;
|
||||||
|
gen = this.getGeneration();
|
||||||
|
return PokeBattle.Tier.determineTier(gen, this.attributes);
|
||||||
|
};
|
||||||
|
|
||||||
Pokemon.prototype.setPP = function(moveIndex, newPP) {
|
Pokemon.prototype.setPP = function(moveIndex, newPP) {
|
||||||
var array;
|
var array;
|
||||||
array = _.clone(this.get('pp'));
|
array = _.clone(this.get('pp'));
|
||||||
|
@ -1894,8 +2072,12 @@
|
||||||
this.sync = __bind(this.sync, this);
|
this.sync = __bind(this.sync, this);
|
||||||
this.hasNonNullPokemon = __bind(this.hasNonNullPokemon, this);
|
this.hasNonNullPokemon = __bind(this.hasNonNullPokemon, this);
|
||||||
this.getNonNullPokemon = __bind(this.getNonNullPokemon, this);
|
this.getNonNullPokemon = __bind(this.getNonNullPokemon, this);
|
||||||
|
this.getMaxTier = __bind(this.getMaxTier, this);
|
||||||
|
this.getMaxTierName = __bind(this.getMaxTierName, this);
|
||||||
|
this.hasTier = __bind(this.hasTier, this);
|
||||||
this.hasPBV = __bind(this.hasPBV, this);
|
this.hasPBV = __bind(this.hasPBV, this);
|
||||||
this.getMaxPBV = __bind(this.getMaxPBV, this);
|
this.getMaxPBV = __bind(this.getMaxPBV, this);
|
||||||
|
this.getTier = __bind(this.getTier, this);
|
||||||
this.getPBV = __bind(this.getPBV, this);
|
this.getPBV = __bind(this.getPBV, this);
|
||||||
this.getFormat = __bind(this.getFormat, this);
|
this.getFormat = __bind(this.getFormat, this);
|
||||||
this.clone = __bind(this.clone, this);
|
this.clone = __bind(this.clone, this);
|
||||||
|
@ -2003,12 +2185,13 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Team.prototype.getFormat = function() {
|
Team.prototype.getFormat = function() {
|
||||||
var format;
|
var allformats, format;
|
||||||
format = this.get('generation');
|
format = this.get('generation');
|
||||||
if (!(format in Formats)) {
|
allformats = window.PokeBattle.conditions.Formats();
|
||||||
|
if (!(format in allformats)) {
|
||||||
format = DEFAULT_FORMAT;
|
format = DEFAULT_FORMAT;
|
||||||
}
|
}
|
||||||
return Formats[format];
|
return allformats[format];
|
||||||
};
|
};
|
||||||
|
|
||||||
Team.prototype.getGeneration = function(generation) {
|
Team.prototype.getGeneration = function(generation) {
|
||||||
|
@ -2025,6 +2208,13 @@
|
||||||
return PokeBattle.PBV.determinePBV(gen, pokemon);
|
return PokeBattle.PBV.determinePBV(gen, pokemon);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Team.prototype.getTier = function() {
|
||||||
|
var gen, pokemon;
|
||||||
|
gen = this.getGeneration();
|
||||||
|
pokemon = this.get('pokemon').toJSON();
|
||||||
|
return PokeBattle.Tier.determineTier(gen, pokemon);
|
||||||
|
};
|
||||||
|
|
||||||
Team.prototype.getMaxPBV = function() {
|
Team.prototype.getMaxPBV = function() {
|
||||||
var conditions, _ref, _ref1;
|
var conditions, _ref, _ref1;
|
||||||
conditions = this.getFormat().conditions;
|
conditions = this.getFormat().conditions;
|
||||||
|
@ -2041,6 +2231,32 @@
|
||||||
return this.getMaxPBV() > 0;
|
return this.getMaxPBV() > 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Team.prototype.hasTier = function() {
|
||||||
|
return typeof this.getMaxTier() !== 'undefined';
|
||||||
|
};
|
||||||
|
|
||||||
|
Team.prototype.getMaxTierName = function() {
|
||||||
|
var condition, conditions, tier, tiername, _i, _len;
|
||||||
|
conditions = this.getFormat().conditions;
|
||||||
|
for (_i = 0, _len = conditions.length; _i < _len; _i++) {
|
||||||
|
condition = conditions[_i];
|
||||||
|
tiername = _.invert(Conditions)[condition];
|
||||||
|
if ((tiername.search(/TIER_/)) === 0) {
|
||||||
|
tier = tiername.replace(/TIER_/, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tier;
|
||||||
|
};
|
||||||
|
|
||||||
|
Team.prototype.getMaxTier = function() {
|
||||||
|
var tier, tiername;
|
||||||
|
tiername = this.getMaxTierName();
|
||||||
|
if (tiername) {
|
||||||
|
tier = PokeBattle.Tier.Tiers[tiername];
|
||||||
|
}
|
||||||
|
return tier;
|
||||||
|
};
|
||||||
|
|
||||||
Team.prototype.getNonNullPokemon = function() {
|
Team.prototype.getNonNullPokemon = function() {
|
||||||
return this.get('pokemon').where({
|
return this.get('pokemon').where({
|
||||||
isNull: false
|
isNull: false
|
||||||
|
@ -2161,13 +2377,14 @@
|
||||||
_.extend(Battle.prototype, PokeBattle.mixins.BattleProtocolParser);
|
_.extend(Battle.prototype, PokeBattle.mixins.BattleProtocolParser);
|
||||||
|
|
||||||
Battle.prototype.initialize = function(attributes) {
|
Battle.prototype.initialize = function(attributes) {
|
||||||
var spectators;
|
var allformats, spectators;
|
||||||
this.updateQueue = [];
|
this.updateQueue = [];
|
||||||
this.numActive = attributes.numActive, spectators = attributes.spectators;
|
this.numActive = attributes.numActive, spectators = attributes.spectators;
|
||||||
if (!!spectators) {
|
if (!!spectators) {
|
||||||
this.spectators = new UserList(spectators);
|
this.spectators = new UserList(spectators);
|
||||||
}
|
}
|
||||||
this.set('generation', Formats[this.get('format')].generation);
|
allformats = window.PokeBattle.conditions.Formats();
|
||||||
|
this.set('generation', allformats[this.get('format')].generation);
|
||||||
this.set('notifications', 0);
|
this.set('notifications', 0);
|
||||||
this.set('turn', 0);
|
this.set('turn', 0);
|
||||||
this.set('teams', [
|
this.set('teams', [
|
||||||
|
@ -2688,6 +2905,9 @@
|
||||||
|
|
||||||
BattleView.prototype.pokemonPopover = function($this, pokemon) {
|
BattleView.prototype.pokemonPopover = function($this, pokemon) {
|
||||||
var displayName, options, type, _i, _len, _ref;
|
var displayName, options, type, _i, _len, _ref;
|
||||||
|
if (this.isIllusioned(pokemon)) {
|
||||||
|
pokemon = pokemon.getTeam().attributes.pokemon.at(pokemon.getTeam().attributes.pokemon.length - 1);
|
||||||
|
}
|
||||||
displayName = pokemon.get('species');
|
displayName = pokemon.get('species');
|
||||||
if (pokemon.has('item')) {
|
if (pokemon.has('item')) {
|
||||||
displayName += " @ " + (pokemon.get('item'));
|
displayName += " @ " + (pokemon.get('item'));
|
||||||
|
|
|
@ -588,7 +588,31 @@ buf.push("<p class=\"logo\"></p><h2>Chat</h2><ul class=\"nav nav_rooms\"><li cla
|
||||||
this["JST"]["new_battle"] = function anonymous(locals
|
this["JST"]["new_battle"] = function anonymous(locals
|
||||||
/**/) {
|
/**/) {
|
||||||
var buf = [];
|
var buf = [];
|
||||||
var locals_ = (locals || {}),window = locals_.window,defaultClauses = locals_.defaultClauses;buf.push("<p><strong>In-battle display name:</strong></p><div class=\"alt-input clearfix hidden\"><div class=\"input-wrapper\"><input type=\"text\"/></div><div class=\"buttons-wrapper\"><button class=\"button add-button\">Add</button><button class=\"button cancel-button\">Cancel</button></div></div><div class=\"alt-dropdown-section dropdown\"><div data-toggle=\"dropdown\" class=\"select select-alt\"></div><ul role=\"menu\" class=\"dropdown-menu alt-dropdown\"></ul></div><p><strong>Format:</strong></p><div class=\"dropdown\"><div data-toggle=\"dropdown\" class=\"select select-format\"></div><ul role=\"menu\" class=\"dropdown-menu format-dropdown\"><li><a data-format=\"insur1000\" class=\"select-format-dropdown-item\">1000 PBV Insurgence</a></li><li><a data-format=\"xy1000\" class=\"select-format-dropdown-item\">1000 PBV XY</a></li><li><a data-format=\"xy500\" class=\"select-format-dropdown-item\">500 PBV XY</a></li></ul></div><p><strong>Select a team:</strong></p><div class=\"dropdown\"><div data-toggle=\"dropdown\" class=\"select select-team rounded\"><strong>Your team</strong></div><ul role=\"menu\" class=\"dropdown-menu team-dropdown\"></ul></div><p><strong>Clauses:</strong></p><ul class=\"challenge_clauses well\">");
|
var locals_ = (locals || {}),window = locals_.window,defaultClauses = locals_.defaultClauses;buf.push("<p><strong>In-battle display name:</strong></p><div class=\"alt-input clearfix hidden\"><div class=\"input-wrapper\"><input type=\"text\"/></div><div class=\"buttons-wrapper\"><button class=\"button add-button\">Add</button><button class=\"button cancel-button\">Cancel</button></div></div><div class=\"alt-dropdown-section dropdown\"><div data-toggle=\"dropdown\" class=\"select select-alt\"></div><ul role=\"menu\" class=\"dropdown-menu alt-dropdown\"></ul></div><p><strong>Format:</strong></p><div class=\"dropdown\"><div data-toggle=\"dropdown\" class=\"select select-format\"></div><ul role=\"menu\" class=\"dropdown-menu format-dropdown\">");
|
||||||
|
var allformats = window.PokeBattle.conditions.Formats()
|
||||||
|
// iterate allformats
|
||||||
|
;(function(){
|
||||||
|
var $$obj = allformats;
|
||||||
|
if ('number' == typeof $$obj.length) {
|
||||||
|
|
||||||
|
for (var $index = 0, $$l = $$obj.length; $index < $$l; $index++) {
|
||||||
|
var format = $$obj[$index];
|
||||||
|
|
||||||
|
buf.push("<li><a" + (jade.attrs({ 'data-format':("" + (format.name) + ""), "class": [('select-format-dropdown-item')] }, {"data-format":true})) + ">" + (jade.escape((jade.interp = format.humanName) == null ? '' : jade.interp)) + "</a></li>");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
var $$l = 0;
|
||||||
|
for (var $index in $$obj) {
|
||||||
|
$$l++; var format = $$obj[$index];
|
||||||
|
|
||||||
|
buf.push("<li><a" + (jade.attrs({ 'data-format':("" + (format.name) + ""), "class": [('select-format-dropdown-item')] }, {"data-format":true})) + ">" + (jade.escape((jade.interp = format.humanName) == null ? '' : jade.interp)) + "</a></li>");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}).call(this);
|
||||||
|
|
||||||
|
buf.push("</ul></div><p><strong>Select a team:</strong></p><div class=\"dropdown\"><div data-toggle=\"dropdown\" class=\"select select-team rounded\"><strong>Your team</strong></div><ul role=\"menu\" class=\"dropdown-menu team-dropdown\"></ul></div><p><strong>Clauses:</strong></p><ul class=\"challenge_clauses well\">");
|
||||||
// iterate window.SelectableConditions
|
// iterate window.SelectableConditions
|
||||||
;(function(){
|
;(function(){
|
||||||
var $$obj = window.SelectableConditions;
|
var $$obj = window.SelectableConditions;
|
||||||
|
@ -687,6 +711,19 @@ buf.push("<span class=\"red\">" + (jade.escape(null == (jade.interp = team.getPB
|
||||||
}
|
}
|
||||||
buf.push("/" + (jade.escape((jade.interp = team.getMaxPBV()) == null ? '' : jade.interp)) + "</div>");
|
buf.push("/" + (jade.escape((jade.interp = team.getMaxPBV()) == null ? '' : jade.interp)) + "</div>");
|
||||||
}
|
}
|
||||||
|
else if ( team.hasTier())
|
||||||
|
{
|
||||||
|
buf.push("<div class=\"team-tier\">Tier: ");
|
||||||
|
if ( team.getTier().tierRank <= team.getMaxTier().tierRank)
|
||||||
|
{
|
||||||
|
buf.push(jade.escape(null == (jade.interp = team.getTier().humanName) ? "" : jade.interp));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buf.push("<span class=\"red\">" + (jade.escape(null == (jade.interp = team.getTier().humanName) ? "" : jade.interp)) + "</span>");
|
||||||
|
}
|
||||||
|
buf.push("/" + (jade.escape((jade.interp = team.getMaxTier().humanName) == null ? '' : jade.interp)) + "</div>");
|
||||||
|
}
|
||||||
buf.push("<div class=\"team_icons clearfix\">");
|
buf.push("<div class=\"team_icons clearfix\">");
|
||||||
// iterate team.get('pokemon').models
|
// iterate team.get('pokemon').models
|
||||||
;(function(){
|
;(function(){
|
||||||
|
@ -718,7 +755,32 @@ buf.push("</div>");;return buf.join("");
|
||||||
this["JST"]["teambuilder/main"] = function anonymous(locals
|
this["JST"]["teambuilder/main"] = function anonymous(locals
|
||||||
/**/) {
|
/**/) {
|
||||||
var buf = [];
|
var buf = [];
|
||||||
buf.push("<div class=\"teambuilder\"><div class=\"display_pokemon\"><div class=\"team_meta clearfix\"><div contenteditable=\"true\" class=\"team_name\"></div><div class=\"team_meta_buttons\"><div class=\"dropdown change-format-dropdown left\"><div data-toggle=\"dropdown\" class=\"current-format button dropdown-toggle\"></div><ul role=\"menu\" class=\"dropdown-menu\"><li><a href=\"#\" data-format=\"insur1000\">1000 PBV Insurgence</a></li><li><a href=\"#\" data-format=\"xy1000\">1000 PBV XY</a></li><li><a href=\"#\" data-format=\"xy500\">500 PBV XY</a></li></ul></div><div class=\"button button_blue save_team disabled\">Save</div><div class=\"button go_back\">Back</div></div></div><div class=\"navigation\"><ul class=\"pokemon_list clearfix\"></ul><div class=\"nav-button add_pokemon\">+ Add Pokemon</div></div><div class=\"pokemon_edit\"></div></div><div class=\"display_teams\"></div></div>");;return buf.join("");
|
var locals_ = (locals || {}),window = locals_.window;buf.push("<div class=\"teambuilder\"><div class=\"display_pokemon\"><div class=\"team_meta clearfix\"><div contenteditable=\"true\" class=\"team_name\"></div><div class=\"team_meta_buttons\"><div class=\"dropdown change-format-dropdown left\"><div data-toggle=\"dropdown\" class=\"current-format button dropdown-toggle\"></div>");
|
||||||
|
var allformats = window.PokeBattle.conditions.Formats()
|
||||||
|
buf.push("<ul role=\"menu\" class=\"dropdown-menu\">");
|
||||||
|
// iterate allformats
|
||||||
|
;(function(){
|
||||||
|
var $$obj = allformats;
|
||||||
|
if ('number' == typeof $$obj.length) {
|
||||||
|
|
||||||
|
for (var $index = 0, $$l = $$obj.length; $index < $$l; $index++) {
|
||||||
|
var format = $$obj[$index];
|
||||||
|
|
||||||
|
buf.push("<li><a" + (jade.attrs({ 'href':("#"), 'data-format':("" + (format.name) + "") }, {"href":true,"data-format":true})) + ">" + (jade.escape((jade.interp = format.humanName) == null ? '' : jade.interp)) + "</a></li>");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
var $$l = 0;
|
||||||
|
for (var $index in $$obj) {
|
||||||
|
$$l++; var format = $$obj[$index];
|
||||||
|
|
||||||
|
buf.push("<li><a" + (jade.attrs({ 'href':("#"), 'data-format':("" + (format.name) + "") }, {"href":true,"data-format":true})) + ">" + (jade.escape((jade.interp = format.humanName) == null ? '' : jade.interp)) + "</a></li>");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}).call(this);
|
||||||
|
|
||||||
|
buf.push("</ul></div><div class=\"button button_blue save_team disabled\">Save</div><div class=\"button go_back\">Back</div></div></div><div class=\"navigation\"><ul class=\"pokemon_list clearfix\"></ul><div class=\"nav-button add_pokemon\">+ Add Pokemon</div></div><div class=\"pokemon_edit\"></div></div><div class=\"display_teams\"></div></div>");;return buf.join("");
|
||||||
};
|
};
|
||||||
|
|
||||||
this["JST"]["teambuilder/moves"] = function anonymous(locals
|
this["JST"]["teambuilder/moves"] = function anonymous(locals
|
||||||
|
@ -784,7 +846,7 @@ buf.push("<option" + (jade.attrs({ 'value':(species) }, {"value":true})) + ">" +
|
||||||
}
|
}
|
||||||
}).call(this);
|
}).call(this);
|
||||||
|
|
||||||
buf.push("</select><div class=\"species-info\"></div></div><div class=\"non-stats\"><div class=\"teambuilder_row pbv-row\"><div class=\"teambuilder_col non-stat-label\">PBV:</div><div class=\"teambuilder_col\"><span class=\"individual-pbv\"></span><div class=\"right\"><span class=\"total-pbv\"></span>/<span class=\"max-pbv\"></span></div></div></div><div class=\"teambuilder_row\"><div class=\"teambuilder_col non-stat-label\">Nickname:</div><div class=\"teambuilder_col\"><input type=\"text\" class=\"selected_nickname\"/></div></div><div class=\"teambuilder_row\"><div class=\"teambuilder_col non-stat-label\">Ability:</div><div class=\"teambuilder_col\"><select class=\"selected_ability\"></select></div></div><div class=\"teambuilder_row\"><div class=\"teambuilder_col non-stat-label\">Nature:</div><div class=\"teambuilder_col\"><select class=\"selected_nature\"></select></div></div><div class=\"teambuilder_row\"><div class=\"teambuilder_col non-stat-label\">Item:</div><div class=\"teambuilder_col\"><select class=\"selected_item\"><option value=\"\"></option>");
|
buf.push("</select><div class=\"species-info\"></div></div><div class=\"non-stats\"><div class=\"teambuilder_row format_row\"><div class=\"teambuilder_col non-stat label formatname\"></div><div class=\"teambuilder_col\"><span class=\"individual-format\"></span><div class=\"right\"><span class=\"total-format\"></span>/<span class=\"max-format\"></span></div></div></div><div class=\"teambuilder_row\"><div class=\"teambuilder_col non-stat-label\">Nickname:</div><div class=\"teambuilder_col\"><input type=\"text\" class=\"selected_nickname\"/></div></div><div class=\"teambuilder_row\"><div class=\"teambuilder_col non-stat-label\">Ability:</div><div class=\"teambuilder_col\"><select class=\"selected_ability\"></select></div></div><div class=\"teambuilder_row\"><div class=\"teambuilder_col non-stat-label\">Nature:</div><div class=\"teambuilder_col\"><select class=\"selected_nature\"></select></div></div><div class=\"teambuilder_row\"><div class=\"teambuilder_col non-stat-label\">Item:</div><div class=\"teambuilder_col\"><select class=\"selected_item\"><option value=\"\"></option>");
|
||||||
// iterate itemList
|
// iterate itemList
|
||||||
;(function(){
|
;(function(){
|
||||||
var $$obj = itemList;
|
var $$obj = itemList;
|
||||||
|
@ -862,7 +924,15 @@ buf.push("<em class=\"name\">Empty</em>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buf.push("<div class=\"name\">" + (jade.escape(null == (jade.interp = pokemon.get("species")) ? "" : jade.interp)) + "</div><div class=\"pokemon-pbv\">PBV: <span class=\"pbv-value\">" + (jade.escape(null == (jade.interp = pokemon.getPBV()) ? "" : jade.interp)) + "</span></div>");
|
buf.push("<div class=\"name\">" + (jade.escape(null == (jade.interp = pokemon.get("species")) ? "" : jade.interp)) + "</div>");
|
||||||
|
if ( pokemon.getTeam().hasPBV())
|
||||||
|
{
|
||||||
|
buf.push("<div class=\"pokemon-pbv\">PBV: <span class=\"pbv-value\">" + (jade.escape(null == (jade.interp = pokemon.getPBV()) ? "" : jade.interp)) + "</span></div>");
|
||||||
|
}
|
||||||
|
else if ( pokemon.getTeam().hasTier())
|
||||||
|
{
|
||||||
|
buf.push("<div class=\"pokemon-pbv\">Tier: <span class=\"pbv-value\">" + (jade.escape(null == (jade.interp = pokemon.getTier().humanName) ? "" : jade.interp)) + "</span></div>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
buf.push("</div></li>");
|
buf.push("</div></li>");
|
||||||
}
|
}
|
||||||
|
@ -881,7 +951,15 @@ buf.push("<em class=\"name\">Empty</em>");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buf.push("<div class=\"name\">" + (jade.escape(null == (jade.interp = pokemon.get("species")) ? "" : jade.interp)) + "</div><div class=\"pokemon-pbv\">PBV: <span class=\"pbv-value\">" + (jade.escape(null == (jade.interp = pokemon.getPBV()) ? "" : jade.interp)) + "</span></div>");
|
buf.push("<div class=\"name\">" + (jade.escape(null == (jade.interp = pokemon.get("species")) ? "" : jade.interp)) + "</div>");
|
||||||
|
if ( pokemon.getTeam().hasPBV())
|
||||||
|
{
|
||||||
|
buf.push("<div class=\"pokemon-pbv\">PBV: <span class=\"pbv-value\">" + (jade.escape(null == (jade.interp = pokemon.getPBV()) ? "" : jade.interp)) + "</span></div>");
|
||||||
|
}
|
||||||
|
else if ( pokemon.getTeam().hasTier())
|
||||||
|
{
|
||||||
|
buf.push("<div class=\"pokemon-pbv\">Tier: <span class=\"pbv-value\">" + (jade.escape(null == (jade.interp = pokemon.getTier().humanName) ? "" : jade.interp)) + "</span></div>");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
buf.push("</div></li>");
|
buf.push("</div></li>");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
{_} = require('underscore')
|
{_} = require('underscore')
|
||||||
{Conditions} = require('../shared/conditions')
|
{Conditions} = require('../shared/conditions')
|
||||||
|
{Tiers} = require('../shared/tier')
|
||||||
{Protocol} = require('../shared/protocol')
|
{Protocol} = require('../shared/protocol')
|
||||||
pbv = require('../shared/pokebattle_values')
|
pbv = require('../shared/pokebattle_values')
|
||||||
|
tiering = require('../shared/tier')
|
||||||
gen = require('./generations')
|
gen = require('./generations')
|
||||||
alts = require('./alts')
|
alts = require('./alts')
|
||||||
|
|
||||||
|
@ -75,6 +77,21 @@ createPBVCondition = (totalPBV) ->
|
||||||
createPBVCondition(1000)
|
createPBVCondition(1000)
|
||||||
createPBVCondition(500)
|
createPBVCondition(500)
|
||||||
|
|
||||||
|
createTierCondition = (conditionName, tier) ->
|
||||||
|
createCondition Conditions[conditionName],
|
||||||
|
validateTeam: (team, genData) ->
|
||||||
|
errors = []
|
||||||
|
tierdata = Tiers[tier]
|
||||||
|
teamtier = tiering.determineTier(genData, team)
|
||||||
|
if teamtier.tierRank > tierdata.tierRank
|
||||||
|
errors.push "Your team tier may not exceed the #{tierdata.humanName} tier"
|
||||||
|
if team.length != 6
|
||||||
|
errors.push "Your team must have 6 pokemon."
|
||||||
|
return errors
|
||||||
|
|
||||||
|
for key, val of Tiers
|
||||||
|
createTierCondition("TIER_#{key}", key)
|
||||||
|
|
||||||
createCondition Conditions.SLEEP_CLAUSE,
|
createCondition Conditions.SLEEP_CLAUSE,
|
||||||
attach:
|
attach:
|
||||||
initialize: ->
|
initialize: ->
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -10,6 +10,7 @@ gen = require './generations'
|
||||||
auth = require('./auth')
|
auth = require('./auth')
|
||||||
learnsets = require '../shared/learnsets'
|
learnsets = require '../shared/learnsets'
|
||||||
{Conditions, SelectableConditions, Formats, DEFAULT_FORMAT} = require '../shared/conditions'
|
{Conditions, SelectableConditions, Formats, DEFAULT_FORMAT} = require '../shared/conditions'
|
||||||
|
ConditionsFunc = require '../shared/conditions'
|
||||||
pbv = require '../shared/pokebattle_values'
|
pbv = require '../shared/pokebattle_values'
|
||||||
config = require './config'
|
config = require './config'
|
||||||
errors = require '../shared/errors'
|
errors = require '../shared/errors'
|
||||||
|
@ -34,7 +35,8 @@ MAX_NICKNAME_LENGTH = 15
|
||||||
class @BattleServer
|
class @BattleServer
|
||||||
constructor: ->
|
constructor: ->
|
||||||
@queues = {}
|
@queues = {}
|
||||||
for format of Formats
|
allformats = ConditionsFunc.Formats()
|
||||||
|
for format of allformats
|
||||||
@queues[format] = new BattleQueue()
|
@queues[format] = new BattleQueue()
|
||||||
@battles = {}
|
@battles = {}
|
||||||
|
|
||||||
|
@ -221,7 +223,8 @@ class @BattleServer
|
||||||
return true
|
return true
|
||||||
|
|
||||||
beginBattles: (next) ->
|
beginBattles: (next) ->
|
||||||
array = for format in Object.keys(Formats)
|
allformats = ConditionsFunc.Formats()
|
||||||
|
array = for format in Object.keys(allformats)
|
||||||
do (format) => (callback) =>
|
do (format) => (callback) =>
|
||||||
@queues[format].pairPlayers (err, pairs) =>
|
@queues[format].pairPlayers (err, pairs) =>
|
||||||
if err then return callback(err)
|
if err then return callback(err)
|
||||||
|
@ -239,7 +242,8 @@ class @BattleServer
|
||||||
|
|
||||||
# Creates a battle and returns its battleId
|
# Creates a battle and returns its battleId
|
||||||
createBattle: (rawFormat = DEFAULT_FORMAT, pair = [], conditions = []) ->
|
createBattle: (rawFormat = DEFAULT_FORMAT, pair = [], conditions = []) ->
|
||||||
format = Formats[rawFormat]
|
allformats = ConditionsFunc.Formats()
|
||||||
|
format = allformats[rawFormat]
|
||||||
generation = format.generation
|
generation = format.generation
|
||||||
conditions = conditions.concat(format.conditions)
|
conditions = conditions.concat(format.conditions)
|
||||||
{Battle} = require("../server/#{generation}/battle")
|
{Battle} = require("../server/#{generation}/battle")
|
||||||
|
@ -369,8 +373,10 @@ class @BattleServer
|
||||||
# Returns an empty array if the given team is valid, an array of errors
|
# Returns an empty array if the given team is valid, an array of errors
|
||||||
# otherwise.
|
# otherwise.
|
||||||
validateTeam: (team, format = DEFAULT_FORMAT, conditions = []) ->
|
validateTeam: (team, format = DEFAULT_FORMAT, conditions = []) ->
|
||||||
return [ "Invalid format: #{format}." ] if format not of Formats
|
allformats = ConditionsFunc.Formats()
|
||||||
format = Formats[format]
|
return [ "Invalid format: #{format}." ] if format not of allformats
|
||||||
|
allformats = ConditionsFunc.Formats()
|
||||||
|
format = allformats[format]
|
||||||
return [ "Invalid team format." ] if team not instanceof Array
|
return [ "Invalid team format." ] if team not instanceof Array
|
||||||
return [ "Team must have 1 to 6 Pokemon." ] unless 1 <= team.length <= 6
|
return [ "Team must have 1 to 6 Pokemon." ] unless 1 <= team.length <= 6
|
||||||
conditions = conditions.concat(format.conditions)
|
conditions = conditions.concat(format.conditions)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
self = (if window? then window.PokeBattle.conditions ?= {} else this)
|
||||||
|
|
||||||
@Conditions =
|
@Conditions =
|
||||||
TEAM_PREVIEW : 1
|
TEAM_PREVIEW : 1
|
||||||
RATED_BATTLE : 2
|
RATED_BATTLE : 2
|
||||||
|
@ -11,6 +13,13 @@
|
||||||
PRANKSTER_SWAGGER_CLAUSE : 10
|
PRANKSTER_SWAGGER_CLAUSE : 10
|
||||||
PBV_500 : 11
|
PBV_500 : 11
|
||||||
VISIBLE_TEAM : 12
|
VISIBLE_TEAM : 12
|
||||||
|
TIER_LC : 13
|
||||||
|
TIER_PU : 14
|
||||||
|
TIER_NU : 15
|
||||||
|
TIER_RU : 16
|
||||||
|
TIER_UU : 17
|
||||||
|
TIER_OU : 18
|
||||||
|
TIER_Uber : 19
|
||||||
|
|
||||||
@SelectableConditions = [
|
@SelectableConditions = [
|
||||||
@Conditions.VISIBLE_TEAM
|
@Conditions.VISIBLE_TEAM
|
||||||
|
@ -36,47 +45,81 @@
|
||||||
UNRELEASED_BAN : "Unreleased Ban"
|
UNRELEASED_BAN : "Unreleased Ban"
|
||||||
PRANKSTER_SWAGGER_CLAUSE : "Prankster + Swagger Clause"
|
PRANKSTER_SWAGGER_CLAUSE : "Prankster + Swagger Clause"
|
||||||
|
|
||||||
@Formats =
|
self.PresetFormats =
|
||||||
insur1000:
|
insur1000:
|
||||||
|
name : 'insur1000'
|
||||||
humanName : 'Insurgence 1000'
|
humanName : 'Insurgence 1000'
|
||||||
generation : 'in'
|
generation : 'in'
|
||||||
conditions : [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW ]
|
conditions : [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW ]
|
||||||
|
playable : true
|
||||||
|
priority : 5
|
||||||
|
tierBased : false
|
||||||
xy1000:
|
xy1000:
|
||||||
|
name : 'xy1000'
|
||||||
humanName : '1,000 PBV XY'
|
humanName : '1,000 PBV XY'
|
||||||
generation : 'xy'
|
generation : 'xy'
|
||||||
conditions : [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW ]
|
conditions : [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW ]
|
||||||
|
playable : true
|
||||||
|
priority : 10
|
||||||
|
tierBased : false
|
||||||
xy500:
|
xy500:
|
||||||
|
name : 'xy500'
|
||||||
humanName : '500 PBV XY'
|
humanName : '500 PBV XY'
|
||||||
generation : 'xy'
|
generation : 'xy'
|
||||||
conditions : [ @Conditions.PBV_500, @Conditions.TEAM_PREVIEW ]
|
conditions : [ @Conditions.PBV_500, @Conditions.TEAM_PREVIEW ]
|
||||||
|
playable : true
|
||||||
|
priority : 10
|
||||||
|
tierBased : false
|
||||||
|
|
||||||
@DEFAULT_FORMAT = 'insur1000'
|
@GenerationCondition =
|
||||||
|
'in':
|
||||||
|
conditionname : 'insur'
|
||||||
|
humanName : 'Insurgence'
|
||||||
|
|
||||||
|
self.Formats_ = {}
|
||||||
|
|
||||||
|
self.Formats = ->
|
||||||
|
if Object.keys(@Formats_).length is 0
|
||||||
|
@setFormats()
|
||||||
|
return @Formats_
|
||||||
|
else
|
||||||
|
return @Formats_
|
||||||
|
|
||||||
|
self.setFormats = ->
|
||||||
|
playablegens = ['in']
|
||||||
|
newformats = @PresetFormats
|
||||||
|
if window?
|
||||||
|
Tiers = window.PokeBattle.Tier.Tiers
|
||||||
|
conditions = Conditions
|
||||||
|
_ = window._
|
||||||
|
else
|
||||||
|
{Tiers} = require('./tier')
|
||||||
|
conditions = @Conditions
|
||||||
|
{_} = require('underscore')
|
||||||
|
for key of conditions
|
||||||
|
if (key.search /TIER_/) == 0
|
||||||
|
tier = key.replace /TIER_/, ""
|
||||||
|
tierData = Tiers[tier]
|
||||||
|
if tierData.playable
|
||||||
|
for gen in playablegens
|
||||||
|
tierbased = true
|
||||||
|
if window?
|
||||||
|
formatname = GenerationCondition[gen].conditionname + tier
|
||||||
|
_conditions = [Conditions[key], Conditions.TEAM_PREVIEW]
|
||||||
|
priority = tierData.priority
|
||||||
|
humanname = "#{GenerationCondition[gen].humanName} #{tierData.humanName}"
|
||||||
|
else
|
||||||
|
formatname = @GenerationCondition[gen].conditionname + tier
|
||||||
|
_conditions = [@Conditions[key], @Conditions.TEAM_PREVIEW]
|
||||||
|
priority = tierData.priority
|
||||||
|
humanname = "#{@GenerationCondition[gen].humanName} #{tierData.humanName}"
|
||||||
|
|
||||||
|
newformats[formatname] = {name: formatname, humanName: humanname, generation: gen, conditions: _conditions, priority: priority, tierBased: tierbased}
|
||||||
|
sortedformatsarr = _.sortBy(newformats, 'priority');
|
||||||
|
finalobj = {}
|
||||||
|
for format in sortedformatsarr
|
||||||
|
finalobj[format.name] = format
|
||||||
|
@Formats_ = finalobj
|
||||||
|
|
||||||
|
@DEFAULT_FORMAT = 'insurOU'
|
||||||
|
|
||||||
@tiers =
|
|
||||||
PA:
|
|
||||||
humanName: "Pathetic"
|
|
||||||
tierRank: 0
|
|
||||||
LC:
|
|
||||||
humanName: "Little Cup"
|
|
||||||
tierRank: 1
|
|
||||||
PU:
|
|
||||||
humanName: "Poorly Used"
|
|
||||||
tierRank: 2
|
|
||||||
NU:
|
|
||||||
humanName: "Never Used"
|
|
||||||
tierRank: 3
|
|
||||||
RU:
|
|
||||||
humanName: "Rarely Used"
|
|
||||||
tierRank: 4
|
|
||||||
UU:
|
|
||||||
humanName: "Under Used"
|
|
||||||
tierRank: 5
|
|
||||||
OU:
|
|
||||||
humanName: "Over Used"
|
|
||||||
tierRank: 6
|
|
||||||
Uber:
|
|
||||||
humanName: "Ubers"
|
|
||||||
tierRank: 7
|
|
||||||
AG:
|
|
||||||
humanName: "Anything Goes"
|
|
||||||
tierRank: 8
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
self = (if window? then window.PokeBattle.Tier ?= {} else this)
|
||||||
|
|
||||||
|
if !window?
|
||||||
|
{Tiers} = require('./conditions')
|
||||||
|
{_} = require('underscore')
|
||||||
|
actualtiers = Tiers
|
||||||
|
else
|
||||||
|
conditions = window.conditions ? {}
|
||||||
|
actualtiers = Tiers
|
||||||
|
_ = window._
|
||||||
|
|
||||||
|
self.Tiers =
|
||||||
|
Unsorted:
|
||||||
|
name : "Unsorted"
|
||||||
|
humanName : "Unsorted"
|
||||||
|
tierRank : -1
|
||||||
|
playable : false
|
||||||
|
PA:
|
||||||
|
name : "PA"
|
||||||
|
humanName : "Pathetic"
|
||||||
|
tierRank : 0
|
||||||
|
playable : false
|
||||||
|
LC:
|
||||||
|
name : "LC"
|
||||||
|
humanName : "Little Cup"
|
||||||
|
tierRank : 1
|
||||||
|
playable : false
|
||||||
|
PU:
|
||||||
|
name : "PU"
|
||||||
|
humanName : "Poorly Used"
|
||||||
|
tierRank : 2
|
||||||
|
playable : false
|
||||||
|
NU:
|
||||||
|
name : "NU"
|
||||||
|
humanName : "Never Used"
|
||||||
|
tierRank : 3
|
||||||
|
playable : false
|
||||||
|
RU:
|
||||||
|
name : "RU"
|
||||||
|
humanName : "Rarely Used"
|
||||||
|
tierRank : 4
|
||||||
|
playable : false
|
||||||
|
UU:
|
||||||
|
name : "UU"
|
||||||
|
humanName : "Under Used"
|
||||||
|
tierRank : 5
|
||||||
|
playable : true
|
||||||
|
priority : 1
|
||||||
|
OU:
|
||||||
|
name : "OU"
|
||||||
|
humanName : "Over Used"
|
||||||
|
tierRank : 6
|
||||||
|
playable : true
|
||||||
|
priority : 0
|
||||||
|
Uber:
|
||||||
|
name : "Uber"
|
||||||
|
humanName : "Ubers"
|
||||||
|
tierRank : 7
|
||||||
|
playable : true
|
||||||
|
priority : 2
|
||||||
|
AG:
|
||||||
|
name : "AG"
|
||||||
|
humanName : "Anything Goes"
|
||||||
|
tierRank : 8
|
||||||
|
playable : false
|
||||||
|
|
||||||
|
self.determineTier = (genData, pokemonArray) ->
|
||||||
|
actualtiers = @Tiers
|
||||||
|
if pokemonArray not instanceof Array then pokemonArray = [ pokemonArray ]
|
||||||
|
tierrank = -1
|
||||||
|
for pokemon in pokemonArray
|
||||||
|
species = pokemon.species
|
||||||
|
forme = pokemon.forme || "default"
|
||||||
|
item = pokemon.item
|
||||||
|
speciesData = genData?.FormeData[species]
|
||||||
|
|
||||||
|
# Handle megas
|
||||||
|
mega = genData?.ItemData[item]?.mega
|
||||||
|
if mega
|
||||||
|
[ megaSpecies, megaForme ] = mega
|
||||||
|
if species == megaSpecies
|
||||||
|
forme = megaForme
|
||||||
|
|
||||||
|
# Get PBV of the Pokemon's forme
|
||||||
|
tier = speciesData?[forme]?.tier[0] || 'Unsorted'
|
||||||
|
tierdata = actualtiers[tier]
|
||||||
|
|
||||||
|
tierdata = actualtiers['Unsorted'] if typeof tierdata == 'undefined'
|
||||||
|
|
||||||
|
if tierdata.tierRank > tierrank
|
||||||
|
tierrank = tierdata.tierRank
|
||||||
|
|
||||||
|
actualtier = _.findWhere(actualtiers, {tierRank: tierrank});
|
||||||
|
return actualtier
|
Loading…
Reference in New Issue