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

@@ -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-message{display:table-cell;vertical-align:middle}
.team-pbv{font-size:.75em}
.team-tier{font-size:.75em}
.monospace{font-family:"Monaco",monospace}
abbr{border-bottom:1px dotted #333}
.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 .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 .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 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)}
@@ -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 .team-meta{font-size:.75em;text-align:right;margin-top:10px}
.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}
@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}

View File

@@ -272,6 +272,10 @@
}).call(this);
(function() {
var self, _base;
self = (typeof window !== "undefined" && window !== null ? (_base = window.PokeBattle).conditions != null ? _base.conditions : _base.conditions = {} : this);
this.Conditions = {
TEAM_PREVIEW: 1,
RATED_BATTLE: 2,
@@ -284,7 +288,14 @@
UNRELEASED_BAN: 9,
PRANKSTER_SWAGGER_CLAUSE: 10,
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];
@@ -304,65 +315,109 @@
}
};
this.Formats = {
self.PresetFormats = {
insur1000: {
name: 'insur1000',
humanName: 'Insurgence 1000',
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: {
name: 'xy1000',
humanName: '1,000 PBV 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: {
name: 'xy500',
humanName: '500 PBV 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.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
this.GenerationCondition = {
'in': {
conditionname: 'insur',
humanName: 'Insurgence'
}
};
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);
(function() {
@@ -934,6 +989,124 @@
}).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() {
var self;
@@ -1486,7 +1659,6 @@
learnset = learnableMoves(window.Generations, this.attributes, generation);
return _(learnset).map(function(moveName) {
var move;
console.log(moveName);
move = _(MoveData[moveName]).clone();
move['name'] = moveName;
return move;
@@ -1592,6 +1764,12 @@
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) {
var array;
array = _.clone(this.get('pp'));
@@ -1894,8 +2072,12 @@
this.sync = __bind(this.sync, this);
this.hasNonNullPokemon = __bind(this.hasNonNullPokemon, 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.getMaxPBV = __bind(this.getMaxPBV, this);
this.getTier = __bind(this.getTier, this);
this.getPBV = __bind(this.getPBV, this);
this.getFormat = __bind(this.getFormat, this);
this.clone = __bind(this.clone, this);
@@ -2003,12 +2185,13 @@
};
Team.prototype.getFormat = function() {
var format;
var allformats, format;
format = this.get('generation');
if (!(format in Formats)) {
allformats = window.PokeBattle.conditions.Formats();
if (!(format in allformats)) {
format = DEFAULT_FORMAT;
}
return Formats[format];
return allformats[format];
};
Team.prototype.getGeneration = function(generation) {
@@ -2025,6 +2208,13 @@
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() {
var conditions, _ref, _ref1;
conditions = this.getFormat().conditions;
@@ -2041,6 +2231,32 @@
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() {
return this.get('pokemon').where({
isNull: false
@@ -2161,13 +2377,14 @@
_.extend(Battle.prototype, PokeBattle.mixins.BattleProtocolParser);
Battle.prototype.initialize = function(attributes) {
var spectators;
var allformats, spectators;
this.updateQueue = [];
this.numActive = attributes.numActive, spectators = attributes.spectators;
if (!!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('turn', 0);
this.set('teams', [
@@ -2962,6 +3179,9 @@
BattleView.prototype.pokemonPopover = function($this, pokemon) {
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');
if (pokemon.has('item')) {
displayName += " @ " + (pokemon.get('item'));
@@ -5243,7 +5463,10 @@
this.renderMoves = __bind(this.renderMoves, this);
this.renderStats = __bind(this.renderStats, this);
this.renderNonStats = __bind(this.renderNonStats, this);
this.getTeam = __bind(this.getTeam, 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.renderPokemon = __bind(this.renderPokemon, this);
this.render = __bind(this.render, this);
@@ -5273,6 +5496,7 @@
this.changeShiny = __bind(this.changeShiny, this);
this.changeNickname = __bind(this.changeNickname, this);
this.changeSpecies = __bind(this.changeSpecies, this);
this.setTeamTier = __bind(this.setTeamTier, this);
this.setTeamPBV = __bind(this.setTeamPBV, this);
this.setPokemon = __bind(this.setPokemon, this);
this.setGeneration = __bind(this.setGeneration, this);
@@ -5325,14 +5549,15 @@
};
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);
};
PokemonEditView.prototype.changeSort = function(e) {
var sort;
sort = $(e.currentTarget).val();
console.log(sort);
if (sort === "Default Sort") {
return this.sortSpecieslist("Default");
} else if (sort === "Sort by Dexnumber") {
@@ -5350,7 +5575,7 @@
var ItemData, MoveData, SpeciesData, data, sortedlist, species, _ref;
_ref = this.generation, MoveData = _ref.MoveData, SpeciesData = _ref.SpeciesData, ItemData = _ref.ItemData;
if (option === "Default") {
sortedlist = this.getSpecies;
sortedlist = this.getSpecies();
} else {
sortedlist = this.sortObject(SpeciesData, option, reverse);
}
@@ -5430,6 +5655,10 @@
return this.teamPBV = pbv;
};
PokemonEditView.prototype.setTeamTier = function(tier) {
return this.teamTier = tier;
};
PokemonEditView.prototype.changeSpecies = function(e) {
var species;
if (!this.onPokemonChange) {
@@ -5756,11 +5985,19 @@
render: {
option: (function(_this) {
return function(item, escape) {
var pbv;
pbv = PokeBattle.PBV.determinePBV(_this.generation, {
species: item.value
});
return "<div class='clearfix'>" + item.text + "<div class='pbv'>" + pbv + "</div></div>";
var pbv, team, tier;
team = _this.pokemon.getTeam();
if (team.hasPBV()) {
pbv = PokeBattle.PBV.determinePBV(_this.generation, {
species: item.value
});
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)
}
@@ -5775,7 +6012,7 @@
this.renderNonStats();
this.renderStats();
this.renderMoves();
this.renderPBV();
this.renderFormat();
$elements = this.$el.find("input, select").not(".species input, .species select");
$elements.prop("disabled", this.pokemon.isNull);
setSelectizeDisabled($elements, this.pokemon.isNull);
@@ -5785,13 +6022,35 @@
PokemonEditView.prototype.renderPBV = function() {
var individualPBV, maxPBV, pbv, team;
individualPBV = this.pokemon.getPBV();
this.$(".individual-pbv").text(individualPBV);
this.$(".individual-format").text(individualPBV);
team = this.pokemon.getTeam();
pbv = team.getPBV();
maxPBV = team.getMaxPBV();
this.$(".total-format").text(pbv).toggleClass("red", pbv > 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()) {
pbv = team.getPBV();
maxPBV = team.getMaxPBV();
this.$(".total-pbv").text(pbv).toggleClass("red", pbv > maxPBV);
return this.$(".max-pbv").text(maxPBV);
return this.renderPBV();
} else if (team && team.hasTier()) {
return this.renderTier();
}
};
@@ -5811,6 +6070,10 @@
})(this));
};
PokemonEditView.prototype.getTeam = function() {
return this.pokemon.getTeam();
};
PokemonEditView.prototype.renderNonStats = function() {
var $nonStats, displayedGenders, populateSelect;
$nonStats = this.$el.find(".non-stats");
@@ -5941,6 +6204,7 @@
this.validateImportedTeam = __bind(this.validateImportedTeam, this);
this.renderImportTeamModal = __bind(this.renderImportTeamModal, this);
this.renderFormat = __bind(this.renderFormat, this);
this.renderTier = __bind(this.renderTier, this);
this.renderPBV = __bind(this.renderPBV, this);
this.renderPokemon = __bind(this.renderPokemon, this);
this.renderPokemonList = __bind(this.renderPokemonList, this);
@@ -6029,7 +6293,7 @@
var team;
team = _this.getSelectedTeam();
team.replace(_this.selectedPokemon, newPokemon);
return _this.renderPBV();
return _this.renderTier();
};
})(this)
});
@@ -6067,7 +6331,7 @@
};
})(this)));
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;
};
@@ -6176,10 +6440,18 @@
};
TeambuilderView.prototype.changeTeamFormat = function(e) {
var $link, format, team;
var $link, format, realformat, team;
$link = $(e.currentTarget);
format = $link.data('format');
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')) {
team.set('generation', format);
this.renderTeam();
@@ -6251,7 +6523,8 @@
TeambuilderView.prototype.render = function() {
this.$el.html(this.template({
pokemon: this.getSelectedTeam(),
selected: this.selectedPokemon
selected: this.selectedPokemon,
window: window
}));
return this.renderTeams();
};
@@ -6311,10 +6584,21 @@
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() {
var format, text;
var allformats, format, text;
allformats = window.PokeBattle.conditions.Formats();
format = this.getSelectedTeam().get("generation");
if (!(format in Formats)) {
if (!(format in allformats)) {
format = DEFAULT_FORMAT;
}
text = this.$(".change-format-dropdown a[data-format='" + format + "']").text();

File diff suppressed because one or more lines are too long

View File

@@ -272,6 +272,10 @@
}).call(this);
(function() {
var self, _base;
self = (typeof window !== "undefined" && window !== null ? (_base = window.PokeBattle).conditions != null ? _base.conditions : _base.conditions = {} : this);
this.Conditions = {
TEAM_PREVIEW: 1,
RATED_BATTLE: 2,
@@ -284,7 +288,14 @@
UNRELEASED_BAN: 9,
PRANKSTER_SWAGGER_CLAUSE: 10,
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];
@@ -304,65 +315,109 @@
}
};
this.Formats = {
self.PresetFormats = {
insur1000: {
name: 'insur1000',
humanName: 'Insurgence 1000',
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: {
name: 'xy1000',
humanName: '1,000 PBV 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: {
name: 'xy500',
humanName: '500 PBV 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.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
this.GenerationCondition = {
'in': {
conditionname: 'insur',
humanName: 'Insurgence'
}
};
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);
(function() {
@@ -934,6 +989,124 @@
}).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() {
var self;
@@ -1486,7 +1659,6 @@
learnset = learnableMoves(window.Generations, this.attributes, generation);
return _(learnset).map(function(moveName) {
var move;
console.log(moveName);
move = _(MoveData[moveName]).clone();
move['name'] = moveName;
return move;
@@ -1592,6 +1764,12 @@
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) {
var array;
array = _.clone(this.get('pp'));
@@ -1894,8 +2072,12 @@
this.sync = __bind(this.sync, this);
this.hasNonNullPokemon = __bind(this.hasNonNullPokemon, 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.getMaxPBV = __bind(this.getMaxPBV, this);
this.getTier = __bind(this.getTier, this);
this.getPBV = __bind(this.getPBV, this);
this.getFormat = __bind(this.getFormat, this);
this.clone = __bind(this.clone, this);
@@ -2003,12 +2185,13 @@
};
Team.prototype.getFormat = function() {
var format;
var allformats, format;
format = this.get('generation');
if (!(format in Formats)) {
allformats = window.PokeBattle.conditions.Formats();
if (!(format in allformats)) {
format = DEFAULT_FORMAT;
}
return Formats[format];
return allformats[format];
};
Team.prototype.getGeneration = function(generation) {
@@ -2025,6 +2208,13 @@
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() {
var conditions, _ref, _ref1;
conditions = this.getFormat().conditions;
@@ -2041,6 +2231,32 @@
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() {
return this.get('pokemon').where({
isNull: false
@@ -2161,13 +2377,14 @@
_.extend(Battle.prototype, PokeBattle.mixins.BattleProtocolParser);
Battle.prototype.initialize = function(attributes) {
var spectators;
var allformats, spectators;
this.updateQueue = [];
this.numActive = attributes.numActive, spectators = attributes.spectators;
if (!!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('turn', 0);
this.set('teams', [
@@ -2688,6 +2905,9 @@
BattleView.prototype.pokemonPopover = function($this, pokemon) {
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');
if (pokemon.has('item')) {
displayName += " @ " + (pokemon.get('item'));

View File

@@ -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
/**/) {
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
;(function(){
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>");
}
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\">");
// iterate team.get('pokemon').models
;(function(){
@@ -718,7 +755,32 @@ buf.push("</div>");;return buf.join("");
this["JST"]["teambuilder/main"] = function anonymous(locals
/**/) {
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
@@ -784,7 +846,7 @@ buf.push("<option" + (jade.attrs({ 'value':(species) }, {"value":true})) + ">" +
}
}).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
;(function(){
var $$obj = itemList;
@@ -862,7 +924,15 @@ buf.push("<em class=\"name\">Empty</em>");
}
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>");
}
@@ -881,7 +951,15 @@ buf.push("<em class=\"name\">Empty</em>");
}
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>");
}