Commit Graph

1611 Commits

Author SHA1 Message Date
Guangcong Luo
6b870967e0 Fix bug in support for >10 pokemon in Team Preview 2017-09-09 20:31:54 -04:00
Guangcong Luo
737d9dbba0 Support more than 10 Pokemon in Team Preview 2017-09-09 20:19:24 -04:00
Guangcong Luo
066d970b54 Fix >6-pokemon Custom Games 2017-09-09 19:41:55 -04:00
Guangcong Luo
b42a322ecb Support over 6 Pokemon in Custom Game 2017-09-09 18:25:26 -04:00
Guangcong Luo
1e87e989cc Hacky fix to the 6-move bug 2017-09-08 18:20:08 -04:00
Guangcong Luo
057e6b4e89 Alias formats without gen number to Gen 7 formats
Closes #3785
2017-09-08 10:27:20 -04:00
urkerab
bd6743bbe7 Reveal own Ability in Gen 7 (#3969) 2017-09-06 23:21:19 -04:00
Guangcong Luo
25d0079b4f Sim: Fix Berries not activating after weather
Previously, Berries would not activate after weather damage and before
other residual damage/healing.

According to: https://www.youtube.com/watch?v=FRI5PSekhR4

They should activate then. More research is needed to determine what
other situations Berries should activate but don't.
2017-09-05 07:00:55 -04:00
Guangcong Luo
7785375d14 Sim: Faint-switch in fainted pokemon Spe order
Now, if multiple Pokemon fainted in one turn, they will be switched
out in Speed order (of the fainted Pokemon).
2017-09-05 06:53:56 -04:00
Ghoulean Algebra
f067ee13ee Gen II: Fix Hidden Power's power calculation (#3925)
Before : HP_Power=(5*(v+2w+4x+8y)+min(Z, 3))/2 + 31 
After: HP_Power=(5*(v+2w+4x+8y)+(Z % 4))/2 + 31 

where 
* v is 1 if SpcIV>=8; otherwise 0, 
* w is 1 if SpeIV>=8; otherwise 0, 
* x is 1 if DefIV>=8; otherwise 0, 
* y is 1 if AtkIV>=8; otherwise 0, 
* Z = SpcIV

See: 
http://tasvideos.org/forum/viewtopic.php?p=361950#361950
https://github.com/pret/pokecrystal/blob/master/battle/hidden_power.asm#L52
2017-08-27 20:22:05 -04:00
Quinton Lee
0c94145c40 Fix remaining custom format issues (#3910)
Rules for custom formats are once again sanitized and can be passed
around more easily by attaching them to the format's id.

Fixes:
- "Rule:" being required to add or remove a rule
- ruleset changes not being shown in battles
- the display of custom rules being affected by user input
- custom formats being broken by /hotpatch formats
2017-08-23 22:27:09 -07:00
Guangcong Luo
18d656519c Fix chooseMove again 2017-08-09 21:52:30 -05:00
Guangcong Luo
29bfa41f79 Fix crash in autoChoose 2017-08-09 20:28:25 -05:00
Marty-D
5aa7045900 Fix Solar Blade redirection issue 2017-08-05 12:32:35 -04:00
Guangcong Luo
4df6548cf4 Fix bugs in VGC auto-move resolver 2017-08-02 07:02:32 -04:00
HoeenHero
4af068a710 Fix custom banlists (#3832) 2017-07-31 02:18:24 -04:00
Guangcong Luo
bbf7bc98d2 Fix random battle sets
(There were doubles sets in singles games)
2017-07-27 17:49:38 -04:00
Guangcong Luo
acc165d4db Fix bugs in previous commits 2017-07-27 17:24:55 -04:00
Guangcong Luo
7f72f09e5d Rename Dex.format -> Dex.forFormat 2017-07-27 17:10:44 -04:00
Guangcong Luo
0e792dad80 Update default gen for formats to gen 7 2017-07-25 03:37:55 -04:00
Guangcong Luo
4cdf39f13c Remove prototype hack for Battle
Simulator instances still get their scripts included somewhat hackily,
but it's overall much less hacky than before. In particular, the
init code is now an actual constructor, allowing TypeScript to perhaps
validate it one future day.
2017-07-25 02:59:59 -04:00
Guangcong Luo
0ba508bbd3 Support ./pokemon-showdown generate-team
I might regret supporting this syntax, but it's now possible to make
PS generate teams on the commandline using:

./pokemon-showdown generate-team [optional format name] [optional seed]

The output will be in packed team format (which can be pasted into
a teambuilder import box).

The seed-passing should make it significantly more straightforward to
debug team generation weirdness.
2017-07-25 02:59:59 -04:00
Guangcong Luo
3b4d8b3ff0 Split random-teams.js out of scripts.js
Random team generation scripts are no longer in scripts.js, but instead
in a new file random-teams.js.

The scripts are now also no longer run from inside battles, but in a
new team generator object. This makes it easier for external scripts
to generate random teams by running Dex.generateTeam(format).
2017-07-25 02:59:59 -04:00
Guangcong Luo
a86762e4ea Fix in-battle clauses 2017-07-23 22:20:42 -07:00
Guangcong Luo
f38de6d775 Remove padStart shim
The padStart shim is currently unused and commented out. If we ever do
need it, we should increase the minimum Node version to 8.0.
2017-07-23 22:17:07 -07:00
Guangcong Luo
6c1a60df2e Fix limit rules in ruleTable team validation 2017-07-20 19:35:02 -05:00
Guangcong Luo
2b1d7b2cc3 Properly fix crash in /learn 2017-07-20 16:33:40 -05:00
Guangcong Luo
d79e348ebc Refactor banlistTable -> ruleTable
PS's rule table has been renamed from banlistTable, and works a bit
differently now. It's a Map instead of an object now, and the keys
work a bit differently.

The original banlistTable was designed to store bans, and later
additions shoved rules and then unbans in there. The new table is
designed to support all of these.
2017-07-20 12:50:41 -05:00
Konrad Borowski
212b99ed90 Remove Object.values shim (#3787)
It's not correct as far ES2017 specification is concerned, and Showdown
requires Node.js 7 anyway
2017-07-16 17:39:53 -05:00
asgdf
6dc5c877e3 Fix comment typos (#3757) 2017-07-10 16:57:07 +09:00
Guangcong Luo
58a1af0f0f Rename supplementaryBanlist -> customBanlist
It's shorter and clearer.
2017-07-04 09:36:37 +09:00
Guangcong Luo
3f6f9e61a5 Fix supplementary banlists
They're coded as nullable and are better treated that way.
2017-07-04 09:36:37 +09:00
Marty-D
3bf0ffdc97 Gen III: Fix Ingrain 2017-06-29 18:38:36 -04:00
Guangcong Luo
83f70fcf3a Export PRNG from sim/ 2017-06-22 20:57:51 -07:00
Quinton Lee
e3b964a65d Show correct rulesets in custom format battles (#3674)
Also add more format documentation
2017-06-22 15:25:31 -07:00
Quinton Lee
5ab919d858 Refactor supplementary banlists into custom formats (#3671) 2017-06-22 03:10:15 -07:00
Quinton Lee
ec10d30996 eslint: Lint sim/ directory (#3670) 2017-06-21 20:00:17 -07:00
Marty-D
d60c007f3d Update move flag descriptions 2017-06-17 09:36:52 -04:00
Guangcong Luo
cf7607cb90 Move cache tables out of Dex.data
Template/Item/Move/Ability caches are now direct properties of Dex,
instead of being inside Dex.data.
2017-06-13 21:45:53 -05:00
Guangcong Luo
00448ac865 TypeScript: Update for latest nightly
The latest nightly of TypeScript changes how the checks work, and I'm
tracking it because it also fixes several major bugs in --checkJs.
2017-06-11 12:03:38 -05:00
Caleb Young
9dab8e50e1 Implement DPP damage formula (#3583) 2017-06-11 10:18:34 -05:00
asgdf
f22963c718 Fix Last Will crash (#3561)
By moving BeforeFaint right before the faint message, so the move is done
by then.
2017-05-28 17:24:17 +09:00
urkerab
f24d7cbadb Move Illusion-breaking out of the battle engine (#3549) 2017-05-24 20:36:17 -04:00
asgdf
8a33238544 Fix statuses still being effective after being removed that turn (#3538) 2017-05-24 23:55:35 +09:00
urkerab
d212b9f128 Move, Ability and Item effects should inherit the name (#3547) 2017-05-24 23:12:38 +09:00
Guangcong Luo
cd3ac06987 Fix Hail/Sandstorm damage regression
(Also add a test for it since this isn't even the first time this
exact regression has happened.)
2017-05-18 06:29:25 -05:00
Guangcong Luo
109b2cfe1d Slightly refactor teamsize 2017-05-18 05:38:14 -05:00
QuiteQuiet
1be924f6e8 Send team size at the start of battles (#3512) 2017-05-18 05:09:38 -05:00
Guangcong Luo
149ca3759c Add classes for data
Having classes for data will make it better for documenting and make
for overall nicer code that's easier to statically analyze.
2017-05-17 04:10:01 -05:00
Guangcong Luo
fe5fa7889e Fix various TypeScript-related errors
Now that typescript@next fixes the major issue plaguing us, we can
start working on the other issues!
2017-05-17 04:10:01 -05:00
urkerab
b12d9cbf04 Give Natures a Generation (#3528) 2017-05-14 07:22:42 -05:00
urkerab
8ca39d65fc Properly report a near miss for an alias (#3532) 2017-05-14 07:22:20 -05:00
Charlie Kobayashi
78ed58d0c4 Dex: fix dataSearch (#3525)
Use the result's name first instead of inexact search term if search is found.
2017-05-12 17:12:07 -05:00
Charlie Kobayashi
196364adca Effect: don't override inherited properties from moreData (#3524)
- caused weather effects passed in through ``moreData`` to be marked as simply ``"Effect"``
    - as a result, sandstorm and hail will damage Rock/Ground/Steel and Ice types  respectively
- this fix makes ``Effect`` inherit the ``effectType`` from ``moreData`` if it doesn't exist in the primary ``data`` variable passed into the constructor
2017-05-12 14:23:05 -05:00
urkerab
59583ee113 Include aliases when searching the dex (#3475) 2017-05-09 23:58:32 -05:00
Guangcong Luo
e34c77930a Start creating classes for getEffect data
Currently, getEffect/getTemplate/getMove/etc return bare objects.
Refactoring their returns into classes will allow TypeScript to type
check them.
2017-05-09 16:00:11 -05:00
Guangcong Luo
a75282ea97 Fix crash in /weakness 2017-05-08 19:06:54 -05:00
Guangcong Luo
22186f1903 Improve TypeScript typing
sim/dex.js and sim/prng.js are now valid strict TypeScript! Also they
have slightly less "any" use than before.
2017-05-08 02:58:55 -05:00
Quinton Lee
fa1b45f7ab Support supplementary rulesets in battles (#3330) 2017-05-05 20:13:08 -05:00
Guangcong Luo
9e180e4fc1 Remove MockBattle
No MockBattle feature needs to be kept out of sim/...
2017-05-05 16:57:18 -05:00
Guangcong Luo
6dd58b40d3 Refactor simulator into new sim/ directory
This is a surprisingly minor refactor considering how many files it
touches, but most of this is only renames.

In terms of file renames:
- `tools.js` is now `sim/dex.js`
- `battle-engine.js` is now `sim/index.js` and its three classes are
  in `sim/battle.js`, `sim/side.js`, and `sim/pokemon.js`
- `prng.js` is now `sim/prng.js`

In terms of variable renames:
- `Tools` is now `Dex`
- `BattleEngine` is now `Sim`
- `BattleEngine.Battle` is now `Sim.Battle`
- `BattleEngine.BattleSide` is now `Sim.Side`
- `BattleEngine.BattlePokemon` is now `Sim.Pokemon`
2017-05-05 16:48:38 -05:00