poke-gql: a new Pokemon API

I'm very excited to announce the completion of two projects I've been working on the past couple months:

1. A MySQL database containing a bunch of Pokemon data (e.g. abilities, moves, Pokemon) and relationships between them.
2. A GraphQL API for querying the data in this database.

First let me say that I can't really afford to host these myself, and I haven't implemented security features in the API (i.e. controlling how much users can query it), so it's not yet ready to deploy. However, virtually all of the data is there, and you can run them on your own machine by following the instructions here and here. In a month or so I'll look into how I can host it affordably so that this set-up isn't necessary.

What's a GraphQL API?

Many of you have probably used REST APIs in your apps. PokeAPI is one example. The downside of REST APIs is that you don't have much control over the data that gets sent once you make a query. Let's say your program needs to know what type Gengar is. If you make the query https://pokeapi.co/api/v2/pokemon/gengar, you get a .json file which contains that information, but it also contains all the other information on Gengar.

A GraphQL API is like a REST API in that it allows your app to fetch data, but it is based on the GraphQL language (Graph Query Language), which allows you to be very specific in which information you get. To get the typing of Gengar, we'd just run:

example4.png


Now we (or our app) get only the information we need. But we can go further with GraphQL. What if we want to know the defense matchups of Gengar's type (i.e. how does it handle other attacking types)? Our query is "Get the Types that Gengar has, and for each of those Types look up their Type matchups." We can add just a few more lines to get that (I've added some limit arguments to fit the result on screen):

example5.png


You can nest your queries as deep as you like, and query as many fields as you like. Thus, for any relationship you could think of, you can query it: which abilities resist the water type, and which Pokemon have those abilities? Ask:

example6.png


Below I've linked some sources where you can learn the basics of the language so that you can write your own queries. Before that though, here are some other examples:

Examples

Let's say you wanted to know (for some reason...)
  • Abilities that start with "l"
  • The names of these abilities
  • Which Pokemon introduced after Generation 4 can have these abilities, and which ability slot the ability occupies on those Pokemon
  • Whether any of these abilities resist elemental Types, and by what factor
Then you can ask the API (I added some limit arguments so it fits on one screen):

example1.png


But doesn't lightning rod resist electric type attacks? Notice that I asked for 'generation: 4' at the top. Let's change that argument to 'generation: 5' (I also change a 'limit' argument to make it fit):

example2.png


See? now the resistance shows up (lower right)!

One more example: Let's say we're making a "fun" meme team, and we want to know how to raise our secondary effect chance. Then we can ask how to do that:
  • Which abilities modify secondary effect chance?
  • Which field states (terrains, weathers, entry hazards, etc.) modify secondary effect chance?
example3.png


