Commit Graph

4319 Commits

Author SHA1 Message Date
Guangcong Luo
090ba89a09 Fix Substitute animation 2018-06-10 20:35:01 -07:00
Ridaz
5aa3486911 Remove wait usage in irrelevant places 2018-06-10 11:26:44 +01:00
Guangcong Luo
b40149e6f7 Rename battle -> scene where appropriate 2018-06-09 23:34:25 -07:00
Guangcong Luo
45ec4f9f50 Fix wait usage in move animations
scene.wait(...) now affects `showEffect`, which makes some old move
animations incorrect. This commit makes them do what they're intended
to do.
2018-06-09 23:21:26 -07:00
Guangcong Luo
714e254ef3 Fix weather/terrain animation 2018-06-07 12:12:10 -07:00
Guangcong Luo
c431b044ea Support pausing battles/replays as spectator
This makes the replay experience in-sim more like the replay experience
in the replay viewer.
2018-06-07 02:22:36 -07:00
Guangcong Luo
c590a0c370 Add new BattleScene animation engine
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).
2018-06-07 02:22:36 -07:00
The Immortal
e957f953c2
Move custom ranks below % 2018-06-07 05:11:28 +08:00
whales
279552964c Make the buttons for forfeiting help rooms more accurate (#1126) 2018-06-05 11:12:34 -07:00
Guangcong Luo
f31af35f1b Fix misc bugs in refactor 2018-06-02 17:46:43 -04:00
whales
511bd6761e Battles: set BG and BGM properly (#1125) 2018-06-01 10:40:46 -06:00
MacChaeger
0d52b7ef42 Unjoin old battle rooms if no replay is found (#1123) 2018-05-26 22:02:18 -05:00
Guangcong Luo
af6b9313e5 Accessibility: Add ARIA labels to battle teams
Someone reported this stopped working, which is really weird because
there've been zero changes to this part of the code for like ever.

Oh well, this is confirmed to fix the problem, so I guess this isn't
a bad thing.
2018-05-25 18:01:58 -04:00
Guangcong Luo
1e474da50e Further fix tooltips 2018-05-25 18:01:58 -04:00
Marty-D
4a90896346
Add Persistent message 2018-05-25 15:48:55 +00:00
asgdf
f062da4844 Teambuilder: Prevent duplicate mega search results (#1117) 2018-05-21 19:19:26 -05:00
MacChaeger
016342de1e Integrate replays into the client (#1115) 2018-05-21 17:34:24 -05:00
Guangcong Luo
bced02478f Slightly improve battle-animations-moves.ts
- Add license
- Fix a single TypeScript error
2018-05-20 15:03:46 -05:00
asgdf
ae4ed26a0b Oldgens: Don't show abilities the Pokemon didn't have at the time (#1113) 2018-05-20 11:24:48 -05:00
Guangcong Luo
84d8be6cc9 Fix tooltips for mega evolutions 2018-05-19 23:25:05 -04:00
Guangcong Luo
ad41ecb5a3 Rebuild replays when using ./build full 2018-05-19 23:24:38 -04:00
Guangcong Luo
5a1b749a69 Fix replay saving 2018-05-19 23:24:27 -04:00
Guangcong Luo
5a6b725d72 Push Zarel-as-RO above admins/leaders
This is a really dumb hack, but oh well, it works.
2018-05-19 22:00:06 -04:00
Guangcong Luo
382a5334b3 Add image-size dependency to package.json 2018-05-19 21:59:46 -04:00
Guangcong Luo
56497407df Move polyfills to beginning of battle-dex.ts
The polyfills are used immediately, so moving it elsewhere isn't an
option.
2018-05-19 21:58:37 -04:00
Guangcong Luo
955fc7eb09 Slightly improve code style 2018-05-19 21:58:20 -04:00
Guangcong Luo
9b034d22ac Fix Mega evolution animation 2018-05-19 20:47:30 -04:00
Guangcong Luo
edf5d650e2 Fix crash in Doubles
I still don't understand how this code got there, but at least it was
an easy fix.
2018-05-19 20:14:46 -04:00
Guangcong Luo
2d77a709a6 Babel: Compile object-spread to Object.assign 2018-05-19 20:13:55 -04:00
Guangcong Luo
1f8cb86b6f Fix animation crashes 2018-05-19 20:13:25 -04:00
Guangcong Luo
6e7b3b6d5c Update Google Auth Library dependency 2018-05-19 19:30:51 -04:00
Guangcong Luo
838ed99274 Update replay auto-redirect
All battle numbers below 700 million now auto-redirect to Replays.

(All expired battles will redirect to Replays, the auto-redirect just
means the client doesn't need to ask the server if a battle is expired
and wait for an answer before redirecting.)
2018-05-19 19:16:01 -04:00
Guangcong Luo
eacd61cde2 Rearrange default rank order
Now matches the default rank order server-side.

Yes, it's intentional that RO is below Leader now.
2018-05-19 19:14:34 -04:00
Marty-D
1d1d40140a
Update minisprite cachebuster 2018-05-19 19:01:48 -04:00
Quinton Lee
102b9bb708 Support UHTML in PMs (#1120) 2018-05-18 18:04:14 -05:00
Guangcong Luo
4e7f998afa TypeScript data/graphics.js 2018-05-18 17:10:58 -05:00
Quinton Lee
3adb93c70c
eslint: ignore compiled js/battle.js 2018-05-18 11:36:32 -05:00
Marty-D
37bdb5c514
Add CAP 24 minisprite 2018-05-18 00:41:21 +00:00
Guangcong Luo
26bd0e6b05 Document new build process 2018-05-17 11:52:32 -05:00
Guangcong Luo
399f1735b6 Fix build tools
It should now be possible to build from a fresh checkout with
`node build`.
2018-05-17 11:52:32 -05:00
Guangcong Luo
1dfaddafa1 Track battle.id
The main advantage of this is that everyone in a battle will see the
same background and hear the same background music.
2018-05-17 11:15:26 -05:00
Guangcong Luo
d247364027 Migrate js/battle.js to TypeScript
This is only a first step and doesn't pass strictNullChecks.

I'm committing now because skipping straight to refactoring will be
easier than trying to make it pass strictNullChecks as-is.

TypeScript found at least a few bugs here, which is nice.
2018-05-16 19:49:25 -05:00
asgdf
6933d5a6e6 Fix build script on Windows (#1118) 2018-05-14 17:50:24 -05:00
Guangcong Luo
194e07e6d0 Disable package-lock.json
For detailed justification, see the commit message for the
corresponding server change:

2e85de348f
2018-05-14 17:14:27 -05:00
Guangcong Luo
e532df4e6d
Update CONTRIBUTING.md 2018-05-14 16:50:56 -05:00
Guangcong Luo
b3c6c2a308 Make eslint ignore compiled files 2018-05-14 12:53:34 -05:00
Guangcong Luo
62bce12807 Document new build system and allowable modern JS 2018-05-14 12:53:34 -05:00
Guangcong Luo
a15ec64d1d Move battledata.js to TypeScript
This is the first step of moving the entire client over to
TypeScript + Preact!!!!

The main change here is that battledata.js has been split into three
files:
- `src/battle-dex.ts`
- `src/battle-dex-data.ts`
- `src/battle-dex-misc.js`

These are concatenated back into `battledata.js` in the client, so
third parties (and specifically, old replay files) should be
unaffected. Also, this makes sure that we don't have more than two
dependencies right now.

The compilation is done with Babel 7 beta, because no stable version
of Babel supports TypeScript. We're not using `tsc` because it can't
compile to ES3 and it doesn't support preserving line numbers.

`toRoomid` has been moved from client.js to battle-dex.ts.
2018-05-14 12:53:34 -05:00
Marty-D
3460343ddd
Support Mystery Berry properly 2018-05-14 13:31:37 +00:00
Marty-D
5f3f2df06d
Update Bug Reports link 2018-05-13 23:43:08 +00:00