mirror of
https://gitlab.com/Deukhoofd/BattleSim.git
synced 2025-10-29 10:40:04 +00:00
Added Smogon tiering system, made team invisible clause, sorted all pokemon
This commit is contained in:
@@ -19,7 +19,8 @@ class @Battle extends Backbone.AssociatedModel
|
||||
@updateQueue = []
|
||||
{@numActive, spectators} = attributes
|
||||
@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('turn', 0)
|
||||
@set('teams', [{hidden: true}, {hidden: true}])
|
||||
|
||||
@@ -135,7 +135,6 @@ class @Pokemon extends Backbone.Model
|
||||
|
||||
# Map each move name to a move object
|
||||
return _(learnset).map (moveName) ->
|
||||
console.log(moveName)
|
||||
move = _(MoveData[moveName]).clone()
|
||||
move['name'] = moveName
|
||||
move
|
||||
@@ -213,6 +212,10 @@ class @Pokemon extends Backbone.Model
|
||||
gen = @getGeneration()
|
||||
PokeBattle.PBV.determinePBV(gen, @attributes)
|
||||
|
||||
getTier: ->
|
||||
gen = @getGeneration()
|
||||
PokeBattle.Tier.determineTier(gen, @attributes)
|
||||
|
||||
setPP: (moveIndex, newPP) ->
|
||||
array = _.clone(@get('pp'))
|
||||
array[moveIndex] = newPP
|
||||
|
||||
@@ -66,8 +66,9 @@ class @Team extends Backbone.AssociatedModel
|
||||
|
||||
getFormat: =>
|
||||
format = @get('generation') # TODO: Migrate to format
|
||||
format = DEFAULT_FORMAT if format not of Formats
|
||||
Formats[format]
|
||||
allformats = window.PokeBattle.conditions.Formats()
|
||||
format = DEFAULT_FORMAT if format not of allformats
|
||||
allformats[format]
|
||||
|
||||
getGeneration: (generation) ->
|
||||
gen = generation || @getFormat().generation
|
||||
@@ -79,6 +80,11 @@ class @Team extends Backbone.AssociatedModel
|
||||
pokemon = @get('pokemon').toJSON()
|
||||
PokeBattle.PBV.determinePBV(gen, pokemon)
|
||||
|
||||
getTier: =>
|
||||
gen = @getGeneration()
|
||||
pokemon = @get('pokemon').toJSON()
|
||||
PokeBattle.Tier.determineTier(gen, pokemon)
|
||||
|
||||
getMaxPBV: =>
|
||||
{conditions} = @getFormat()
|
||||
if Conditions.PBV_1000 in conditions
|
||||
@@ -91,6 +97,23 @@ class @Team extends Backbone.AssociatedModel
|
||||
hasPBV: =>
|
||||
@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: =>
|
||||
@get('pokemon').where(isNull: false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user