| Currently |
Powering showdex · |
Patches @smogon/calc · v0.10.0 → 565b227 |
|---|
Showdex's fork of the @smogon/calc package, sometimes referred to as the "underlying damage calculator." This is the modified source of the aforementioned package that's patched in & bundled with official releases of Showdex.
If you're looking for Showdex's source code, this isn't it (try here instead!). You're looking at a supporting package that supplies all the damage calculations that Showdex displays to you. But if you're looking for a sign, here's a pointer: int* ✧゚・: *ヽ(◕ヮ◕ヽ)
Caution
You are about to get in the zone, the developer zone.
If you do not wish to get in the zone, the developer zone, please visit this zone instead.
Sooo... what's different?
Mainly:
- Disabled web client.
- Web client build scripts have been bypassed in the
postinstallscript. - For our purposes, we're only interested in the MEAT inside the
calcdirectory ( ͡° ͜ʖ ͡°)
- Web client build scripts have been bypassed in the
yarnClassic in lieu ofnpm, similar to Showdex.
More specifically:
- Hacky Beat Up implementation requiring
getBaseDamage()'s to be subbed for this fork's specialmodBaseDamage()wrapper instead.- Since this requires knowledge about all party Pokémon, Showdex passes a special
ShowdexCalcModsobject tomodBaseDamage(), which is a generic wrapper (to support more mods in the future, as needed) that basically only contains astrikes[]array for Beat Up &hitBasePowers[]for overriding the BPs of each hit for multi-hitting moves such as Triple Axel. - Every single mechanics file from
gen12.tstogen789.tshas this modification.
- Since this requires knowledge about all party Pokémon, Showdex passes a special
- Disabled auto-BP calculations for some moves like Triple Kick (but not all!) so that what you see (in the Calcdex — especially when editing moves) is what you calc... sorta:
- As of Showdex v1.2.5, many of the previously disabled moves, such as Acrobatics (but not Triple Kick — still disabled!), have been re-enabled in some of the mechanics files.
- Showdex will display an "AUTO" label in these instances where the mechanics files will be calculating dynamic move properties, i.e., category &/or BP, for moves such as Tera Blast.
- Excludable damages in the NHKO calculations as of Showdex v1.3.0, namely
mods.excludeHazardsDamagefrom field hazards such as Stealth Rock &mods.excludeEotDamagefrom end-of-turn effects such as the non-volatile BRN status condition. - Disabled auto-boosting of some abilities like Intrepid Sword, especially since Showdown also reports those boosts in the battle!
- Persistent final move BPs in matchup descriptions to assist with debugging calculations from Showdex.
- Extra exported types in
src/index.tsthat I frequently use likeGameType&GenerationNum, conveniently importable from'@smogon/calc'directly.
Many of these modifications were made to account for real-time battle conditions that don't apply to the original web-based version. Hence, I'm not intending on pushing any of them to the master smogon/damage-calc repo (also would seriously break the good 'ol Damage Calculator we know & love!).
nodeLTS Hydrogen v18yarnClassic v1.22.0+bash(Windows WSL, macOS, or Linux)
Caution
Without any additional package configuration (that I'm too lazy to do rn), attempting to install this from a package manager (e.g., yarn add doshidak/showdex-calc) will fail! You must install this custom fork into your local copy of Showdex using the cumbersome method detailed below. Sorry :c
Important
I'm assuming you've already cloned doshidak/showdex.git (i.e., Showdex's source code), which exists under showdex in your favorite directory.
cdinto your favorite directory.git clone git@github.com:doshidak/showdex-calc.gitcd showdex-calcyarncd ../showdexrm -r node_modules/@smogon/calc/dist node_modules/@smogon/calc/srccp -r ../showdex-calc/calc/dist ../showdex-calc/calc/src node_modules/@smogon/calcyarn patch-package @smogon/calcyarnyarn dev:re- ???
- Profit!
Tip
Creating the Patchfile in step 8 is completely optional if you just want to quickly test some changes.
Note
Technically, copying the showdex-calc/calc/dist/src directory into node_modules/@smogon/calc has no effect (uses the files in dist instead) & is completely optional, but I do it anyway so you can peep the source code. Fun fact: You can look through your local Showdex's node_modules/@smogon/calc/src right now to see the source code you see here!
Tip
Showdex's yarn dev[:chrome|:firefox]:re script is an alias of its yarn cache:purge && yarn dev[:chrome|:firefox] scripts (also yarn dev itself is an alias of yarn dev:chrome). Running yarn cache:purge is necessary if you've changed anything inside node_modules (including the @smogon/calc package!) after running yarn dev since the stale changes will still persist in (& be loaded from) node_modules/.cache/babel.
wait, you mean you do this every time for every Showdex release ???
- yessir
- all natty
- no git
- no ci
- raw dawg
- basically took a year to set this up cause I'm lazy
- probably would've taken at least two had someone not asked me for this LOL
big thank to:
- honk honk
- austin, tx
- kris kringle
- smog squad
git clone
yee
\ (•◡•) /
