Comments (4)
Pushed smogon/pokemon-showdown@8744ada upstream and did a bunch of work to add support for mods - gen7vgc2017
is now working.
import {Team} from '@pkmn/sets';
import {Dex, ID, ModData, TeamValidator, PokemonSet} from '@pkmn/sim';
(async () => {
const dex = Dex.mod('vgc17' as ID, await import('@pkmn/mods/vgc17') as ModData);
const validator = new TeamValidator('gen7vgc2017', dex);
console.log(validator.validateTeam(Team.import(`
Alakazam-Mega @ Alakazite
Ability: Magic Guard
EVs: 252 SpA / 4 SpD / 252 Spe
Timid Nature
IVs: 0 Atk
- Psychic
- Focus Blast
- Shadow Ball
- Recover
Tangrowth @ Assault Vest
Ability: Regenerator
EVs: 248 HP / 8 Def / 252 SpD
Sassy Nature
IVs: 30 Atk / 30 Def
- Giga Drain
- Knock Off
- Hidden Power [Ice]
- Earthquake
Gliscor @ Toxic Orb
Ability: Poison Heal
EVs: 244 HP / 152 SpD / 112 Spe
Jolly Nature
- Stealth Rock
- Earthquake
- Toxic
- Roost
Magnezone @ Choice Specs
Ability: Magnet Pull
EVs: 252 SpA / 4 SpD / 252 Spe
Timid Nature
IVs: 0 Atk
- Thunderbolt
- Flash Cannon
- Hidden Power [Fire]
- Volt Switch
Tornadus-Therian @ Rocky Helmet
Ability: Regenerator
EVs: 248 HP / 8 Def / 252 Spe
Timid Nature
- Hurricane
- Heat Wave
- Knock Off
- Defog
Magearna @ Fairium Z
Ability: Soul-Heart
EVs: 252 SpA / 4 SpD / 252 Spe
Timid Nature
IVs: 0 Atk
- Shift Gear
- Calm Mind
- Fleur Cannon
- Focus Blast
`)!.team as PokemonSet[]));
})();
This will be released in ~2-3 days (better way wait until the monthly tier shifts land to avoid having to cut packages all the time) as v0.2.0.
from ps.
gen7vgc2017
is implemented as a mod in Pokémon Showdown upstream and mods (like LGPE) are not supported by this repository currently (there are plans to support them, but not in the way Pokémon Showdown handles mods). gen7vgc2017
is a mod because it depends on SM and not USUM data, and there's no way with custom rules alone to change the data/
. As such, gen7vgc2017
(and other formats which depend on modded data) are not currently supported in @pkmn/sim
.
from ps.
I think mod support will look something like this:
- create a new
@pkmn/mods
supplementary package for@pkmn/sim
which contains data for 'canonical' mods likestadium
/stadium2
/letsgo
/vgc2017
as well as support for OMs (but no data files) - the
data/
directory will mirror PS /@pkmn/sim
's structure (basically PS structure +index.ts
files) - the package will provide a
ModdedDex
wrapper class that is parameterized (ModdedDex<A extends Abilities = Abilities, ..., S extends Species = Species>
) and will delegate to a@pkmn/dex-type
Dex
internally (note:@pkmn/dex
names its classModdedDex
-> this should probably be renamed toDexImpl
or similar) ModdedDex
casts the return value of each of its getters to the appropriate type parameter (ie.getSpecies()
is cast toS
) - this is not typesafe as it requires asas any
to work - this is deemed acceptable (don't care about internal typesafety of mods, only care about presenting correct types to the users of theModdedDex
)ModdedDex
's constructor takes amodid
and partial of mod data that can be applied to the regularDex
(basically this is justDex.load
but copied and slightly modified). Thus to create a ModdedDex you would do something like:
const {Dex} = import('@pkmn/sim').Dex;
const letsgoModData = await import('@pkmn/mods/data/letsgo');
const moddedDex = new ModdedDex(Dex, 'letsgo', letsgoModData);
// moddedDex = same as Dex, but supports dex.mod('letsgo') instead of just 'gen<N>'
@pkmn/dex
and@pkmn/sim
should both be possible to mod viaModdedDex
(though only@pkmn/sim
will also modScripts
)
Then everything that current takes a Dex
can just be given a ModdedDex
. This seems reasonable for a v0.2 or v0.3 release of @pkmn/sim
.
This handles 'mods', but does not solve the problem of team validation for gen7vgc2017
because the TeamValidator
relies on the global Dex
(because PS loves its globals...). To get things to work, there also needs to be an upstream change for https://github.com/smogon/pokemon-showdown which makes it so TeamValidator
takes a Dex
param in its constructor/methods and never refers to the global Dex
object (this is in theory pretty trivial to do - just add an optional dex = Dex
param to the constructor and plumb things through correctly).
from ps.
gen7vgc2017
is implemented as a mod in Pokémon Showdown upstream and mods (like LGPE) are not supported by this repository currently (there are plans to support them, but not in the way Pokémon Showdown handles mods).gen7vgc2017
is a mod because it depends on SM and not USUM data, and there's no way with custom rules alone to change thedata/
. As such,gen7vgc2017
(and other formats which depend on modded data) are not currently supported in@pkmn/sim
.
Oh, it makes sense, thanks for the clarification.
I'll try to build a workaround for this specific format in my code.
Sometimes showdown's code seems like an overkill to me, probably i'm still too unexperienced for it.
Anyway i'd really like to see support for mods (in particular for OMs, it sounds quite interesting), but to be honest i don't think it's an high priority task, as all the most important formats already work as expected to do.
from ps.
Related Issues (20)
- Unexpected Token error when loading pkmn/sim library? HOT 3
- provide event based battle handling for /client HOT 2
- PocketMon HOT 1
- @pkmn/data: `Learnsets.learnable` results are overwritten instead of merged for evolved species HOT 3
- @pkmn/dex: G-Max Move Handling Changed Unexpectedly HOT 6
- ditto sometimes fails to be interpreted by @poke/client battle HOT 2
- team validator HOT 4
- Pack/Unpack does not follow showdown formatting when including team name, format and folder. HOT 1
- No way to load a ModdedDex into battle simulator HOT 8
- @pkmn/client: Only the set info for the first Pokemon on each side is propagated
- @pkmn/client: Level is always overwritten to be 100
- @pkmn/sim: Running `Dex.formats.getRuleTable(Dex.formats.get('gen9lc'))` crashes HOT 2
- @pkmn/sim: Running `Dex.formats.getRuleTable(Dex.formats.get('gen9vgc2023regulatione'))` crashes
- @pkmn/img Wrong icons for certain Pokémon HOT 1
- Unable to easily add custom formats
- @pkmn/dex: CAP Pokemon Chuggalong does not exist in version 0.9.6 HOT 1
- Questions about learnset data HOT 8
- Protocol typings: Challenges and SearchState interfaces are swapped HOT 1
- Protocol: Support `|deinit` message HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ps.