Fix misc Gen 8 issues

This commit is contained in:
Guangcong Luo 2019-12-13 05:57:04 -05:00
parent a8ca0da8f4
commit 683f95dade
4 changed files with 38 additions and 9 deletions

View File

@ -800,8 +800,8 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
const pastEntry = genData.Items[id];
const nextEntry = nextGenData.Items[id];
if (!nextEntry) continue; // amulet coin
if (pastEntry.desc !== nextEntry.desc) {
overrideItemDesc[id] = pastEntry.desc;
if ((pastEntry.shortDesc || pastEntry.desc) !== (nextEntry.shortDesc || nextEntry.desc)) {
overrideItemDesc[id] = (pastEntry.shortDesc || pastEntry.desc);
}
}
@ -811,8 +811,8 @@ process.stdout.write("Building `data/teambuilder-tables.js`... ");
const pastEntry = genData.Abilities[id];
const nextEntry = nextGenData.Abilities[id];
if (!nextEntry) continue; // amulet coin
if (pastEntry.desc !== nextEntry.desc) {
overrideAbilityDesc[id] = pastEntry.desc;
if ((pastEntry.shortDesc || pastEntry.desc) !== (nextEntry.shortDesc || nextEntry.desc)) {
overrideAbilityDesc[id] = (pastEntry.shortDesc || pastEntry.desc);
}
}
}

View File

@ -139,7 +139,7 @@ var ReplayPanel = Panels.StaticPanel.extend({
var replayid = this.$('input[name=replayid]').val();
var m = /^([a-z0-9]+)-[a-z0-9]+-[0-9]+$/.exec(replayid);
if (m && m[1] !== 'smogtours') {
this.battle.log('<hr /><div class="chat">This replay was uploaded from a third-party server (<code>' + Tools.escapeHTML(m[1]) + '</code>). It contains errors and cannot be viewed.</div><div class="chat">Replays uploaded from third-party servers can contain errors if the server is running custom code, or the server operator has otherwise incorrectly configured their server.</div>', true);
this.battle.log('<hr /><div class="chat">This replay was uploaded from a third-party server (<code>' + BattleLog.escapeHTML(m[1]) + '</code>). It contains errors and cannot be viewed.</div><div class="chat">Replays uploaded from third-party servers can contain errors if the server is running custom code, or the server operator has otherwise incorrectly configured their server.</div>', true);
this.battle.pause();
}
},
@ -149,7 +149,7 @@ var ReplayPanel = Panels.StaticPanel.extend({
if (!$battle.length) return;
this.battle = new Battle($battle, this.$('.battle-log'));
//this.battle.preloadCallback = updateProgress;
this.battle.errorCallback = this.errorCallback.bind(this);
// this.battle.errorCallback = this.errorCallback.bind(this);
this.battle.resumeButton = this.resume.bind(this);
this.battle.setQueue((this.$('script.log').text()||'').replace(/\\\//g,'/').split('\n'));

View File

@ -1119,6 +1119,7 @@ class Move implements Effect {
readonly ohko: true | 'Ice' | null;
readonly recoil: number[] | null;
readonly heal: number[] | null;
readonly multihit: number[] | number | null;
readonly hasCustomRecoil: boolean;
readonly noPPBoosts: boolean;
readonly secondaries: ReadonlyArray<any> | null;
@ -1154,6 +1155,7 @@ class Move implements Effect {
this.ohko = data.ohko || null;
this.recoil = data.recoil || null;
this.heal = data.heal || null;
this.multihit = data.multihit || null;
this.hasCustomRecoil = data.hasCustomRecoil || false;
this.noPPBoosts = data.noPPBoosts || false;
this.secondaries = data.secondaries || (data.secondary ? [data.secondary] : null);
@ -1194,6 +1196,33 @@ class Move implements Effect {
}
}
}
if (this.category !== 'Status' && !this.zMovePower) {
let basePower = this.basePower;
if (Array.isArray(this.multihit)) basePower *= 3;
if (!basePower) {
this.zMovePower = 100;
} else if (basePower >= 140) {
this.zMovePower = 200;
} else if (basePower >= 130) {
this.zMovePower = 195;
} else if (basePower >= 120) {
this.zMovePower = 190;
} else if (basePower >= 110) {
this.zMovePower = 185;
} else if (basePower >= 100) {
this.zMovePower = 180;
} else if (basePower >= 90) {
this.zMovePower = 175;
} else if (basePower >= 80) {
this.zMovePower = 160;
} else if (basePower >= 70) {
this.zMovePower = 140;
} else if (basePower >= 60) {
this.zMovePower = 120;
} else {
this.zMovePower = 100;
}
}
this.num = data.num || 0;
if (!this.gen) {

View File

@ -673,7 +673,7 @@ const Dex = new class implements ModdedDex {
num = BattlePokedex[id].num;
}
if (num < 0) num = 0;
if (num > 809) num = 0;
if (num > 890) num = 0;
if (window.BattlePokemonIconIndexes?.[id]) {
num = BattlePokemonIconIndexes[id];
@ -713,7 +713,7 @@ const Dex = new class implements ModdedDex {
let top = Math.floor(num / 12) * 30;
let left = (num % 12) * 40;
let fainted = (pokemon?.fainted ? `;opacity:.3;filter:grayscale(100%) brightness(.5)` : ``);
return `background:transparent url(${Dex.resourcePrefix}sprites/pokemonicons-sheet.png) no-repeat scroll -${left}px -${top}px${fainted}`;
return `background:transparent url(${Dex.resourcePrefix}sprites/pokemonicons-sheet.png?g8) no-repeat scroll -${left}px -${top}px${fainted}`;
}
getTeambuilderSprite(pokemon: any, gen: number = 0) {
@ -768,7 +768,7 @@ const Dex = new class implements ModdedDex {
let top = Math.floor(num / 16) * 24;
let left = (num % 16) * 24;
return 'background:transparent url(' + Dex.resourcePrefix + 'sprites/itemicons-sheet.png) no-repeat scroll -' + left + 'px -' + top + 'px';
return 'background:transparent url(' + Dex.resourcePrefix + 'sprites/itemicons-sheet.png?g8) no-repeat scroll -' + left + 'px -' + top + 'px';
}
getTypeIcon(type: string, b?: boolean) { // b is just for utilichart.js