(You can also ask which items and moves modify secondary effect chance, of course). So we know that we'll need Serene Grace, and Water Pledge and Fire Pledge (the API doesn't at the moment represent the fact that you need to use those moves TOGETHER in the API). Also, you can ask how many abilities modify secondary effect chance (it's 3, but I chose the fetch limit to be 2 to fit it all on my screen). On the beautiful day that GameFreak adds more secondary effect chance-boosting abilities, you can find them here.

How I made it

This project has two components: the MySQL database, and the GraphQL API which queries it. I posted the links to the GitHub repositories at the top. In both repos, I have several READMEs explaining what each piece of the code does.

The first repo, poke-db is all about inserting the data into a MySQL database so that the API can query it. For the data, I scraped most of it from hundreds of Bulbapedia pages and tables using Python (I copied the two learnset.js files on the Pokemon Showdown repo for the Pokemon learnsets instead of scraping them). Then I did a couple steps of processing using Python and then Javascript (those are the two languages I know...) before inserting it into the database. The src/data folder has a lot of .csv and .json files, which you're free to use as well. However, you need a MySQL database to really represent all the relationships between everything.

The second repo, poke-gql is where I write the code for the GraphQL API that actually queries the database. This sets up the actual server (I use Apollo Server) where you can query the API by going to http://localhost:4000/ (this is where I took my screenshots).

How to use it

Like I said at the top, I don't think I can deploy this myself for awhile. I'm currently looking for a job, so I don't have a stable income (but I'm doing OK, don't worry about me) and don't think I can take on the hosting costs right now. I also just need to research how to host projects like this. I'm relatively new to web development, so I haven't done my research on where to host my projects yet.

I wrote instructions on how to set it up on your own machine in each of the repositories. Unfortunately, you also need to have MySQL installed. However, you don't need to perform any MySQL queries yourself, except a 'CREATE DATABASE' to make an empty database to put the data into.

If you were to get it all running on your machine, then you could use something like Apollo Client to use the API in your own apps. You're free to fork this project for that purpose, but please let me know if you do so. I'd like to know that someone's using my API! In addition to the GraphQL docs, there's also this site, which has a pretty good tutorial on how to use GraphQL. I've used the 'graphql-node' tutorial on there, and I'm planning on doing the 'React + Apollo' track in a couple weeks before I start working on my own app for this API (coming soon...). Just be aware that this tutorial was created by Prisma, a tech company whose product is used heavily in the tutorial. It's an ORM (basically a tool to help you work with databases), which seems pretty good from my brief experience with it in the tutorial, but I didn't use it in this project, and there are a lot of other ORMs out there you may want to research before using it. It's still a good tutorial, but just keep in mind that you don't need to use Prisma to use GraphQL, and that the main reason it's in the tutorial instead of another ORM is because it's the commercial product of the authors of the tutorial.

Closing

Thank you for reading. I'm going to take a 2-week break from this project for the holidays. I'll be pretty busy after that (gotta start getting ready for job interviews), so I won't be able to make any major changes to it. However, if you notice any incorrect data, like a move having the wrong power or something (which there almost certainly is), or any other bugs, please let me know; I'll fix them when I can.

In the future, I'd like to try and get another data source than scraping from Bulbapedia. A lot of the data is in tables, and the code to scrape the data is really dependent on the shape of those tables. Anytime they change the layout of the table, then, I'd probably have to change the code to scrape the data if I want to get new data again. On the other hand, whenever a new generation comes out, assuming the table formats stay generally the same, I could just run all the code again with very little modification and get all the new data (though I'd probably need to write a couple new scripts and modify some others if new mechanics are introduced).
 
Last edited:
Hi guys, I have some exciting updates: I've been working the past 2 weeks on a teambuilder app which uses this API on the backend to fetch all the data. I still need a few weeks to put in all the features I want, but I thought I'd show what I have so far here to raise interest. Once I have more features added, I'll post it in its own thread.

There will be three main parts to this app:
  • Planner: what I'll talk about in more detail.
  • Builder: build your team with an interface similar to Pokemon Showdown. The main difference is that you can add Pokemon to a 'shopping cart' in the Planner section, and you can then choose Pokemon from your Cart in the Builder section. More on this below.
  • Analyzer: analyze various things about your team (type resistances, which common Pokemon in a given tier outspeed and/or OHKO which members)--these are more tentative ideas that I have, as I'm not sure yet how quickly the pkmn/sets package could handle the calculations I have in mind. It seems to run very well for the tier filtering I've been using though.
Here are some grainy screenshots. Obviously, much of the formatting isn't even close to done, but hopefully I can get across all the features that this already has.

Searchable list of moves, as well as Pokemon that learn those moves. Generation and Tier filters. Team-in-progress at the top.


Here's a basic view of the planner: here we're in the 'Moves' tab, and we're searching for moves that start with 'ac'. This search runs on the poke-gql. (I plan to add more search filters later.) You can see that we can control the gen at the top, and we also get a preview of the team we're currently working on. At the bottom, you can see I've selected some Pokemon who learn 'Acrobatics'. I could add them to the aforementioned Cart (not functional yet--that's next week), I can open up the 'Builder' tab and see these Pokemon in the Cart with a label like 'Learns acrobatics'.

Basic view of planner, now searching abilities. Gen and tier filter have changed from previous picture.


Here's another basic view, but notice how I've changed the gen slider, as well as the tier filters. Keep in mind that these filters not only change which moves/abilities/etc. show up in the search. They also influence which Pokemon show up in the search. If I were to deselect 'OU' and 'UUBL', Mega Pinsir and Mega Salamence wouldn't show up anymore. Right now, 'Aftermath' doesn't have any Pokemon in the selected tiers that possess it--I'll change the buttons to a message like 'No Pokemon in these tiers have this Ability' or something like that later. Here I've selected Mega Pinsir and Mega Salemence in the Aerilate row to add to my cart.

Searching field states (weather effects like rain, as well as terrains, screens, and so on).


Now I've clicked the 'Field States' tab and I'm looking up field states. You can see weather effects, terrains, screens and so on here. What happens if I click the 'Rain' link?

Generated information page on the rain weather effect. Four accordions with information on how rain interacts with other mechanics (like abilities, moves, etc.).


poke-gql looks up a lot of information on the 'rain' field state. You can see four accordions here. Let's open up the 'Ability' one.

Opened up Ability accordion. We can see which abilities create rain, and also which abilities benefit from rain.

Another view of the 'Ability' accordion. You can see which abilities either prevent rain from being set up, or remove it entirely.


OK, bear with me because there's a lot of stuff here. Basically, this accordion shows all the ways in which abilities interact with rain. There are several subsections, as you can see in the two above images. To help make things a bit clearer, I color coded the subsections: a green section roughly means that the ability interacts positively with rain--sets it up like 'Drizzle', or gets activated by it like 'Swift Swim'. In the first image, you can see I've selected all the Pokemon in the green rows. I can add these to my Cart, since I'm interested in making a Rain team. Once I program it, when I open up the Cart in the Builder, they'll have a note along the lines of 'creates rain', 'ability activated by rain'. If instead you want to counter rain, you can see some options in the red sections. For example, you could set up your own weather with 'Drought', or you could prevent rain from being set up in the first place with 'Cloud Nine'.

Again on the 'rain' page, but this time with the move accordion opened. You can see which moves create rain, as well as which moves are enhanced by rain, and so on.


Now I've opened up the 'Move' accordion, still on the rain page. Here you can see, in particular, which moves are benefited/hindered by rain being up. You may notice that some of the rows have missing buttons. That's because the row visually cuts off when there's too much content in it. If you hover over the actual row, it'll expand and you can see all the Pokemon, as well as the buttons.

By the way, you can see multiple forms of Vivillon in the 'Hurricane' row. poke-gql has all the Pokemon forms, and I've classified them ('ALOLA', 'GALAR', 'COSMETIC', 'MEGA', 'OTHER', etc.). In the final version of the app, when it runs the Pokemon query here, it'll filter out cosmetic forms so that there's less clutter in the rows. If I can pull it off, I intend to let people select their cosmetic forms in the 'Builder' section.

OK, hopefully by this point you get the idea. Here's a few more screenshots to show what else you can look up. You can look up usage methods like 'dance', 'pulse', etc.:

Moves which have the 'dance' usage method, and hence activate the ability 'Dancer'.

Moves which have the 'pulse' usage method, and hence activate 'Mega Launcher'.


Notice in the 'Mega Launcher' row in the second image that it lists the multiplier applied to pulse moves. Here's a page for the 'evasion' stat...

Page for the 'evasion' stat, showing which abilities boost evasion.


...and here's a page for the 'bad poison' (toxic) status:

Screenshot of page for the status 'bad poison' (toxic). It shows field state and item interactions.


I hope all of this makes sense! I conceived this project a few months ago, but I found that the kind of data I wanted to display wasn't easily accessible via an API. That's what I hope to change with poke-gql. As I'm working on this app, I'm finding small bugs in the API, as well as new features I wanted to add to the API. Whenever possible, I'll try not to make any breaking changes to the API (though I'm not sure if anyone else is using it right now, and it's not even public, so...). Also, I've noticed every now and then a few errors in the data that I scraped and hard-coded in poke-db. Every weekend I'm taking a couple hours to rectify these errors, but I apologize for these errors if you're already using either the API or the raw data itself. Whenever I make commits to GitHub I try to describe what I fixed.

Anyways, thanks so much for reading. Like I said, it's going to take at least a month to get everything working/deployed on the web. I very much hope, however, that this is something for you all to look forward to!
 
Hi all, another update. While there aren't too many new features per se, these past couple weeks I've done a lot of formatting and worked on a lot of components that I'll be using throughout the app (dropdowns, buttons, etc.). The visual theme is "Bill's PC", and I took some inspiration from the UI in the Gen 1 games in a couple places. There's still some rough edges in these screenshots of course, but this is what I'm planning on for the aesthetic. (The background green is supposed to be the light of the PC lol)

In the weeks leading up to Legends Arceus I was pretty worried that it would shake up the competitive scene so much that the way I organized the API wouldn't be relevant, but it seems that for right now it's kind of it's own thing. That being said, I'll still have to keep in mind things like the BD/SP and Sw/Sh split in the future. For now, the app let's you toggle between the two modes when you're looking at Gen 8 (or you can turn them off to let in all Pokemon, e.g. National Dex meta). You can see the switch at the top, and see how the Pokemon who learn 'Absorb' change, and how 'Accelerock' disappears.

Basic view of the Planner. Gen 8, Sword/Shield mode.

Basic view of the Planner, Brilliant Diamond/Shining Pearl mode.


As mentioned before, you can also filter by Smogon Tier, but obviously it's styled now. In the image below, you can see I have Doubles mode enabled, and I've deselected some of the tiers. Also, I changed the Gen to 6.

Tier filter with Doubles mode enabled.


As you may have noticed, you can also filter by Type and by Base Stats. In this image I'll tweak the type and stat filters. Here's what the Stat Filter looks like (ranges are min/max base stats):

Stat filter with minimum base speed set to 112. Only Accelgor remains on-screen.


Notice how when there's no more Pokemon in a row, it'll tell you the reason why there aren't any Pokemon. Looks like only Accelgor's left. Let's take a look at the team now (top). Now, I've just implemented this stuff today, but you can add to and remove from the team. If you select Accelgor, you get to choose whether to add him to an empty slot, or replace a previous Pokemon with Accelgor. As you might expect, you can also remove Pokemon by clicking on the 'X' (you get a couple seconds to undo before they're gone). In the second image, I've removed Kabutops.

Accelgor is selected, ready to be added to team.


Accelgor has been added to the team. Kabutops is being removed.


The 'Planner' tab is mainly for selecting groups of Pokemon, which you'll later choose from in the 'Builder' section though, so the team view is just there as a reminder for what your team currently looks like. Below, I'm selecting all the Pokemon who have the ability 'Swift Swim' to 'Save to Box'. This is the 'Cart' idea I talked about in the last post, but it's more fitting with the theme to call it a 'Box', I think.

Pokemon who learn Swift Swim are all selected, to be saved to a box.


Okay, that's all the relatively polished stuff I have for now. For the next couple weeks I'm going to work on the 'Builder' section. My idea is that one will be able to combine the boxes they save from the Planner section into their own custom boxes. If you look at the eyesore below, you can see from the text at the top that I've saved two boxes from the planner: Pokemon who learn 'Hydro Pump', and Pokemon with 'Swift Swim' (in Gen 6, mind you), and then I've made a new box by intersecting/AND'ing them together. This will give you a new box, which you can then intersect/AND together with other boxes (see the 'Intersect' button at the bottom). You'll also be able to union/OR boxes, and you'll be able to rename them as well.

Custom box, which is the intersection of two boxes: 'Hydro Pump' and 'Swift Swim'.


Also in the Builder tab, you'll have a more standard team building interface like the one on Pokemon Showdown (haven't started yet). It'll have pretty similar functionality (the six Pokemon icons at the top were inspired by it), but now you'll have your boxes on the other side of the screen and be able to easily put Pokemon from the boxes into your team.

That's all I have now. Look forward to more updates soon!
 
Hi everyone, another update. This week I implemented the combining boxes feature. Let me show you what it looks like. As usual, not all the styling is there, but it's getting there!

Let's say you want to make a sun team, and you want a sun sweeper. You could start by going to the 'Sun' page (process should be familiar by now if you've read previous posts):

