Skip to content

Commit

Permalink
Merge pull request #26 from Rezzo64/main
Browse files Browse the repository at this point in the history
December 17, 2023: Merge with PS
  • Loading branch information
Rezzo64 authored Dec 17, 2023
2 parents f62c895 + 6e65b6f commit 81e737f
Show file tree
Hide file tree
Showing 30 changed files with 292 additions and 457 deletions.
2 changes: 2 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
play.pokemonshowdown.com/src/battle-animations-moves.ts @KrisXV
play.pokemonshowdown.com/src/battle-animations.ts @KrisXV
14 changes: 11 additions & 3 deletions WEB-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ https://replay.pokemonshowdown.com/gen8doublesubers-1097585496.json

https://replay.pokemonshowdown.com/gen8doublesubers-1097585496.log

Getting a replay inputlog directly (only for formats where the team is autogenerated):

https://replay.pokemonshowdown.com/gen8randombattle-2005209836.inputlog

Replay logs and inputlogs are also available in the JSON, so the `.log` and `.inputlog` forms are provided only for convenience.

Also for convenience: scrolling down in the source code for the replay page. Obviously don't _scrape_ it, but `ctrl`+`u` is way faster than futzing with URLs if you just wanted to take a look at it.


Replay search
-------------
Expand All @@ -41,11 +49,11 @@ https://replay.pokemonshowdown.com/search.json?user=zarel&user2=yuyuko&format=ge

Paginate searches:

https://replay.pokemonshowdown.com/search.json?user=zarel&page=2
https://replay.pokemonshowdown.com/search.json?user=zarel&before=1372221987

Searches are limited to 51 results, and pages are offset by 50 each, so the existence of a 51st result means that there's at least one more page available.
Searches are limited to 51 results, and pages are offset by 50 each, so the existence of a 51st result means that there's at least one more page available. For the timestamp, use the uploadtime of the last replay in the list.

Pagination is not supported for the recent replays list, but is supported for everything else.
You can also use `page=[number]`, but this is an older API that is poorly supported and should not be relied upon.


