1
0
mirror of https://gitlab.com/Deukhoofd/BattleSim.git synced 2025-10-27 18:00:03 +00:00

Added Smogon tiering system, made team invisible clause, sorted all pokemon

This commit is contained in:
Deukhoofd
2016-02-04 23:30:39 +01:00
parent d7316d5799
commit 398d23a0d6
23 changed files with 6735 additions and 5135 deletions

View File

@@ -1,3 +1,5 @@
self = (if window? then window.PokeBattle.conditions ?= {} else this)
@Conditions =
TEAM_PREVIEW : 1
RATED_BATTLE : 2
@@ -11,6 +13,13 @@
PRANKSTER_SWAGGER_CLAUSE : 10
PBV_500 : 11
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 = [
@Conditions.VISIBLE_TEAM
@@ -36,47 +45,81 @@
UNRELEASED_BAN : "Unreleased Ban"
PRANKSTER_SWAGGER_CLAUSE : "Prankster + Swagger Clause"
@Formats =
self.PresetFormats =
insur1000:
humanName: 'Insurgence 1000'
generation: 'in'
conditions: [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW ]
name : 'insur1000'
humanName : 'Insurgence 1000'
generation : 'in'
conditions : [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW ]
playable : true
priority : 5
tierBased : false
xy1000:
humanName: '1,000 PBV XY'
generation: 'xy'
conditions: [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW ]
name : 'xy1000'
humanName : '1,000 PBV XY'
generation : 'xy'
conditions : [ @Conditions.PBV_1000, @Conditions.TEAM_PREVIEW ]
playable : true
priority : 10
tierBased : false
xy500:
humanName: '500 PBV XY'
generation: 'xy'
conditions: [ @Conditions.PBV_500, @Conditions.TEAM_PREVIEW ]
name : 'xy500'
humanName : '500 PBV XY'
generation : 'xy'
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

94
shared/tier.coffee Normal file
View File

@@ -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