Selecting sun page


(Also, I wrote a program where I can just put in the icon text and colors, and it'll spit out a Gen 5-style icon, so that's where these icons are from.) On the sun page, you can select Pokemon with the two sun-sweeping abilities: Chlorophyll and Solar Power:

Saving Pokemon who have Chlorophyll
Saving Pokemon who have Solar Power


Now that they're saved, we can go to the 'Builder' -> 'Cart' (or 'PC', if you prefer) tab:

Opening cart view to see saved boxes. Starting combo with Solar Power


In this tab, you can see the boxes you've saved so far. This is where we're going to combine our boxes to make custom boxes, which will be stored in the 'Custom' tab. You can start by pressing the 'COMBO' button on one of the boxes. This will start the combo.

Adding Chlorophyll to combo, Solar Power OR Chlorophyll


Once you start the 'COMBO', you can add on other boxes using 'AND'/'OR'. I want Pokemon who can be Sun sweepers, and in this case that means they have either Solar Power OR Chlorophyll. You can add on as many boxes as you like, and when they're in the terminal on the right, you can press the little icons to modify the combo (switch AND/OR, move up/down, remove), or you can change the options on the left. Keep in mind that it'll execute from top to bottom only, i.e. there are no 'parentheses' for grouping. I'll show how to get around that in a moment. Now that my combo is ready, I'll hit the big green 'COMBO' button.

