Last active
March 23, 2022 21:57
-
-
Save GriffinLedingham/1b43ac2dec7d84318efbf670edb139c7 to your computer and use it in GitHub Desktop.
Utilize Pikalytics' data (generated via https://github.com/GriffinLedingham/smogon-usage-parser) to crunch type usage percentages in the VGC meta. As requested by: https://www.reddit.com/r/PokemonVGC/comments/fxw4w5/type_frequency_analyzer/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Move = require('./Git/damage-calc/calc/dist/move')['Move']; | |
const data = require('./Git/pikalytics/server/data_json/2020-03/moveset/ss-1760.json'); | |
const rankData = require('./Git/pikalytics/server/data_json/2020-03/ss-1760.json'); | |
const monTypes = {}; | |
const moveTypes = {} | |
for(let i in data) { | |
const pokemon = data[i] | |
const pokemonPercent = parseFloat(rankData[i]["Usage %"].replace('%', '')) | |
for(let j in pokemon.types) { | |
if(monTypes[pokemon.types[j]] === undefined) { | |
monTypes[pokemon.types[j]] = pokemonPercent/100 | |
} | |
else { | |
monTypes[pokemon.types[j]] += pokemonPercent/100 | |
} | |
} | |
for(let z in pokemon.moves) { | |
const move = pokemon.moves[z] | |
if(move.type === undefined) continue; | |
const moveData = new Move(8, move.move.trim()) | |
// Ignore defensive moves. Remove this line to include them. | |
if(moveData.bp <= 0 || moveData.type === undefined) continue; | |
if(moveTypes[move.type] === undefined) { | |
moveTypes[move.type] = pokemonPercent/100 * (parseFloat(move.percent)/100) | |
} | |
else { | |
moveTypes[move.type] += pokemonPercent/100 * (parseFloat(move.percent)/100) | |
} | |
} | |
} | |
let typeTotal = 0 | |
for(let k in monTypes) { | |
typeTotal += monTypes[k] | |
} | |
for(let l in monTypes) { | |
monTypes[l] = (monTypes[l] / typeTotal)*100 | |
} | |
console.log('Mon Types:') | |
console.log(monTypes) | |
let moveTotal = 0 | |
for(let p in moveTypes) { | |
moveTotal += moveTypes[p] | |
} | |
for(let m in moveTypes) { | |
moveTypes[m] = (moveTypes[m] / moveTotal)*100 | |
} | |
console.log('Move Types:') | |
console.log(moveTypes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment