Skip to content

Commit

Permalink
Fix past gen stat calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibo committed Jan 30, 2023
1 parent b560c7f commit 709d002
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion extension/chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 3,
"name": "Pokémon Showdown Randbats Tooltip",
"description": "Enhanced tooltip functionality for Pokémon Showdown Random Battle formats.",
"version": "1.4.0",
"version": "1.4.1",
"icons": {
"16": "/16x16.png",
"32": "/32x32.png",
Expand Down
2 changes: 1 addition & 1 deletion extension/firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "Pokémon Showdown Randbats Tooltip",
"description": "Enhanced tooltip functionality for Pokémon Showdown Random Battle formats.",
"version": "1.4.0",
"version": "1.4.1",
"icons": {
"16": "/16x16.png",
"32": "/32x32.png",
Expand Down
11 changes: 6 additions & 5 deletions extension/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if (TOOLTIP) {
for (var name in json) {
var pokemon = json[name];
data[pokemon.level] = data[pokemon.level] || {};
// Dex.forGen not important here because we're not looking at stats
var species = Dex.species.get(name);
var id = toID(species.forme === 'Gmax'
? species.baseSpecies
Expand All @@ -52,16 +53,16 @@ if (TOOLTIP) {
var format = toID(this.battle.tier);
if (!format || !format.includes('random')) return original;

var species = Dex.species.get(
var gen = Number(format.charAt(3));
var letsgo = format.includes('letsgo');
var gameType = this.battle.gameType;

var species = Dex.forGen(gen).species.get(
clientPokemon.volatiles.formechange
? clientPokemon.volatiles.formechange[1]
: clientPokemon.speciesForme);
if (!species) return original;

var gen = Number(format.charAt(3));
var letsgo = format.includes('letsgo');
var gameType = this.battle.gameType;

if (!['singles', 'doubles'].includes(gameType)) {
format = 'gen' + gen + 'randomdoublesbattle';
} else if (format.includes('monotype') || format.includes('unrated')) {
Expand Down

0 comments on commit 709d002

Please sign in to comment.