Combo button pressed, naming combo


Now it's asking me to submit a name for this combination before it makes the new box. Once I enter that and hit 'SUBMIT', we get...

Combo box created. We can create new combos with this box, or pin/star it for the team building tab.


Our new box (appearance not final). Now we can use this box to make new combos. Also, you'll be able to PIN/'star' any of these boxes for access in the 'Team' tab (to be implemented).

Now, let's do one more combination. As you know, Sun makes Fire moves stronger, and it removes the charging turn from Solar Beam/Solar Blade. Let's say I want to find Pokemon with one of these abilities, and which learns one of these moves. In other words:

(Chlorophyll OR Solar Power) AND (Fire Blast OR Solar Beam OR Solar Blade)

Let's get those moves first:

Saving Fire Blast

Saving Solar Blade/Solar Beam


Now, I can make a box for Pokemon who learn one of these three moves:

OR combo with three moves.


Finally, we'll AND together our two custom boxes. Note that this is essentially who you get around there being no parentheses: combine the smaller groups first, and then combine the results of those combinations afterwards.

Combining the two custom boxes with an AND.


Note also that you can filter these boxes by tier, type, etc., just like in the 'Planner' section. Once you have the desired combination, you can PIN the box, so you can refer to it while team building.

Final screen, filtering and pinning new custom box.


