Commit Graph

183 Commits

Author SHA1 Message Date
Guangcong Luo
c4d3b1f80f Improve move validation phrasing 2018-01-30 11:07:10 -06:00
Guangcong Luo
ba4e9870d4 Fix getChoice
It now returns a valid choice string for Team Preview choices.
2018-01-29 20:59:52 -06:00
Guangcong Luo
b58e08e215 Improve Sim documentation 2018-01-28 22:04:41 -06:00
Guangcong Luo
4af43bd698 Document choice specifications 2018-01-28 21:56:37 -06:00
Guangcong Luo
1c62891008 Document new Sim API 2018-01-28 21:23:06 -06:00
Guangcong Luo
4c0699abc6 Implement inputLog
A battle's inputLog is now stored separately from the output log. It's
not an exact log of inputs, but rather just a collection of the inputs
that resulted in the battle: a default choice expands to the choice
that was actually used, and the starting seed is logged whether or not
it was explicitly passed into the battle stream.

Fixes #4348

Fixes #3201
2018-01-28 21:23:06 -06:00
Guangcong Luo
1531b662c6 Refactor battle stream system
This contains a lot of minor refactors, but the main thing that's going
on here is that battle stream writes have been streamlined to be a lot
easier for others to use.

We even support:

    ./pokemon-showdown simulate-battle

which provides a stdio interface for anyone using any programming
language to simulate a battle.
2018-01-28 21:06:49 -06:00
Guangcong Luo
a0da191024 Improve ./pokemon-showdown commands
./pokemon-showdown help

will now display all the possible ways to use PS on the command-line,
of which there are several new ones:

    ./pokemon-showdown validate-team
    ./pokemon-showdown unpack-team
    ./pokemon-showdown pack-team
2018-01-28 21:06:49 -06:00
Guangcong Luo
b9aba16b52 BattleStream: Refactor message types
The previous complement of way too many message types:

- update, winupdate, sideupdate, request, score, log

are now only:

- update, sideupdate, end

`score` was removed in the previous commit, and this commit adds a new
message type `end`. `end` replaces the previous `log`, and also
contains the data for `winupdate` and `score`.

