Fixes#6346
The `AfterDamage` event has been replaced with `DamagingHit`, which
which happens for damaging moves after secondaries.
The `AfterHit` event has also been moved after `DamagingHit`, to make
sure Knock Off still procs after Rocky Helmet.
`AfterHit` is no longer a valid event on `secondary` and `self` blocks,
because it's meaningless in those blocks, anyway. All `self.onAfterHit`
and `secondary.onAfterHit` handlers have been moved to `onHit`, which
should have the same timing in practice.
We now track `baseMaxhp`, the pre-Dynamax max HP. We also have a new
function `getUndynamaxedHP` for use by moves that use it (famously,
Endeavor).
- `baseStoredStats` is unused outside of the mouseover stats display.
I updated its implementation to reflect this.
- Power Construct doesn't have a defined behavior during Dynamax. I
ended up implementing an approximation of what it should probably do.
- Endeavor, Pain Split, Super Fang, and Nature's Madness now work on
undynamaxed HP.
- Moves that deal or heal percentage damage now do it based on
undynamaxed max HP, other than G-Max Finale.
Fixes#6131Fixes#6087
In most other similar systems, like TeamValidator, we use `thing.dex` instead of having it extend `ModdedDex`. Battle has always extended `ModdedDex`, though. This changes Battle to match the others.
This should fix an issue with `Battle.data` not being cached.
This also frees up Battle to extend ObjectReadWriteStream<string> in a future update.
Also move mods/ to data/mods/
This makes PS more monorepo-like. The intent is to further separate
the sim and the server code, but without fully committing to splitting
the repository itself.
We now support `./pokemon-showdown start` in addition to
`./pokemon-showdown`. I'm not clear which I want to be the default
yet.