mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-03-21 17:50:29 -05:00
The client Battle class API has been pretty old and crusty, so this
updates it to be saner.
The constructor now takes an options object. Any setting you'd want to
initialize with is now a constructor option, instead of needing to call
methods after the constructor.
(Deprecated settings `roomid` and `joinButtons` still need to be set
separately.)
The old callback system is removed. It's replaced with a subscription
system vaguely resembling `PSStreamModel`. Any callbacks only intended
to be used by the warstory generator are removed (anyone who wants to
write their own warstory generator should extend `BattleSceneStub`
instead).
Battles no longer start paused. You can still start them paused by
passing `paused: true` as an option.
Playback state tracking had a bunch of rearrangement:
- `playbackState` no longer exists; state should be directly read from
`paused`, `atQueueEnd`, `turn`, and `seeking`.
- `turn` is now initialized to `-1`. `-1` now means "we haven't reached
`|teampreview|` or `|start|` yet". Reaching those sets turn to `0`.
- "Fast forwarding" and "seeking" are now consistently named "seeking".
- `seeking` tracks seek state; changes from `fastForward`:
- `null` means not seeking (replaces `0`)
- `0` means seeking the start (replaces `0.5`)
- `Infinity` means seeking the end (replaces `-1`)
- `fastForward` deprecated and replaced with `seeking`
- `fastForwardTo()` deprecated and replaced with `seekTurn()`
- `resultWaiting` is removed (it's unused)
- The "activity queue" has been renamed the "step queue", which means
some renamed properties:
- `activityQueue` to `stepQueue`
- `activityStep` to `currentStep`
- `nextActivity()` to `nextStep()`
- new property: `atQueueEnd` to track if animation has caught up to the
end of the step queue (replaces checking `playbackState`)
- new property/option: `isReplay` - will automatically set `ended` when
reaching the end of a replay (stopping music and showing a message),
if the replay was saved before the end of the battle
- both replay players (`replay.pokemonshowdown.com` and downloaded
files) have been rewritten to use an observer system, instead of the
previous manual updating
- `reset(true)` has been renamed `resetStep()`
|
||
|---|---|---|
| .. | ||
| lib | ||
| client-battle.js | ||
| client-chat-tournament.js | ||
| client-chat.js | ||
| client-ladder.js | ||
| client-mainmenu.js | ||
| client-rooms.js | ||
| client-teambuilder.js | ||
| client-topbar.js | ||
| client.js | ||
| replay-embed.template.js | ||
| search.js | ||
| storage.js | ||