Giter Site home page Giter Site logo

gen7vgc2017 team validation about ps HOT 4 CLOSED

pkmn avatar pkmn commented on August 10, 2024
gen7vgc2017 team validation

from ps.

Comments (4)

scheibo avatar scheibo commented on August 10, 2024 1

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[]));
})();

Screen Shot 2020-08-30 at 12 16 42

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.

scheibo avatar scheibo commented on August 10, 2024

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.

scheibo avatar scheibo commented on August 10, 2024

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 like stadium/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 class ModdedDex -> this should probably be renamed to DexImpl or similar)
  • ModdedDex casts the return value of each of its getters to the appropriate type parameter (ie. getSpecies() is cast to S) - this is not typesafe as it requires as as 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 the ModdedDex)
  • ModdedDex's constructor takes a modid and partial of mod data that can be applied to the regular Dex (basically this is just Dex.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 via ModdedDex (though only @pkmn/sim will also mod Scripts)

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.

HeliosVelite avatar HeliosVelite commented on August 10, 2024

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.

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.