Thanks for reading, everyone. I'll be back with another update soon. That one will be about the 'Team' tab, where you actually build your team, like in Pokemon Showdown.
 
Hi everyone, another update.

I've pretty much completed the 'Builder' tab. I've added two things since the last post: a teambuilder similar in function to PokemonShowdown, and a place where you can quickly search for individual Pokemon, sorting alphabetically/by base stats, and filtering by type/base stats/tier. Here's a quick picture of what that Pokemon searching looks like:

Quick search, where you can filter and sort Pokemon by various criteria, and save them to a box.


You can save these Pokemon to a box called 'From Quick Search', which will be accessible in the teambuilder (below). It's a bit laggy (half second delay) to filter and sort when there's several hundred Pokemon (I'll think about how to address this), but once it gets down to about a hundred or so Pokemon through filtering (at the top of the screen as usual), it's fine.

Basic view of team builder. Boxes from cart on the right. Teambuilder UI on the left


Here's a look at the team builder interface. On the right you can see boxes saved from the cart/PC (see last post). If you end up preferring the teambuilder in PokemonShowdown, you will be able to import/export your team to/from this app, so you can use other features without interacting with this teambuilder (e.g. in the 'Analyzer' tab). I thought it would be fitting to have this in the app however, so that if you want to use all the features without importing, you can make a team here.

Here are some other screens in the team builder. You may notice the size/layout changes a bit between screenshots. Between screenshots I'm changing the size of the browser window slightly. It may seem small, but when designing these things one always needs to keep in mind how it'll look on different screens. I don't think it looking good on mobile is possible (that would require an entirely new layout), but I'm aiming to have it look decent on any desktop/laptop monitor.

Searching abilities on the right

Searching items. Searches operate similar to showdown (hit Enter to select first row)


You can see that the interface is pretty similar to that on PokemonShowdown in that you can do a lot of the team building with a keyboard. The searches on the right function similarly in that you can narrow your searches via name, and then hit 'Enter' to select the first row (highlighted). You can also use your mouse to select any row you like. For move searches, you can sort by things like type, power, etc.

Move search on right, can order by type, power, etc.


Finally, here's what choosing EVs/IVs/nature looks like:

Choosing EVs
Choosing Nature


You can see the Hidden Power type and power there as well.


I added a couple more features, which I'm not sure whether they're present in the PokemonShowdown teambuilder. Namely, you can select cosmetic forms for Pokemon, if available, and also the UI will highlight which moves are event-only (e.g. Ancient Power Bulbasaur in Gen 2):

Selecting cosmetic forms for Vivillon

UI will highlight event-only moves in red and put an 'E' after the move.


That's what I have to show for now. I've also spent some time on changing the API a bit, as well as adding more filtering options to the Planner tab (the latter isn't properly formatted yet).

My current goal is to have this project released by the end of March. The last main tab I have to finish is the 'Analyzer' tab, which I think will take a couple weeks. During/after that, I'll investigate where and how to host my app (it's a bit complicated because I need to have it connect to the API as well, so I need to privately deploy the API somewhere too), and I'll add various polishes to the things that already exist.

Thanks for reading!
 
Hi everyone, another update.

This time I've been working on the Analyzer section. But first, I also added import/export functionality!

Importing entire team using PokePaste format

Exporting team.


As you can see, you can import/export an entire team at once using the usual PokePaste format.

Now, onto the Analyzer. I've settled on two functions that I currently want for the section: 'Coverage' and 'Versus'. Let's start with Coverage:

Starting view of Coverage tab. Team on left, tables on right.


The app looks at your current team, and lays out a bunch of tables. What are these tables? From left-to-right, top-to-bottom, the tables deal with type matchups, statuses, speed control, and field states (weather, hazards, terrain specifically). The largest table is the type matchup table. It lists your defensive and offensive type matchups (in that order). The numbers represent the number of Pokemon corresponding to that cell. When I hover over the 'Ground' cell in the left-hand '0x' column, corresponding to your team's type immunities, it highlights three Pokemon (hence the number 3 in the cell).

For each of these cell values, it gives a color ranking how 'good' that value is for your team. Three immunities to a type is quite strong, so the value is in green.

Notice that Heatran is considered to have a ground immunity since it's holding an Air Balloon--because of this, it highlights his item as well, since that is what's contributing to his type immunity. If you were to hover over the water immunity cell, Gastrodon would be lit up, as well as its Storm Drain ability.

Hovering over cell in defensive type matchup table, highlighting the relevant Pokemon for that cell.


The offensive matchup table--on the right half--is a bit complicated. For each Pokemon on your team, it computes the maximum effectiveness of your Pokemon's moves against each type. So when I hover over the cell in the '2x' (super effective) column and the 'Ground' row, which has a value of 2, it highlights the two Pokemon on my team which possess damaging moves which are super effective against ground (it ignores moves whose type varies, as well as status moves). It highlights those moves as well. Note that Gastrodon has two moves which are super effective against ground, but the app doesn't double count.

The '2' is in yellow rather than green; my rankings are subjective of course; you should use them more as a guide. For example, in each of the cells with an orange (bad) value, you may have something else on your team that compensates for that. The color is mainly just to bring your attention to potential issues, rather than suggest any fix.

Hovering over a cell in the offensive matchup table, highlighting the Pokemon relevant to that cell, as well as the moves.


Here's a view of the other three tables. The '+' and '-' represent sources/resistances, respectively (where resistance could mean removing the status/weather/etc., or mitigating it in some way). Like with the type matchup table, when you hover over a table cell, it highlights the relevant Pokemon, moves, etc.

Status table, 3 sources of burn


Speed control table, 1 form of speed control (Body Slam--not really the best speed control...)


One source of weather: Sand Stream.


One way to resist hazards: Air Ballooon (resists spikes)


Again, take these numbers with a grain of salt. I use 30% as the threshold for a move being a viable source of a status--so Scald is a viable source of Burn, but not Flamethrower.

Also, I include reliably causing Paralysis as a form of speed control, but 'reliable' is up to interpretation. I would recommend not using Body Slam as your only form of speed control...

As for the field state table, note that Sand Stream removes other weathers as well, so that's why the team has a 1 in the '-' column as well.



Okay, that's enough for the Coverage section. Onto the Versus section. This is where you can see how your team stacks up against other Pokemon. Here I've put an enemy Gliscor on the right, and in the middle you can see how my team fares against this Gliscor.

Basic view of versus matchup table, with my team against one enemy Pokemon.


Here's what's going on in each cell of the table:
  • The first row, 'U', represents your team member (leftmost column) against the enemy member (topmost row). The 6 stands for '6HKO', and the 'P' stands for 'Possible', i.e. not guaranteed. This is determined as follows:
    • Use each of your Pokemon's moves against the enemy, and find the move(s) which knock out the opponent in the fewest number of hits. This number of hits is the number.
    • If one of the moves is guaranteed to knock out the opponent, use a 'G' for 'Guaranteed'.
    • Among these selected moves, keep track of the highest priority for the next step.
  • The third row is the same, but from the perspective of the enemy against you.
  • The second row has a green, yellow, or red symbol indicating which Pokemon goes first. Green indicates you move first, yellow indicates a speed tie, and red indicates the opponent moves first. This is determined as follows:
    • Look at the highest priority of the your most powerful move(s) from the first row, as well as the highest priority of the enemy's most powerful from the third row. If these priorities differ, whoever has the highest priority wins.
    • Otherwise, the priorities are equal, so determine who wins based on the two Pokemon's speed stats.
    • It's possible that, say, your Pokemon actually has a higher-priority move that is not as powerful. I can't think of a convenient way to include that information, so for now it's not included. As usual, take the displayed results with a grain of salt.
The damage/KO ranges are determined using the official Pokemon Showdown Damage Calculator at @smogon/calc. Now, you may notice there are other columns. That's because you can import an entire enemy team using the lower import button (below the second nav bar). This again uses the PokePaste format.

Also, I use this information to highlight the cell a color from 'red' (worst for you) to 'blue' (best for you). This takes into account the above three results. For example, the Magnezone cell is highlighted red because, even though he can 2HKO the Gliscor, the Gliscor is faster and can OHKO him. The Heatran is in green because he can 2HKO Gliscor, while it takes Gliscor 10+ hits to kill him with Acrobatics. Of course, he could actually kill Heatran in two hits by using Acrobatics followed by Earthquake, so you still have to think about the matchups. As with the coverage section, the rating system I use is subjective.

When you hover over a cell, it highlights the relevant moves (described in the list above), just like in the Coverage section. If you hover over a Pokemon's icon, it highlights the entire row (or column), as well as the relevant moves of all the Pokemon on the team opposite the highlighted Pokemon (images below if that wording is confusing...)

Overview of my team against the enemy team. Hovering over a cell gives more information, e.g. the exact results from the damage calculator.


Hovering over your Gliscor highlights the entire row, each of the moves he should use in one or more matchups, and the move(s) that the enemy should use against your Gliscor.


Similarly, hovering over the enemy's Tyranitar highlights his column, the move(s) he should use in each matchup against you, and the move(s) each of your Pokemon should use against him.


Finally, there's also a stat view: if you click on the toggle at the top (says 'normal' currently, but that will probably be changed), it'll show all the Pokemon's stats and natures. This brings me to the other main feature of this: you can tweak each of the Pokemon's abilities/items/moves and the table will update in response. Currently, you can change the nature too, but I haven't implemented changing the individual IVs/EVs (I'll do that tomorrow). For now, I'm going to change the nature of my Magnezone from Modest to Timid. Keep an eye on his row...

