TeamLumi / luminescent-team

GNU Affero General Public License v3.0
12 stars 5 forks source link

Working Evolution Pathfinding #62

Closed AarCon closed 1 year ago

AarCon commented 1 year ago

In order to call this, initialize it into a constant with:

const evolutions = evolutionPathfinding()

Then you can get the specific pokemon's objects by calling it like this:

console.log(evolutions['133']) //Eevee's PokemonID as an example

This will return the pokemon's data in an object:

{
  path: [
    133, 470, 471, 135, 134, 136, 700, 196, 197
  ],
  method: [
    8,  8, 26, 27, 8, 8, 8, 29,  2,  3, 8, 8, 8
  ],
  ar: [
    [
        8, 85, 470, 0, 0,   
        8, 849, 471, 0, 0,  
        26, 0, 470, 0, 0,  
        27, 0, 471, 0, 0,   
        8, 83, 135, 0, 0,   
        8, 84, 134, 0, 0,   
        8, 82, 136, 0, 0,  
        29, 17, 700, 0, 0,   
        2, 0, 196, 0, 0,   
        3, 0, 197, 0, 0,   
        8, 107, 700, 0, 0,   
        8, 80, 196, 0, 0,
        8, 81, 197, 0, 0
    ],
    [],
    [],
    [],
    [],
    [],
    [],
    [],
    []
  ],
  targets: [
    470, 471, 135, 134, 136, 700, 196, 197
  ]
}

The path is the evolution path that is required for the pokemon. The method is ordered in the same way as path and details what method is used to evolve the original pokemon. The ar is the raw info from the EvolveTable.json and can be largely ignored. The targets is for every pokemon that the initial pokemon (Eevee) can evolve into the next stage. On the first form of a pokemon the targets will only show the next stage evolution. For example, Charmander will only target Charmeleon and Charmeleon will only target Charizard. Or in the Eevee example, it will evolve into all of the eeveelutions.

Additionally, here is an example of Pikachu which has a different final evolution depending on the evolution method:

{
    "25": {
        "path": [
            172, 25, 26, 1044
        ],
        "method": [
            8, 8
        ],
        "ar": [
        [
            8, 83, 26, 0, 0, 
            8, 80, 26, 1, 0
        ], 
        [], 
        []
        ],
        "targets": [26, 1044],
    },
}

Because this is a second evolution, it only shows the targets as the very next evolution as the PokemonID NOT the monsNo.

Denmark14 commented 1 year ago

Also apparently this PR broke a test?

AarCon commented 1 year ago

The test was broken before I got to it. It's the form images that aren't returning properly and I didn't touch those at all.