mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-03-21 17:50:29 -05:00
Fix misc bugs in Gen 8 migration
This commit is contained in:
parent
0b579df638
commit
cfd29205d5
|
|
@ -28,13 +28,7 @@ function updateLearnsets(callback) {
|
|||
const alphabetize = (a, b) => a.localeCompare(b);
|
||||
const getLsetGen = lset => lset.charAt(0);
|
||||
|
||||
const padNumString = function (str) {
|
||||
switch (str.length) {
|
||||
case 1: return '00' + str;
|
||||
case 2: return '0' + str;
|
||||
case 3: return '' + str;
|
||||
}
|
||||
};
|
||||
const padNumString = str => str.padStart(3, '0');
|
||||
const inLearnset = function (lset, learnset) {
|
||||
const secondChar = lset.charAt(1);
|
||||
if (secondChar !== 'L') return learnset.indexOf(lset) >= 0;
|
||||
|
|
@ -105,7 +99,7 @@ function updateLearnsets(callback) {
|
|||
if (!newLearnset[moveid]) newLearnset[moveid] = [];
|
||||
newLearnset[moveid] = newLearnset[moveid].map(formatLset);
|
||||
for (let i = 0, len = fullLearnset[moveid].length; i < len; i++) {
|
||||
if (getLsetGen(fullLearnset[moveid][i]) !== '7') continue;
|
||||
if (getLsetGen(fullLearnset[moveid][i]) !== '8') continue;
|
||||
if (inLearnset(fullLearnset[moveid][i], newLearnset[moveid])) continue;
|
||||
newLearnset[moveid].push(formatLset(fullLearnset[moveid][i]));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1052,7 +1052,7 @@ class Move implements Effect {
|
|||
readonly desc: string;
|
||||
readonly shortDesc: string;
|
||||
readonly isViable: boolean;
|
||||
readonly isNonstandard: boolean;
|
||||
readonly isNonstandard: string | null;
|
||||
readonly isZ: ID;
|
||||
readonly zMovePower: number;
|
||||
readonly zMoveEffect: string;
|
||||
|
|
@ -1087,7 +1087,7 @@ class Move implements Effect {
|
|||
this.desc = data.desc;
|
||||
this.shortDesc = data.shortDesc;
|
||||
this.isViable = !!data.isViable;
|
||||
this.isNonstandard = !!data.isNonstandard;
|
||||
this.isNonstandard = data.isNonstandard || null;
|
||||
this.isZ = data.isZ || '';
|
||||
this.zMovePower = data.zMovePower || 0;
|
||||
this.zMoveEffect = data.zMoveEffect || '';
|
||||
|
|
@ -1141,7 +1141,11 @@ class Ability implements Effect {
|
|||
this.shortDesc = data.shortDesc || data.desc || '';
|
||||
this.desc = data.desc || data.shortDesc || '';
|
||||
if (!this.gen) {
|
||||
if (this.num >= 165) {
|
||||
if (this.num >= 234) {
|
||||
this.gen = 8;
|
||||
} else if (this.num >= 192) {
|
||||
this.gen = 7;
|
||||
} else if (this.num >= 165) {
|
||||
this.gen = 6;
|
||||
} else if (this.num >= 124) {
|
||||
this.gen = 5;
|
||||
|
|
@ -1201,9 +1205,10 @@ class Template implements Effect {
|
|||
readonly tier: string;
|
||||
readonly isTotem: boolean;
|
||||
readonly isMega: boolean;
|
||||
readonly isGigantamax: boolean;
|
||||
readonly isPrimal: boolean;
|
||||
readonly battleOnly: boolean;
|
||||
readonly isNonstandard: boolean;
|
||||
readonly isNonstandard: string | null;
|
||||
readonly unreleasedHidden: boolean;
|
||||
|
||||
constructor(id: ID, name: string, data: any) {
|
||||
|
|
@ -1278,12 +1283,17 @@ class Template implements Effect {
|
|||
|
||||
this.isTotem = false;
|
||||
this.isMega = false;
|
||||
this.isGigantamax = !!(this.forme && this.forme.endsWith('Gmax'));
|
||||
this.isPrimal = false;
|
||||
this.battleOnly = !!data.battleOnly;
|
||||
this.isNonstandard = !!data.isNonstandard;
|
||||
this.isNonstandard = data.isNonstandard || null;
|
||||
this.unreleasedHidden = !!data.unreleasedHidden;
|
||||
if (!this.gen) {
|
||||
if (this.forme && ['-mega', '-megax', '-megay'].includes(this.formeid)) {
|
||||
if (this.num >= 810 || this.forme === 'Galar' || this.isGigantamax) {
|
||||
this.gen = 8;
|
||||
} else if (this.num >= 722 || this.formeid === '-alola' || this.formeid === '-starter') {
|
||||
this.gen = 7;
|
||||
} else if (this.forme && ['-mega', '-megax', '-megay'].includes(this.formeid)) {
|
||||
this.gen = 6;
|
||||
this.isMega = true;
|
||||
this.battleOnly = true;
|
||||
|
|
@ -1294,10 +1304,6 @@ class Template implements Effect {
|
|||
} else if (this.formeid === '-totem' || this.formeid === '-alolatotem') {
|
||||
this.gen = 7;
|
||||
this.isTotem = true;
|
||||
} else if (this.formeid === '-alola' || this.formeid === '-starter') {
|
||||
this.gen = 7;
|
||||
} else if (this.num >= 722) {
|
||||
this.gen = 7;
|
||||
} else if (this.num >= 650) {
|
||||
this.gen = 6;
|
||||
} else if (this.num >= 494) {
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ const Dex = new class implements ModdedDex {
|
|||
|
||||
/** @deprecated */
|
||||
getTier(pokemon: Template, gen = 7, isDoubles = false): string {
|
||||
if (gen < 7) pokemon = this.forGen(gen).getTemplate(pokemon.id);
|
||||
if (gen < 8) pokemon = this.forGen(gen).getTemplate(pokemon.id);
|
||||
if (!isDoubles) return pokemon.tier;
|
||||
let table = window.BattleTeambuilderTable;
|
||||
if (table && table[`gen${this.gen}doubles`]) {
|
||||
|
|
@ -717,7 +717,7 @@ const Dex = new class implements ModdedDex {
|
|||
if (pokemon.species && !spriteid) {
|
||||
spriteid = template.spriteid || toID(pokemon.species);
|
||||
}
|
||||
if (Dex.getTemplate(pokemon.species).exists === false) {
|
||||
if (template.exists === false) {
|
||||
return 'background-image:url(' + Dex.resourcePrefix + 'sprites/gen5/0.png);background-position:10px 5px;background-repeat:no-repeat';
|
||||
}
|
||||
let shiny = (pokemon.shiny ? '-shiny' : '');
|
||||
|
|
@ -737,6 +737,7 @@ const Dex = new class implements ModdedDex {
|
|||
let xydexExists = !template.isNonstandard || [
|
||||
"pikachustarter", "eeveestarter", "meltan", "melmetal", "fidgit", "stratagem", "tomohawk", "mollux", "crucibelle", "crucibellemega", "kerfluffle", "pajantom", "jumbao", "caribolt", "smokomodo", "snaelstrom", "equilibra", "scratchet", "pluffle", "smogecko", "pokestarufo", "pokestarufo2", "pokestarbrycenman", "pokestarmt", "pokestarmt2", "pokestargiant", "pokestarhumanoid", "pokestarmonster", "pokestarf00", "pokestarf002", "pokestarspirit",
|
||||
].includes(template.id);
|
||||
if (template.gen === 8) xydexExists = false;
|
||||
if ((!gen || gen >= 6) && xydexExists && !Dex.prefs('bwgfx')) {
|
||||
let offset = '-2px -3px';
|
||||
if (template.gen >= 7) offset = '-6px -7px';
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user