-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f76462e
commit 25d915c
Showing
4 changed files
with
119 additions
and
11 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { PokemonData } from 'pokemon-species-data' | ||
import { RadicalRedToNationalDexMap } from '../src/types/SAVTypes/radicalred/conversion/RadicalRedSpeciesMap' | ||
import { TransferRestrictions } from '../src/types/TransferRestrictions' | ||
|
||
const RR_TRANSFER_RESTRICTIONS: TransferRestrictions = { | ||
excludedForms: {}, | ||
} | ||
|
||
const supportedFormsMap: Record<number, Set<number>> = {} | ||
|
||
for (const [key, mapEntry] of Object.entries(RadicalRedToNationalDexMap)) { | ||
if (!mapEntry || !mapEntry.NationalDexIndex) continue | ||
|
||
const dexNum = mapEntry.NationalDexIndex | ||
const formIndex = mapEntry.FormIndex | ||
|
||
if (!supportedFormsMap[dexNum]) { | ||
supportedFormsMap[dexNum] = new Set() | ||
} | ||
supportedFormsMap[dexNum].add(formIndex) | ||
} | ||
|
||
for (const [key, mapEntry] of Object.entries(RadicalRedToNationalDexMap)) { | ||
if (!mapEntry || !mapEntry.NationalDexIndex) continue | ||
|
||
const dexNum = mapEntry.NationalDexIndex | ||
|
||
const dbEntry = PokemonData[dexNum] | ||
|
||
if (dbEntry) { | ||
const allForms = dbEntry.formes.map((forme) => forme.formeNumber) | ||
|
||
const supportedForms = supportedFormsMap[dexNum] || new Set() | ||
const unsupportedForms = allForms.filter((formeNumber) => !supportedForms.has(formeNumber)) | ||
|
||
if (unsupportedForms.length > 0) { | ||
// Not necessary but TS was giving me a warning. | ||
if (!RR_TRANSFER_RESTRICTIONS.excludedForms) { | ||
RR_TRANSFER_RESTRICTIONS.excludedForms = {} | ||
} | ||
RR_TRANSFER_RESTRICTIONS.excludedForms[dexNum] = unsupportedForms | ||
} | ||
} | ||
} | ||
|
||
console.log(RR_TRANSFER_RESTRICTIONS) |
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
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
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