Commit Graph

253 Commits

Author SHA1 Message Date
Ivo Julca
f9b660bae6 Support toggling format availability for tournaments 2015-07-16 13:00:19 -05:00
Ivo Julca
c1e452ea59 Improve error handling in tools loading
- Isolate try-catch blocks
- Throw meaningful early errors wherever possible.
2015-07-14 21:54:37 -05:00
Ivo Julca
e3a8bbb897 Isolate try-catch blocks in Tools load 2015-07-14 02:06:23 -05:00
Ivo Julca
ac41d54c64 Revert removal of scripts installation on Tools
It breaks team validation (tools.gen no longer exists).
2015-07-10 17:45:39 -05:00
Ivo Julca
cee748b28d Shrink needlessly long prototype chains for battles
Properties should now be searched in this order:
- Instance
- Scripts installed
- Battle.prototype properties
- Tools properties
- Object properties
2015-07-09 00:48:53 -05:00
Ivo Julca
32c120fab1 More lightweight implementation of nature data 2015-07-06 04:03:16 -05:00
Ivo Julca
e92bb1b07f Rename globals toName|toString to Tools.[getName|getString] 2015-07-06 00:34:44 -05:00
Ivo Julca
7810613776 Fix formats getting corrupted if loaded as rules from different mods 2015-07-02 07:48:54 -05:00
Ivo Julca
f18eef39ca Fix Travis build 2015-06-12 03:41:22 -05:00
SolarisFox
29b961ff69 Style fix: indexOf() comparisons 2015-05-18 15:55:57 -07:00
Joimer
0b43420727 Fix Thunder Wave hitting Ground-types
Since move.ignoreImmunity was defined as `false` for Thunder Wave, the statement !move.ignoreImmunity would always evaluate to true.
This would lead to move.ignoreImmunity being true for all status moves.
This commit fixes that problem, checking if the property was not defined as opposed to anything JavaScript deems `false`.

