Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions graphql/enums.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ enum AbilitiesEnum {
disguise
download
dragonsmaw
dragonize
drizzle
drought
dryskin
Expand Down Expand Up @@ -141,6 +142,7 @@ enum AbilitiesEnum {
magnetpull
marvelscale
megalauncher
megasol
merciless
mimicry
mindseye
Expand Down Expand Up @@ -174,6 +176,7 @@ enum AbilitiesEnum {
persistent
pickpocket
pickup
piercingdrill
pixilate
plus
poisonheal
Expand Down Expand Up @@ -243,6 +246,7 @@ enum AbilitiesEnum {
soulheart
soundproof
speedboost
spicyspray
stakeout
stall
stalwart
Expand Down
24 changes: 24 additions & 0 deletions graphql/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,9 @@ type Move {

"The power this move will have when used with its Z-move equivalent"
zMovePower: Int!

"The Champions specific data for a move"
champions: MoveChampions
}

"The type matchups for any one or two given types"
Expand Down Expand Up @@ -517,3 +520,24 @@ type Nature {
"The flavor of food the nature dislikes"
dislikedFlavor: String
}

"Pokémon Champions specific data about a move"
type MoveChampions {
"The base power for a move"
basePower: String

"The accuracy for a move"
accuracy: Int

"The long description for a move"
desc: String

"The short description for a move"
shortDesc: String

"The type for a move"
type: String

"The power points for a move"
pp: Int
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,22 @@ const { MovesText } = await importFileFromWeb<{ MovesText: { [moveName: string]:
temporaryFileName: 'moves-texts.js'
});

const { Moves: MovesChampions } = await importFileFromWeb<{ Moves: { [moveName: string]: MoveDataChampions } }>({
url: 'https://raw.githubusercontent.com/smogon/pokemon-showdown/refs/heads/master/data/mods/champions/moves.ts',
temporaryFileName: 'moves-champions.js'
});

const movesDataEntries = Object.entries<MoveData>(Moves);
const movesTextEntries = Object.entries<MoveText>(MovesText);
const movesChampionsEntries = Object.entries<MoveData>(MovesChampions);

const newMap = new Map();

for (const [key, data] of currentMoves.entries()) {
Reflect.deleteProperty(data, 'key');

const moveFromData = movesDataEntries.find(([moveKey]) => moveKey === key)?.at(1) as MoveData | undefined;
const moveFromChampions = movesChampionsEntries.find(([moveChampionsKey]) => moveChampionsKey === key)?.at(1) as MoveDataChampions | undefined;
const moveFromText = movesTextEntries.find(([moveTextKey]) => moveTextKey === key)?.at(1) as MoveText | undefined;

if (moveFromData) {
Expand Down Expand Up @@ -58,6 +65,38 @@ for (const [key, data] of currentMoves.entries()) {
data.contestType = moveFromData.contestType;
}

if (moveFromChampions) {
if (!data.champions) {
data.champions = {};
}

if (moveFromChampions.accuracy === true) {
data.champions.accuracy = 100;
} else if (moveFromChampions.accuracy) {
data.champions.accuracy = moveFromChampions.accuracy;
}

if (moveFromChampions.desc) {
data.champions.desc = replacePokeWithAccentedPoke(moveFromChampions.desc);
}

if (moveFromChampions.shortDesc) {
data.champions.shortDesc = replacePokeWithAccentedPoke(moveFromChampions.shortDesc);
}

if (moveFromChampions.type) {
data.champions.type = moveFromChampions.type;
}

if (moveFromChampions.pp) {
data.champions.pp = moveFromChampions.pp;
}

if (Object.keys(data.champions).length === 0) {
Reflect.deleteProperty(data, 'champions');
}
}

data.category = moveFromData.category;
data.pp = moveFromData.pp;
data.priority = moveFromData.priority;
Expand Down Expand Up @@ -176,3 +215,8 @@ interface MoveText {
desc: string;
shortDesc?: string;
}

interface MoveDataChampions extends MoveData {
desc?: string;
shortDesc?: string;
}
10 changes: 10 additions & 0 deletions scripts/manual-tests/get-all-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@
target
type
zMovePower
champions
}

fragment ChampionsMoveFragment on Move {
basePower
accuracy
desc
shortDesc
type
pp
}

fragment LearnsetMoveFragment on LearnsetMove {
Expand Down
10 changes: 10 additions & 0 deletions src/defaultDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,16 @@ fragment MoveFragment on Move {
target
type
zMovePower
champions
}

fragment ChampionsMoveFragment on Move {
basePower
accuracy
desc
shortDesc
type
pp
}

fragment LearnsetMoveFragment on LearnsetMove {
Expand Down
Loading
Loading