"Format/Team" and the spectator checkbox have too low contrast on
certain backgrounds.
I suspect we'll get a lot of complaints regarding the redesign, but
oh well, accessibility wins here.
`style/STYLING.html` is now a guide of generic CSS classes that can be
used by bots and chat plugins.
CSS classes that can be used by bots and chat plugins are now in a new
`battle-log.css` (previously just a section of `battle.css`)
Several PS styling patterns (specifically, `message-log`, `option`, and
`blocklink`) have been refactored into CSS classes, so that they can
be used by bots and chat plugins (why yes, I do plan on using 2/3 of
them in the log viewer).
Past CSS has been super messy. This refactor tries to make it neater
by adhering to these rules:
- Instead of trying to use e.g. `.setmenu button` selectors (to save
`class=` on every individual list item), give up and just put
`.option` directly on list items. This drastically cuts down on all
the hacks necessary to have `.button` work inside `.setmenu`.
...That's it. That's the only change. It massively cuts down on CSS
complexity. It does slightly complicate the DOM, which I'm not a _huge_
fan of, but CSS unpredictability is nearly impossible to catch and
debug, so it's massively worth it.
This is just code to support using details/summary for a "read more"
system. The entire summary portion can be clicked to expand/collapse,
but the overall usability feels "better than before" to me.
- Tooltips work in replays now
- Calculation is better (correctly handles more corner cases)
- Explanations are better (better messages for Magic Room etc)
- Tooltips for sidebar pokemon
- Support "locking" tooltips with long-click / long-tap
- Can copy/paste from locked tooltips
- Increased font size
Honestly, the CSS solution was really cool. It was just incompatible
with the new system. It also had enough other flaws (like, bad
accessibility) that I don't feel _too_ bad about ripping it out.
The new version is less code, anyway, although it does have the flaw of
needing to replay the battle if you turn nicknames on or off.
Fortunately, that should be a rare enough occurrence not to be a big
deal.
battle.js is probably PS's oldest code. It's received minor touch-ups:
a refactor to prototypes early on, and then a refactor to TypeScript
and classes recently, but otherwise it's had basically zero maintenance
until now.
That's probably why this refactor took me over a week.
The biggest change is that the animation engine strewn around
Pokemon, Side, and Battle has been broken out into a new class named
BattleScene.
Pokemon, Side, and Battle now only track state; all animation is now
done in BattleScene and PokemonSprite.
The fates of major classes:
battle.ts:Pokemon - animation has been moved, mostly to PokemonSprite
battle.ts:Side - animation has been moved, to PokemonSprite/BattleScene
battle.ts:Battle - animation has been moved, mostly to BattleScene
Major changes:
- Many many variables have been renamed to be much clearer about what
they mean. For instance, `animationDelay` is now `timeOffset`, and
`activityDelay` is now `minWait`. A few bugs relating to me mixing
up these two variables have also been fixed. jQuery variables named
like `fooElem` have been renamed like `$foo`.
- The unnecessarily complicated queue1/queue2/activeQueue system,
previously used for telling the animation engine to stop after Pause
was pressed, has been replaced with a simple `interruptionCount`
counter.
- The entire scene can now be reconstructed from scratch, which means
that the `fastForward` system no longer needs to touch the DOM
outside of the battle log. "Prev turn" and "Skip to turn" should be
faster in 1000-turn battles now.
- The animation engine now supports displaying weather and terrain
simultaneously.
- During a replay, Team Preview is shown for a second (instead of
immediately skipping to the battle).
- Various aspects of the animation engine should be much less brittle
now.
- Many bugs were fixed (and new ones were introduced).
Since real custom elements still have very limited availability, this is the most proper way to do it, and results in a more predictable HTML parsing.
Adds support for custom styles and classes.
Example: <psicon pokemon="meloetta" class="pixelated" style="opacity:0.4" />
This commit consolidates all Pokemon icons in 'picon'.
Perhaps now we'll be able to rename picon -> pokemonicon now that the
old name is no longer used... but I guess that can be reserved for a
future commit.
Replays can now be downloaded into .html files.
The .html files mainly contain replay log data; the actual replay
player is downloaded online. Also included is a textual log and
some minimal CSS to make it look pretty, for offline viewing.
This strategy helps keep the replay file reasonably small; of
the 30 KB or so for a 50-turn battle, around 10 KB is the log
data, and around 20 KB is the textual log.
- Ability activations are now handled consistently
- Ability activations now look different, the ability name appears
under other result anims and doesn't move
- Replace animDelay with the same animationDelay system we use for
everything else in the engine
- Group multiple stat boosts/drops
- Group damage when possible in spread moves in doubles/triples