Related: 2e56120ad9
2015-04-15 00:29:09 +02:00
Guangcong Luo
54947b665f Merge pull request #1728 from ascriptmaster/move-fixes
Move refactor: moves/items that ignore immunity/effectiveness
2015-04-14 17:05:22 +00:00
Ivo Julca
c534abb6d5 Remove all fs.existsSync calls
They have been officially recommended against for a long time
2015-04-11 21:47:32 -05:00
Kevin Lau
2e56120ad9 Move refactor: affectedByImmunities -> ignoreImmunity
While move.affectedByImmunities was always a Boolean value to denote if
the move was affected by immunities, move.ignoreImmunity can be a Boolean
value if it ignores or is affected by all type immunities, but also can
act as an object such that !!move.ignoreImmunity[type] means it ignores
immunities of that type.
2015-04-08 00:17:12 -07:00
Morfent
ce1724e179 Replace all s.substr(x, 1) with s.charAt(x) 2015-04-06 21:20:43 -03:00
Marty-D
1f689e7e69 Make sure moves have the flags object 2014-12-16 12:39:43 -05:00
Marty-D
fdc3d9f570 Fix several item mechanics.
- Griseous Orb, Plates, Drives, and Mega Stones can no longer be removed
from or given to their respective species by any means
- Mold Breaker and friends can no longer remove a Plate from an Arceus
- The Fling base power for these related items is now defined in Tools,
like Berries
- Sticky Hold works correctly with Bestow, Fling, Knock Off, Switcheroo,
and Trick
2014-11-13 15:51:28 -05:00
Ivo Julca
ddf3767411 Fix Inverse Battle
- Immunities turn into weaknesses (I don't know how I could forget that).
- Tools#getImmunity is now similar to Tools#getEffectiveness. Also add a bit of documentation, since there seems to be a lot of confusion about its usage.
2014-10-28 17:51:41 -05:00
Ivo Julca
727579ff89 Revamp effectiveness calculation
- Implement BattlePokemon#runEffectiveness, accounting for battle events.
- Refactor Tools#getEffectiveness accordingly.
- Remove Inverse mod. It's now implemented using the global event 'Effectiveness', and with a few changes in the base data for hazards and Arena Trap.
- NEXT: Fix Filter and Solid Rock not accounting for the special effects of Freeze Dry and Flying Press.
2014-10-27 03:46:32 -05:00
The Immortal
a8689a5a10 Primal formes can't be used directly 2014-10-18 13:31:03 +04:00
小太
5027be79fb Add jscs as a style checker, and add some extra jshint options 2014-09-29 18:38:01 +10:00
Ivo Julca
b4ec88610f Properly load banlist tables for modded formats
They are no longer loaded in Tools.getFormat, which could be called from any modded tools and cached the bans.
2014-08-24 22:24:09 -05:00
Ivo Julca
6a9497b53c Use shallow merges to load mod data 2014-08-24 19:15:53 -05:00
Guangcong Luo
2e8ffb0d50 Lazy load mods into Tools
mods are now loaded the first time Tools.mod() is called, rather
than during startup.

This has two effects:
1. Significantly faster startup
2. Less RAM usage on main process, which never uses Tools.mod()
   at all

Sadly, the amount of RAM saved is pretty insignificant on main,
but it could be nice for smaller servers.
2014-08-20 20:31:32 -04:00
Guangcong Luo
12b673bb49 Fix style errors; update gulpfile
I used a hack to make the multiple declaration errors go away,
so all that remained in jsHint were actual errors, which I've
now mostly fixed.

All this linting ended up uncovering one actual bug: Uproar's
message not showing. It's a very minor bug in a move no one uses,
so I'm going to fold it into this commit.
2014-08-10 18:06:44 -04:00
Slayer95
3ea30b4790 Support searching for natures with /data 2014-06-14 22:54:08 -05:00
Slayer95
1b27d0879c Natures are now available in Tools.data 2014-06-14 19:53:00 -05:00
Slayer95
b025743d34 Global 'sanitize' is now 'escapeHTML' method of Tools 2014-05-12 20:52:29 -05:00
小太
5c8fc7b982 Space after function for anonymous functions 2014-04-22 01:58:16 +10:00
小太
6fb3bc332a Spaces around operators and === instead of == 2014-04-22 01:56:11 +10:00
Slayer95
2efe53ab05 Add missing semicolons and remove whitespace 2014-04-19 00:05:31 -05:00
Slayer95
3fc36ef80f 'clampIntRange is now a method of 'Tools' and no longer global 2014-04-18 15:14:54 -05:00
Slayer95
4c18aa60f1 Remove global 'fs' 2014-04-17 14:37:32 -05:00
V4Victini
93ad70d7dd Remove Pokeball from team data 2014-03-28 00:54:56 -04:00
Relados
7c537c8249 Allow aliases for formats
This will make it easier for tournament hosts to create tournaments for formats with extensive names
2014-03-26 19:31:41 -05:00
V4Victini
adbed9d633 Add pokeball field to sets 2014-03-26 15:48:27 -04:00
Guangcong Luo
15b0397143 Make team unpacker less susceptible to DoS 2014-03-09 15:04:40 -04:00
Ivo Julca
03a62165fb Fix crash when packing a team with custom mons 2014-03-06 18:38:43 -05:00
Ivo Julca
6757ff8110 Fix crash when parsing a team with custom mons 2014-03-06 18:22:53 -05:00
Guangcong Luo
99807308ef Add level to packed team format 2014-03-06 00:10:40 -05:00
Guangcong Luo
7b8acd7604 Better team packing/unpacking 2014-03-06 00:07:24 -05:00
Guangcong Luo
e2b57563a6 Optimized team sending
Teams are now sent using our new packTeam/unpackTeam code, rather
than JSON. This compresses teams from an average of 2000 bytes to
an average of 500 bytes.
2014-03-05 23:30:16 -05:00
Ivo Julca
ceff82920e Don't inherit init in scripts.js 2014-02-14 18:42:04 -05:00
Ivo Julca
ffe340769a Optimize Tools.modData in nested mods
Now it will check whether the datum is the same as its homologous in its parent mod rather than in the base mod.
2014-02-13 20:04:21 -05:00
Tyler Stark
0723abe4e0 Reverting some of the refactor 2014-02-09 23:48:57 -06:00
Tyler Stark
bff353cc58 Second Pass at cleaning up the code. These are pretty safe edits that include adding 0 to decimal values, fixing variables that are declared multiple times, and removing duplicate keys 2014-02-09 23:38:57 -06:00
Ivo Julca
0150143408 Fixes for type change
Fixes Trick-or-Treat and Forest´s Curse stacking.
Fixes Roost overriding other type changes when it ends.
Fixes Roost not suppressing Flying type adquired afterwards in the turn.
Fixes mons not adquiring Flying type when transforming into a roosted pokemon.
Fixes nature of types (added by Trick-or-Treat or Forest´s Curse) not being passed on use of Reflect Type or Transform.
2014-02-01 19:05:28 -05:00
Guangcong Luo
e2f82fa8f3 Rename data/formats.js -> data/rulesets.js 2014-01-09 19:37:04 -08:00
Guangcong Luo
a39fdd6006 Split off team validation to team-validator.js
This is the first step in a refactor to split team validation into
its own process.
2014-01-09 17:35:19 -08:00
Ivo Julca
88260165c5 Fix Gen 1 and 2 being unplayable
Do not cap EVs total for pokemon.
Also set abilities to None again
2014-01-09 15:21:57 -05:00