Commit Graph

10637 Commits

Author SHA1 Message Date
Guangcong Luo
044f4f84e9 Fix crash in dexsearch 2016-03-16 09:44:14 -05:00
Guangcong Luo
e87fd32550 Refactor TeamValidator
The callback code in TeamValidator and the functions that use it have
been refactored to use Promises.

Pretty much all signatures have been changed, for instance:

    TeamValidator.validateTeamSync(format, team)
    -> TeamValidator(format).validateTeam(team)

    TeamValidator.validateTeam(format, team, callback)
    -> TeamValidator(format).prepTeam(team) // returns a Promise

Validators are no longer cached since they're really lightweight. They
contain a format and a Tools instance, and Tools instances are already
cached in Tools anyway. This saves a tiny bit of RAM in exchange for a
tiny bit of CPU time, but more importantly makes the code more
readable.

I'm introducing a new pattern/API for managing the parts of code with
child processes - their process managers are now at .PM and are now
opt-in, so you can use them synchronously without needing to spawn
any processes.

Fixes #2448
2016-03-16 09:43:59 -05:00
Guangcong Luo
c02fe82cd5 Merge pull request #2446 from bumbadadabum/mafia3
Requested code improvements
2016-03-16 07:52:02 -05:00
Bär Halberkamp
4ca5c1d2c8 Remove /mtg and allow /ygo in all rooms
The only wiki we could use sucks, and I'd rather only have a good command usable everywhere
2016-03-16 02:10:23 +01:00
Guangcong Luo
19a3bf307b Export CommandContext from command-parser 2016-03-15 18:19:20 -04:00
Guangcong Luo
b5e6742757 Enable repl.js by default 2016-03-15 18:19:20 -04:00
Guangcong Luo
8ccca9fd09 Fix autojoin for staffAutojoin rooms
All users with roomauth will now autojoin staffAutojoin rooms.
2016-03-15 18:19:20 -04:00
The Immortal
d49ca20a90 Add event Dragonite 2016-03-16 00:53:41 +04:00
The Immortal
ccebdfc1bf Remove Kanto Classic 2016-03-16 00:48:08 +04:00
Bär Halberkamp
bc00dab2f2 Convert dexsearch.js to be multiprocess 2016-03-15 19:47:18 +01:00
Guangcong Luo
ff230ea56e Merge pull request #2447 from QuiteQuiet/targets
Modify target sent when redirected
2016-03-15 13:36:32 -05:00
Quite Quiet
79747aa8b4 Modify target sent when redirected 2016-03-15 09:21:56 +01:00
Bär Halberkamp
8da2cf61fe Convert ladders-remote to the ES6 class syntax 2016-03-14 11:57:08 +01:00
Guangcong Luo
7c6113def8 Refactor verifier.js for Promises 2016-03-13 19:30:30 -05:00
Kevin Lau
e4cc3ef8b3 Merge pull request #2445 from TheFenderStory/patch-1
Require sugar-deprecated instead of sugar
2016-03-13 17:00:27 -07:00
Jared Grady
60ff1f3c9e Require sugar-deprecated instead of sugar 2016-03-13 16:40:56 -07:00
The Immortal
5b912f4eeb Add NU suspect test 2016-03-12 17:20:45 +04:00
Guangcong Luo
447aed29ca Fix style error 2016-03-12 05:32:24 -06:00
Guangcong Luo
97b89cc4ac Refactor CommandContext to ES6 classes
Context in command-parser.js has been renamed CommandContext and
refactored to use ES6 classes. Its also subsumed the canTalk
function. Future iterations will probably put the parse function
inside it as well.
2016-03-12 06:22:59 -05:00
Guangcong Luo
118eb8301f Merge pull request #2443 from BlazingAura/patch-1
Invite to private room crashes.
2016-03-12 02:25:54 -06:00
BlazingAura
097b6683b1 Invite to private room crashes. 2016-03-12 13:18:15 +05:00
Ivo Julca
75b632fed0 Fix crashes in dexsearch 2016-03-11 07:54:28 -05:00
Ivo Julca
3cce56f6d2 Forcibly replace Object.values implementation from Sugar.js 2016-03-10 17:18:53 -05:00
Marty-D
9d496e00dc Gen IV: Fix Focus Sash properly 2016-03-10 12:29:39 -05:00
Marty-D
f567c1ec90 Gen IV: Fix Toxic Spikes interaction with Safeguard 2016-03-10 11:25:44 -05:00
Marty-D
56da976d87 Gen IV: Fix Focus Sash interaction with multi-hit moves 2016-03-10 11:25:11 -05:00
Marty-D
a141026895 Merge pull request #2441 from brandongeren/patch-1
Gen 1: Change Horsea's SpD from 79 to 70
2016-03-10 09:05:16 -05:00
Guangcong Luo
2cf1964743 Merge pull request #2440 from Zarel/sugar-removal
Remove Sugar.js
2016-03-10 03:27:42 -06:00
Brandon Geren
b441d917f3 Gen 1: Change Horsea's SpD from 79 to 70
Gen 1: Horsea's SpA and SpD should be the same base stat of 70.
2016-03-10 02:00:36 -06:00
Ivo Julca
12e9ca78da Remove usage of Date|Function methods implemented by Sugar.js
Implements Tools#toTimeStamp to support Node.js builds without ICU support,
which are currently the default. If/when that changes, we should be able to
use Date#toLocaleDateString, given that appropriate locale options are used.
2016-03-09 16:55:47 -05:00
Ivo Julca
66c00d29af Remove usage of String|Number methods implemented by Sugar.js
Implements Tools#toDurationString to replace Number#duration.
2016-03-09 16:55:40 -05:00
Ivo Julca
0281176fd1 Remove usage of Array|Object methods implemented by Sugar.js
Adds a dependency to shim Object.values until it's natively available.
2016-03-09 16:55:34 -05:00
Ivo Julca
bc1a46eee1 Deps: Deprecate sugar extensions 2016-03-09 16:31:44 -05:00
The Immortal
527d1d03af Add LC suspect test 2016-03-10 00:46:50 +04:00
The Immortal
60cbc64ec3 Remove animation if Sucker Punch fails 2016-03-09 20:33:39 +04:00
The Immortal
d7b37ec6fa Add new Theorymon 2016-03-09 16:06:06 +04:00
Guangcong Luo
3c888c6517 Fix crash in /rank 2016-03-08 23:09:18 -05:00
Ivo Julca
821c2eba4d Battle Factory: update sets 2016-03-08 19:32:43 -05:00
The Immortal
f1624cd83e Gen 5 Random Battle: Fix Air Balloon
And moved the speed manipulation to the bottom.
2016-03-08 23:00:11 +04:00
The Immortal
93bd6365ad Unban Shedinja from Averagemons 2016-03-08 17:25:49 +04:00
The Immortal
db251d3822 Add maxHP flag for Shedinja
Refer to 61e2cfca27.
2016-03-08 17:25:20 +04:00
Guangcong Luo
edce3997f3 Revert and document old Shedinja HP behavior
There's a lot of discussion on this decision in the comments of 61e2cfca27