Users (including ladder information)
Expand Down
85 changes: 68 additions & 17 deletions build-tools/build-indexes
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function buildSearchIndex() {
index = index.concat(Object.keys(Dex.data.TypeChart).map(x => toID(x) + ' type'));
index = index.concat(['physical', 'special', 'status'].map(x => toID(x) + ' category'));
index = index.concat(['monster', 'water1', 'bug', 'flying', 'field', 'fairy', 'grass', 'humanlike', 'water3', 'mineral', 'amorphous', 'water2', 'ditto', 'dragon', 'undiscovered'].map(x => toID(x) + ' egggroup'));
index = index.concat(['ou', 'uu', 'ru', 'nu', 'pu', 'lc', 'nfe', 'uber', 'uubl', 'rubl', 'nubl', 'publ', 'cap', 'caplc', 'capnfe'].map(x => toID(x) + ' tier'));
index = index.concat(['ou', 'uu', 'ru', 'nu', 'pu', 'zu', 'lc', 'nfe', 'uber', 'uubl', 'rubl', 'nubl', 'publ', 'zubl', 'cap', 'caplc', 'capnfe'].map(x => toID(x) + ' tier'));

let BattleArticleTitles = {};

Expand Down Expand Up @@ -400,7 +400,7 @@ function buildTeambuilderTables() {
const LC = GENS.map(num => num + 0.7);
const STADIUM = [2.04, 1.04];
const NATDEX = [9.1, 8.1];
const OTHER = [9.9, 9.41, 9.4, 9.2, -9.4, 8.6, 8.4, 8.2, 8.1, -8.4, -8.6, 7.1];
const OTHER = [9.9, 9.411, 9.41, 9.401, 9.4, 9.2, -9.4, -9.401, 8.6, 8.4, 8.2, 8.1, -8.4, -8.6, 7.1];

// process.stdout.write("\n ");
for (const genIdent of [...GENS, ...DOUBLES, ...VGC, ...NFE, ...STADIUM, ...OTHER, ...NATDEX, ...LC]) {
Expand All @@ -411,6 +411,7 @@ function buildTeambuilderTables() {
const isLC = ('' + genIdent).endsWith('.7');
const isSSDLC1 = (genIdent === 8.4 || genIdent === -8.4);
const isPreDLC = (genIdent === 9.4 || genIdent === 9.41 || genIdent === -9.4);
const isSVDLC1 = (genIdent === 9.401 || genIdent === 9.411 || genIdent === -9.401);
const isNatDex = ('' + genIdent).endsWith('.1') && genIdent > 8;
const isStadium = ('' + genIdent).endsWith('.04');
const isDoubles = (genIdent < 0);
Expand All @@ -423,6 +424,7 @@ function buildTeambuilderTables() {
if (isLetsGo) genStr += 'letsgo';
if (isBDSP) genStr += 'bdsp';
if (isPreDLC) genStr += 'predlc';
if (isSVDLC1) genStr += 'dlc1';
if (isStadium) genStr += 'stadium' + (genNum > 1 ? genNum : '');
return genStr;
})();
Expand All @@ -431,7 +433,7 @@ function buildTeambuilderTables() {
pokemon.sort();
const tierTable = {};
const overrideTier = {};
const zuBans = {};
const ubersUUBans = {};
const monotypeBans = {};
const nonstandardMoves = [];
for (const id of pokemon) {
Expand Down Expand Up @@ -521,7 +523,7 @@ function buildTeambuilderTables() {
if (isDoubles && genNum > 4) {
return species.doublesTier;
}
if (isNatDex || (isPreDLC && genNum === 9.41)) {
if (isNatDex || (isPreDLC && genNum === 9.41) || (isSVDLC1 && genNum === 9.411)) {
return species.natDexTier;
}
return species.tier;
Expand All @@ -542,10 +544,9 @@ function buildTeambuilderTables() {
tierTable[tier].push(id);

if (genNum === 9) {
const zu = Dex.formats.get(gen + 'zu');
if (zu.exists && Dex.formats.getRuleTable(zu).isBannedSpecies(species) &&
["(PU)", "NFE", "LC"].includes(species.tier)) {
zuBans[species.id] = 1;
const ubersUU = Dex.formats.get(gen + 'ubersuu');
if (ubersUU.exists && Dex.formats.getRuleTable(ubersUU).isBannedSpecies(species)) {
ubersUUBans[species.id] = 1;
}
const mono = Dex.formats.get(gen + (isNatDex ? 'nationaldex' : '') + 'monotype');
if (Dex.formats.getRuleTable(mono).isBannedSpecies(species)) {
Expand All @@ -555,7 +556,7 @@ function buildTeambuilderTables() {
}

nonstandardMoves.push(...Object.keys(Dex.data.Moves).filter(id => {
const move = Dex.mod(isSSDLC1 ? 'gen8dlc1' : 'gen9predlc').moves.get(id);
const move = Dex.mod(isSSDLC1 ? 'gen8dlc1' : isPreDLC ? 'gen9predlc' : 'gen9dlc1').moves.get(id);
const bMove = Dex.mod(isSSDLC1 ? 'gen8' : 'gen9').moves.get(id);
return bMove.isNonstandard !== move.isNonstandard;
}));
Expand All @@ -564,7 +565,7 @@ function buildTeambuilderTables() {
const items = [];
const formatSlices = {};

if (isNatDex || (isPreDLC && genNum === 9.41)) {
if (isNatDex || (isPreDLC && genNum === 9.41) || (isSVDLC1 && genNum === 9.411)) {
BattleTeambuilderTable['gen' + genNum + 'natdex'] = {};
BattleTeambuilderTable['gen' + genNum + 'natdex'].tiers = tiers;
BattleTeambuilderTable['gen' + genNum + 'natdex'].overrideTier = overrideTier;
Expand Down Expand Up @@ -618,7 +619,7 @@ function buildTeambuilderTables() {
BattleTeambuilderTable.tiers = tiers;
BattleTeambuilderTable.items = items;
BattleTeambuilderTable.overrideTier = overrideTier;
BattleTeambuilderTable.zuBans = zuBans;
BattleTeambuilderTable.ubersUUBans = ubersUUBans;
BattleTeambuilderTable.monotypeBans = monotypeBans;
BattleTeambuilderTable.formatSlices = formatSlices;
} else {
Expand All @@ -630,7 +631,7 @@ function buildTeambuilderTables() {
if (genNum >= 5) {
BattleTeambuilderTable[gen].monotypeBans = monotypeBans;
}
if (isSSDLC1 || isPreDLC) {
if (isSSDLC1 || isPreDLC || isSVDLC1) {
BattleTeambuilderTable[gen].nonstandardMoves = nonstandardMoves;
BattleTeambuilderTable[gen].learnsets = {};
}
Expand All @@ -646,13 +647,12 @@ function buildTeambuilderTables() {
if (gen === 'gen4') {
return ["CAP", "CAP NFE", "CAP LC", "AG", "Uber", "OU", "(OU)", "UUBL", "UU", "NUBL", "NU", "NFE", "LC"];
}
return ["CAP", "CAP NFE", "CAP LC", "AG", "Uber", "(Uber)", "OU", "(OU)", "UUBL", "UU", "RUBL", "RU", "NUBL", "NU", "PUBL", "PU", "ZUBL", "ZU", "(PU)", "New", "NFE", "LC", "Unreleased"];
return ["CAP", "CAP NFE", "CAP LC", "AG", "Uber", "(Uber)", "OU", "(OU)", "UUBL", "UU", "RUBL", "RU", "NUBL", "NU", "PUBL", "PU", "ZUBL", "ZU", "New", "NFE", "LC", "Unreleased"];
})();

for (const tier of tierOrder) {
if (tier in {OU:1, AG:1, Uber:1, UU:1, RU:1, NU:1, PU:1, ZU: 1, "(PU)":1, NFE:1, LC:1, DOU:1, DUU:1, "(DUU)":1, New:1, Legal:1, Regular:1, "Restricted Legendary":1, "CAP LC":1}) {
if (tier in {OU:1, AG:1, Uber:1, UU:1, RU:1, NU:1, PU:1, ZU: 1, NFE:1, LC:1, DOU:1, DUU:1, "(DUU)":1, New:1, Legal:1, Regular:1, "Restricted Legendary":1, "CAP LC":1}) {
let usedTier = tier;
if (usedTier === "(PU)" && genNum === 9) usedTier = "ZU";
if (usedTier === "(DUU)") usedTier = "DNU";
formatSlices[usedTier] = tiers.length;
}
Expand Down Expand Up @@ -694,8 +694,13 @@ function buildTeambuilderTables() {
}
if (item.isNonstandard && !isMetBattle) {
if (isNatDex) {
if (item.isNonstandard !== "Past") continue;
if (!item.itemUser && !item.zMove) continue;
let curItem = item;
let curGen = genNum;
while (item.isNonstandard && curGen >= 7) {
curItem = Dex.forGen(curGen).items.get(item.id);
curGen--;
}
if (curItem.isNonstandard) continue;
} else if (genNum !== 2) {
continue;
}
Expand Down Expand Up @@ -961,6 +966,52 @@ function buildTeambuilderTables() {
}
}
}
const SVDLC1Learnsets = Dex.mod('gen9dlc1').data.Learnsets;
for (const id in SVDLC1Learnsets) {
const learnset = SVDLC1Learnsets[id].learnset;
if (!learnset) continue;
BattleTeambuilderTable['gen9dlc1'].learnsets[id] = {};
for (const moveid in learnset) {
const gens = learnset[moveid].map(x => Number(x[0]));
const minGen = Math.min(...gens);

if (minGen <= 4 && (gen3HMs.has(moveid) || gen4HMs.has(moveid))) {
let legalGens = '';
let available = false;

if (minGen === 3) {
legalGens += '3';
available = true;
}
if (available) available = !gen3HMs.has(moveid);

if (available || gens.includes(4)) {
legalGens += '4';
available = true;
}
if (available) available = !gen4HMs.has(moveid);

let minUpperGen = available ? 5 : Math.min(
...gens.filter(gen => gen > 4)
);
legalGens += '0123456789'.slice(minUpperGen);
BattleTeambuilderTable['gen9dlc1'].learnsets[id][moveid] = legalGens;
} else {
BattleTeambuilderTable['gen9dlc1'].learnsets[id][moveid] = '0123456789'.slice(minGen);
}

if (gens.indexOf(6) >= 0) BattleTeambuilderTable['gen9dlc1'].learnsets[id][moveid] += 'p';
if (gens.indexOf(7) >= 0 && learnset[moveid].some(x => x[0] === '7' && x !== '7V')) {
BattleTeambuilderTable['gen9dlc1'].learnsets[id][moveid] += 'q';
}
if (gens.indexOf(8) >= 0 && learnset[moveid].some(x => x[0] === '8' && x !== '8V')) {
BattleTeambuilderTable['gen9dlc1'].learnsets[id][moveid] += 'g';
}
if (gens.indexOf(9) >= 0 && learnset[moveid].some(x => x[0] === '9' && x !== '9V')) {
BattleTeambuilderTable['gen9dlc1'].learnsets[id][moveid] += 'a';
}
}
}

// Client relevant data that should be overriden by past gens and mods
const overrideSpeciesKeys = ['abilities', 'baseStats', 'cosmeticFormes', 'isNonstandard', 'requiredItems', 'types', 'unreleasedHidden'];
Expand Down
2 changes: 1 addition & 1 deletion play.pokemonshowdown.com/crossdomain.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
?>
<!DOCTYPE html>
<meta charset="utf-8" />
<script src="/js/lib/jquery-2.1.4.min.js"></script>
<script src="/js/lib/jquery-2.2.4.min.js"></script>
<body>
<script>

Expand Down
2 changes: 1 addition & 1 deletion play.pokemonshowdown.com/crossprotocol.template.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!DOCTYPE html>
<meta charset="UTF-8" />
<script src="/js/lib/jquery-2.1.4.min.js"></script>
<script src="/js/lib/jquery-2.2.4.min.js"></script>
<script>

var yourOrigin = 'http://play.pokemonshowdown.com';
Expand Down
2 changes: 1 addition & 1 deletion play.pokemonshowdown.com/js/client-mainmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -1249,7 +1249,7 @@
this.selectType = data.selectType;
if (!this.selectType) this.selectType = (this.sourceEl.closest('form').data('search') ? 'search' : 'challenge');

var html = '<p><ul class="popupmenu"><li><input name="search" placeholder="Search formats" value="' + this.search + '" class="textbox" />';
var html = '<p><ul class="popupmenu"><li><input name="search" placeholder="Search formats" value="' + this.search + '" class="textbox autofocus" autocomplete="off" />';
html += '</li></ul></p><span name="formats">';
html += this.renderFormats();
html += '</span><div style="clear:left"></div><p></p>';
Expand Down
2 changes: 1 addition & 1 deletion play.pokemonshowdown.com/js/client-teambuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,7 @@

if (!formatSets) return;

var sets = $.extend({}, formatSets['dex'][species], formatSets['stats'][species]);
var sets = $.extend({}, formatSets['dex'][species], (formatSets['stats'] || {})[species]);

$setDiv.text('Sample sets: ');
for (var set in sets) {
Expand Down
4 changes: 0 additions & 4 deletions play.pokemonshowdown.com/js/lib/jquery-2.1.4.min.js

This file was deleted.

4 changes: 4 additions & 0 deletions play.pokemonshowdown.com/js/lib/jquery-2.2.4.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions play.pokemonshowdown.com/js/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
ru: "RU",
nu: "NU",
pu: "PU",
zu: "(PU)",
zu: "ZU",
nfe: "NFE",
lc: "LC",
cap: "CAP",
Expand All @@ -242,7 +242,8 @@
uubl: "UUBL",
rubl: "RUBL",
nubl: "NUBL",
publ: "PUBL"
publ: "PUBL",
zubl: "ZUBL"
};
var tier = {name: tierTable[id]};
return this.renderTierRow(tier, matchStart, matchLength, errorMessage);
Expand Down
2 changes: 1 addition & 1 deletion play.pokemonshowdown.com/preactalpha.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ <h3><button class="closebutton" tabindex="-1" aria-label="Close"><i class="fa fa
<script defer src="/js/panel-chat.js?"></script>

<script defer src="/js/battle-sound.js"></script>
<script defer src="/js/lib/jquery-2.1.4.min.js"></script>
<script defer src="/js/lib/jquery-2.2.4.min.js"></script>
<script defer src="/data/graphics.js?"></script>
<script defer src="/data/text.js?"></script>
<script defer src="/js/battle-tooltips.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion play.pokemonshowdown.com/recoverteams.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
exports = window;
if (location.protocol === 'https:') location.replace('http://play.pokemonshowdown.com/recoverteams.html')
</script>
<script src="//play.pokemonshowdown.com/js/lib/jquery-2.1.4.min.js"></script>
<script src="//play.pokemonshowdown.com/js/lib/jquery-2.2.4.min.js"></script>
<script src="//play.pokemonshowdown.com/data/pokedex.js?ca7cba96"></script>
<script src="//play.pokemonshowdown.com/data/moves.js?70de5a3d"></script>
<script src="//play.pokemonshowdown.com/data/items.js?1e79955f"></script>
Expand Down
3 changes: 2 additions & 1 deletion play.pokemonshowdown.com/src/battle-animations-moves.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16826,7 +16826,7 @@ export const BattleMoveAnims: AnimTable = {
},
syrupbomb: {
anim(scene, [attacker, defender]) {
const imageType = {filter: attacker.sp.shiny ? 'hue-rotate(-45deg)' : 'hue-rotate(30deg)'};
const imageType = {filter: !attacker.sp.shiny ? 'hue-rotate(-45deg)' : 'hue-rotate(30deg)'};
scene.showEffect('flareball', {
x: attacker.x,
y: attacker.y,
Expand Down Expand Up @@ -35887,6 +35887,7 @@ BattleMoveAnims['terablastpsychic'] = {anim: BattleMoveAnims['psychic'].anim};
BattleMoveAnims['terablastrock'] = {anim: BattleMoveAnims['powergem'].anim};
BattleMoveAnims['terablaststeel'] = {anim: BattleMoveAnims['flashcannon'].anim};
BattleMoveAnims['terablastwater'] = {anim: BattleMoveAnims['hydropump'].anim};
BattleMoveAnims['terablaststellar'] = {anim: BattleMoveAnims['dracometeor'].anim};
BattleMoveAnims['tidyup'] = {anim: BattleMoveAnims['bulkup'].anim};
BattleMoveAnims['trailblaze'] = {anim: BattleMoveAnims['powerwhip'].anim};
BattleMoveAnims['tripledive'] = {anim: BattleMoveAnims['dive'].anim};
Expand Down
1 change: 1 addition & 0 deletions play.pokemonshowdown.com/src/battle-animations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1813,6 +1813,7 @@ export class PokemonSprite extends Sprite {
magnetrise: ['Magnet Rise', 'good'],
smackdown: ['Smack Down', 'bad'],
focusenergy: ['Critical Hit Boost', 'good'],
dragoncheer: ['Critical Hit Boost', 'good'],
slowstart: ['Slow Start', 'bad'],
protosynthesisatk: ['Protosynthesis: Atk', 'good'],
protosynthesisdef: ['Protosynthesis: Def', 'good'],
Expand Down
Loading

0 comments on commit 81e737f

Please sign in to comment.