Changing nature from Modest to Timid.


Changing Magnezone's nature to Timid affects several matchups, which are highlighted for a few seconds in the table.


Changing my Magnezone's nature from Modest to Timid does the following:
  • It now outspeeds the enemy Gliscor, so his matchup is slightly better (if he hits Gliscor on the switch-in, he can outspeed and get a 2HKO).
  • It now outspeeds the enemy's Magnezone, which has a Modest nature, but it still gets a guaranteed 3HKO like before. The matchup favors my Magnezone now.
  • It can now only 5HKO the enemy Gastrodon rather than 4HKO, but that doesn't really matter since that matchup was bad for Magnezone anyway.

That's all for this update! Once I implement changing stats on this page, the last thing I want to add is the ability to change field states using some menu at the top. After that, I'll have all the features I currently want in the app. If there's a lot of demand for other features, I may consider adding more things to the Analyzer section in the future, but I want to end the list of features here for now. I've already spent two and a half months on this project.

After finishing all the features, the last few things I want to do are:
  • Polish a lot of formatting things.
  • Add/fix whatever missing things/bugs there are.
  • Make the app more accessible for keyboard/screen-reader users (mainly managing focus and making sure that all relevant information can be reached by keyboard). I'm still relatively inexperienced, but I'll do my best in the remaining time to make it so that as many people as possible can enjoy the app.
  • Deploy the app, which also requires deploying the GraphQL API (remember the original post in this thread?)
My goal is to have a beta online by the end of March. I'm proud of what I've accomplished with the app, but I want to limit its main development to three months. After that, I'll keep an eye on it in case anyone finds any bugs/glaring omissions, but I won't have much more time to dedicate to it at that point.

Thank you for reading, as always!
 
It's ALIVE. Check out the release thread here. I appreciate everyone who's been following along. While I don't plan on any significant changes to the GraphQL API or the database in the near future, feel free to post any feedback/comments on those either here or in the release thread.
 
It's ALIVE. Check out the release thread here. I appreciate everyone who's been following along. While I don't plan on any significant changes to the GraphQL API or the database in the near future, feel free to post any feedback/comments on those either here or in the release thread.
Hey I wanted to ask you some information about this I am web dev working on a site and wanted to know if we could share some information. Please let me know and I can give you my contact info.
 

Users Who Are Viewing This Thread (Users: 1, Guests: 0)

Top