@@ -5,6 +5,7 @@ const { GAMEDATA2, GAMEDATA3, GAMEDATAV, MovesTable } = require('../../__gamedat
55const { getMoveProperties } = require ( '../pokedex-data-plugin/dex/moves' ) ;
66const { normalizePokemonName } = require ( '../pokedex-data-plugin/dex/name' ) ;
77const { getTypeName } = require ( '../pokedex-data-plugin/dex/types' ) ;
8+ const { Z_MOVES } = require ( '../pokedex-data-plugin/dex/moveConstants' ) ;
89
910/**
1011 * @param {{path: string, routeBasePath: string, moveComponent: string, moveListComponent: string, wrapperComponent: string} } options
@@ -27,13 +28,27 @@ function moveDexDataPlugin(context, options) {
2728 const moves3 = MovesTable [ GAMEDATA3 ] . Waza . slice ( 1 ) . map (
2829 ( move ) => getMoveProperties ( move . wazaNo , GAMEDATA3 , true )
2930 ) ;
30- const movesList3 = moves3 . map ( ( m ) => ( {
31- ...m ,
32- id : m . moveId ,
33- name : m . name ,
34- type : m . type ,
35- typeName : getTypeName ( m . type ) ,
36- } ) ) ;
31+
32+ const firstZMoveMap = Object . fromEntries ( Z_MOVES . map ( z => [ z , 0 ] ) ) ;
33+
34+ const movesList3 = moves3
35+ . filter ( m => {
36+ if ( ! Z_MOVES . includes ( m . movePath ) ) return true ;
37+
38+ if ( firstZMoveMap [ m . movePath ] === 0 ) {
39+ firstZMoveMap [ m . movePath ] = 1 ;
40+ return true ; // keep first
41+ }
42+
43+ return false ; // skip duplicates
44+ } )
45+ . map ( m => ( {
46+ ...m ,
47+ id : m . moveId ,
48+ name : m . name ,
49+ type : m . type ,
50+ typeName : getTypeName ( m . type ) ,
51+ } ) ) ;
3752
3853 return {
3954 movesV,
@@ -57,23 +72,32 @@ function moveDexDataPlugin(context, options) {
5772 } ;
5873
5974 const moveRoutes = [ ] ;
75+ const zMoveMap = { } ;
76+ for ( const item of Z_MOVES ) {
77+ zMoveMap [ item ] = 0 ;
78+ }
6079 await Promise . all (
6180 content . moves3 . map ( async ( move3 ) => {
62- const moveName = normalizePokemonName ( move3 . name , GAMEDATA3 ) ;
63- const movePath = `${ moveDexPath } /${ moveName } ` ;
81+ if ( Z_MOVES . includes ( move3 . movePath ) ) {
82+ if ( zMoveMap [ move3 . movePath ] === 1 ) {
83+ return
84+ }
85+ zMoveMap [ move3 . movePath ] += 1
86+ }
87+ const movePath = `${ moveDexPath } /${ move3 . movePath } ` ;
6488
65- const moveJson3 = await actions . createData ( `3.0lumi${ moveName } .json` , JSON . stringify ( move3 ) ) ;
89+ const moveJson3 = await actions . createData ( `3.0lumi- ${ move3 . movePath } .json` , JSON . stringify ( move3 ) ) ;
6690 let moveJson2 = null ;
6791 let moveJsonV = null ;
6892
6993 const move2 = content . moves2 . find ( ( m2 ) => m2 . name === move3 . name ) ;
7094 if ( move2 ) {
71- moveJson2 = await actions . createData ( `2.0lumi${ moveName } .json` , JSON . stringify ( move2 ) ) ;
95+ moveJson2 = await actions . createData ( `2.0lumi- ${ move3 . movePath } .json` , JSON . stringify ( move2 ) ) ;
7296 }
7397
7498 const moveV = content . movesV . find ( ( mV ) => mV . name === move3 . name ) ;
7599 if ( moveV ) {
76- moveJsonV = await actions . createData ( `VanilaBDSP${ moveName } .json` , JSON . stringify ( moveV ) ) ;
100+ moveJsonV = await actions . createData ( `VanilaBDSP- ${ move3 . movePath } .json` , JSON . stringify ( moveV ) ) ;
77101 }
78102
79103 moveRoutes . push ( {
0 commit comments