`request` was also folded into `sideupdate`.
2018-01-28 21:06:49 -06:00
Guangcong Luo
6f2b1c0cd8 Battle protocol: Remove score message
score sending is now combined with the log message.
2018-01-28 21:06:49 -06:00
Guangcong Luo
f756b22dc7 Implement |bigerror|
Battles now send their errors using |bigerror|, which requires less
escaping and also correctly reports errors.
2018-01-28 21:06:49 -06:00
Guangcong Luo
9c037b17fe Refactor Battle constructor
`Sim.construct` no longer exists. Battles are now constructed directly
with `new Battle()`. Parameters other than formatid are now passed as
`options`.
2018-01-28 21:06:49 -06:00
urkerab
cdb12bd696 Fix last item handling (#4383) 2018-01-28 20:05:44 -06:00
Guangcong Luo
de7c58aad7 Validator: Fix egg move checking 2018-01-28 15:37:18 -05:00
Guangcong Luo
b19e1b819e
Fix typo in previous commit 2018-01-28 13:30:00 -06:00
Guangcong Luo
bf67a69606
Team Validator: Fix babyOnly check 2018-01-28 13:29:03 -06:00
Guangcong Luo
cd946a0a41
Correctly refactor Mew/Celebi checks 2018-01-28 12:24:42 -06:00
Marty-D
f0e180db0b
Validator: Refactor Mew/Celebi checks 2018-01-28 18:20:34 +00:00
Marty-D
a9d9e199b3
Validator: Add VC level and Ball requirements 2018-01-28 17:17:30 +00:00
Guangcong Luo
4f64074b6c Improve evolution move validation
This is specifically made to fix Nasty Plot + Surf Raichu.

Specifically, prevo moves are no longer compatible with evo event
moves.

Other incompatibilities (specifically, modern prevo moves with old-gen
evo moves) will be harder to fix, unfortunately.
2018-01-28 10:37:43 -06:00
Guangcong Luo
74143b652d Workaround for Celebi VC validation 2018-01-27 22:38:56 -06:00
Marty-D
27dc108d6c
Fix forme tiering in past gens 2018-01-27 04:22:50 +00:00
Guangcong Luo
a22d1d7b20 Fix doublesTier
Should now correctly display NFE and LC tiers.
2018-01-26 18:40:24 -06:00
Guangcong Luo
c9b075ce1f Fix Doubles tiers 2018-01-26 14:26:09 -06:00
KrisXV
aefa8c986a Add doublesTier (#4339) 2018-01-26 14:23:38 -06:00
Dan Huang
9c37960ab6 Use PRNG in sim/ files (#4365) 2018-01-24 12:27:07 -06:00
HoeenHero
f59912a56a Fix /evalbattle (#4372) 2018-01-23 19:25:18 -06:00
urkerab
f0c93655c4 Fix Protective Pads mechanics (#4362) 2018-01-23 11:19:07 -05:00
Guangcong Luo
aae46ffd46 Support checkLearnset in format rules
Fixes #4356
2018-01-20 02:05:21 -06:00
Guangcong Luo
fcfd7c9c25 TypeScript: Add otherFormes to Template 2018-01-19 23:50:22 -06:00
Guangcong Luo
327b004b74 Better support for destroying streams 2018-01-18 04:14:58 -06:00
Guangcong Luo
ab1f995daa Rewrite Process Manager
Process Manager is now lib/process-manager.js

It's been entirely rewritten to reflect what I think a process manager
API should look like.

In particular, there are now two Process Managers, QueryProcessManager
and StreamProcessManager.

Pass QueryProcessManager a pure-ish query function (sync or async) that
takes a JSON value and returns a JSON value, and PM.query() will
execute that function in a subprocess, and return a Promise for its
return value.

StreamProcessManager is the same idea: Pass it a function to create an
ObjectReadWriteStream, and PM.createStream() will create a stream in a
subprocess and return a stream connected to it.
2018-01-18 03:34:16 -06:00
Guangcong Luo
d395424fd3 TeamValidator: Return null, not false, for valid team
As usual, having `T | false` be our optional is a really old PHP
convention; we should be using `T | null` basically everywhere.
2018-01-18 03:32:32 -06:00
Marty-D
6bce102f66
Gen VII: Update critical hit rate 2018-01-17 05:00:13 +00:00
urkerab
297af3b111 Allow formats to override checkLearnset (#4341) 2018-01-16 04:16:48 -06:00
urkerab
99d682ca26 Change lastMove from a string to a Move (#4298) 2018-01-03 11:54:35 -06:00
The Immortal
5d9a98f061 Fix Alphabet Cup validation 2018-01-03 18:23:03 +08:00
Kris Johnson
c30d5baa0e Fix formats.noLearn validation (#4303)
Also i changed the for loops that i had a stroke over in TI's commit to
for...of loops

@theimmortal
2018-01-03 03:29:38 +08:00
The Immortal
9cdb80f28a Fix Alphabet Cup validation 2018-01-02 22:37:32 +08:00
Guangcong Luo
334103f284 Implement 1000-turn limit for Endless Battle Clause 2017-12-29 18:18:45 -05:00
urkerab
59616d8eb7 Ban Mega formes by name (#4292) 2017-12-28 20:03:30 -06:00
urkerab
4cd0a0e389 Allow formats to reorder all six Pokémon (#4281) 2017-12-27 05:51:11 -06:00
The Immortal
c916f2ae9d Remove remnant from old OMotM 2017-12-27 13:20:03 +08:00
CheeseMuffin
def2697f33 Finish typescripting chat.js (#4277) 2017-12-24 00:45:49 -06:00
urkerab
2873bd8366 Remove an unused parameter from eatItem and useItem (#4210) 2017-12-23 21:36:51 -06:00
Guangcong Luo
0a06bb97ef Better support multiline responses in /eval 2017-12-23 21:32:16 -06:00
Guangcong Luo
b9e9a2b7c4 Simplify Promise support in /eval 2017-12-23 21:31:42 -06:00
Guangcong Luo
b8be497142 Improve /eval output 2017-12-19 21:30:47 -05:00
Quinton Lee
361b4d03cc
Fix crash in Dex.getFormat 2017-12-18 19:25:56 -06:00
Guangcong Luo
9542ae2444 Include chat/etc in battle logs 2017-12-18 18:32:58 -06:00