`this.speciesid === 'shedinja'` and `this.template.baseStats['hp'] === 1` do the exact same thing in Hackmons and Custom Game. They are both valid interpretations of:

```
0803E554   LDR     R0, =0x12F
0803E556   CMP     R7, R0
0803E558   BNE     loc_0803E568
```

But this is disassembly. Who knows what the uncompiled code looks like? Maybe it's not even hardcoded; maybe the uncompiled code just checks a list of Pokémon whose base HP is 1, and if you change Shedinja's base HP in the source, it'll have more than 1 HP. You can't say whether it does or doesn't.

So the only question between `this.speciesid === 'shedinja'` and `this.template.baseStats['hp'] === 1` is: which is better for mods?

I would argue that `this.template.baseStats['hp'] === 1` is better for mods, since it lets you 1. change Shedinja's max HP, and 2. give other pokemon 1 max HP, all just by editing pokedex.js (without needing to edit the engine). To be fair, it makes it so you can't have a regularly-calculated 1-base-HP Pokémon (without editing the engine), but I think this is much less common than wanting to give Shedinja more HP and wanting to give other Pokémon 1 max HP combined. And as always, you can have whichever you want by editing the engine.

Now, you call the default behavior for Averagemons and Tier Shift "wrong", but this is only wrong if you define the stat changes in terms of hexediting the games' compiled data, not if you define the changes in terms of editing the source or in terms of what you'd expect. Which you are free to define it that way, but I don't like that definition and don't support hexediting as an excuse to make PS's behavior less intuitive for modders.
2016-03-08 00:07:21 -06:00
Marty-D
c70bc2da94 Avoid all potential Thousand Arrows crashes from info commands 2016-03-07 21:45:29 -05:00
Ivo Julca
2b391ad824 Fix informational commands crashing for Thousand Arrows 2016-03-07 21:22:15 -05:00
The Immortal
438e9e4106 Update BH and AAA 2016-03-07 18:18:06 +04:00
The Immortal
1007219525 Move Gurdurr to RU 2016-03-07 05:54:46 +04:00
The Immortal
61e2cfca27 Correctly implement Shedinja's HP
Pokemon with a base HP of 1 do increase according to the stat formula.
Shedinja is hardcoded to have 1 HP no matter what its base stat is.
2016-03-06 20:36:28 +04:00
Marty-D
5d01004381 Fix Powder tag 2016-03-05 22:29:33 -05:00
Ivo Julca
23573646de Fix information leak in random formats 2016-03-04 19:46:25 -05:00
The Immortal
8c7fddfb5a Tier Shift: Fix HP boost 2016-03-05 03:34:50 +04:00