Commit Graph

287 Commits

Author SHA1 Message Date
Guangcong Luo
b20d0a133f Merge pull request #1339 from Pikachuun/master
Explosion and Self-Destruct bug-fix
2014-12-07 11:06:02 -06:00
Juanma Serrano
caab2923e1 Gen 1: Fix critical hits not going through screens 2014-12-04 13:59:09 +01:00
ascriptmaster
e79e64e3fc Ability Refactor: Abilities now listen for End events
Added functionality for setAbility to send End events to abilities.

Fixed bug with Mold Breaker negating all Battle#singleEvent ability calls,
even those that don't involve damage calculation.

Fixed Skill Swap to now use End and Start events in the right order:
send the End events, then change the abilities, then send Start events.
If the same ability is swapped, don't send End events (the game simply
re-activates the abilities in question)

Moved SwitchOut/Faint events from weather to ability so the weather
can interact properly with Cloud Nine or Air Lock.

Primal weathers persist if a Pokemon with the relevant ability is
on-field, even if the originator switches out.
2014-12-03 12:22:21 -08:00
Pikachuun
40b2c8ec47 Explosion and Self-Destruct bug-fix
Explosion and Self-Destruct were not affected by burn before. This
commit effectively fixes that bug.
2014-12-02 09:14:48 -05:00
The Immortal
e2af6d65cc Fix Travis CI errors 2014-11-22 19:25:33 +04:00
Marty-D
669b6ca066 Make sure Abilities do not activate with zero HP. 2014-11-21 21:33:56 -05:00
The Immortal
bcf19608c9 Update Mega Rayquaza
Rayquaza does not have a mega stone; it can mega evolve with the move
Dragon Ascent.
2014-11-21 16:26:56 +04:00
ascriptmaster
c0d2b26a89 Primal Reversion occurs before ability messages activate
Moved primal reversion checks to the SwitchIn event.

Moved the SwitchIn event to properly account for turn order.
2014-11-20 21:06:02 -08:00
Ivo Julca
9406a4a62d Move Struggle usage warning to choice parsing
- It is now sent to the relevant player only, and before the turn resolves.
2014-11-13 14:45:54 -05:00
Ivo Julca
f33909e969 Hide moves disabled by Imprison or NEXT's Telepathy
- Pokémon affected by Imprison -or Telepathy in NEXT- will now have a special flag 'maybeDisabled' in move requests if they are the last active pokémon.
- If a Pokémon having this flag attacks, the player will not be able to cancel their decision.
- Refactor Battle#parseChoice: Move decisions will now be parsed based on all the moves a pokémon knows after LockedMove, rather than only on validMoves. Any request to use a disabled move or a move with 0 PP will now be replied with a message in the form |callback|cant|[pokemon]|[sourceEffect]|[move], unless the pokémon has no valid moves, in which case it will use Struggle. The check for lockedMove in choice parsing is now performed as the first action after checking that the pokémon is not fainted. This prevents pokémon from Shifting to the center in Triples while being locked into a move.
- Don't report moves' being disabled to the client in requests if they are disabled due to Imprison or Telepathy. Instead, their being disabled will be reported using the mechanism described above.
2014-11-13 14:45:51 -05:00
Ivo Julca
d928b64221 Implement BattlePokemon#disableMove to support hiding information
- Changed data to use it anywhere moves get disabled.
2014-11-13 14:45:49 -05:00
Ivo Julca
2fafbb29a8 Fix odd requests for Pokémon trapped by multiple sources 2014-11-11 00:27:04 -05:00
Ivo Julca
d5b7034da1 Remove unnecessary checks for sound immunity
As of ecbc9bfd62, no effect provides an "immunity" to sound.
2014-11-05 21:26:25 -05:00
Ivo Julca
641651e19d Send 'trapped' flag in requests for pokémon that are known trapped
- Implement BattlePokemon#isLastActive to do the check for whether this is the last non-fainted active pokémon in a team.
- BattlePokemon#tryTrap now accepts an argument that, if true, will hide the fact that a pokémon is trapped.
- This should revert an small (annoying) change in the UI for locked moves introduced as a secondary effect in 8afc588e4.
- NEXT: Shadow Tag shouldn't activate the 'maybeTrapped' flag after the suspected Shadow Tagger has made a move.
2014-10-30 00:34:34 -05:00
Ivo Julca
fd0598179b Trapping: fix an exploitable bug in forcing final decision
Players could take advantage of the ´return´ statements after the ´maybeTrapped´ check to safely find out whether they are actually trapped or not
2014-10-29 21:58:08 -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
Ivo Julca
6b1f8de6d3 Fix documentation for Battle#send in battle engine 2014-10-22 01:19:34 -05:00
Guangcong Luo
67b196670e Merge pull request #1263 from Slayer95/ability-trap
Fixes for (absence of) trapping abilities
2014-10-15 21:48:21 -05:00
Ivo Julca
62d5652746 Fix Illusion failing to fake trapping abilities
It wouldn't activate the "maybeTrapped" flag.
2014-10-15 01:37:33 -05:00
Ivo Julca
8afc588e4f Don't send trapped flag to client in pokemon requestData
It caused the "you might be trapped" message to effectively mean "you could have been trapped, but aren't".
2014-10-15 01:36:43 -05:00
Ivo Julca
623d1212f8 Prevent cancellation of final decisions by directly overriding them
A player would bypass the final decision constraint by directly sending choice commands after verifying that they weren't really trapped.
2014-10-15 01:32:12 -05:00
Guangcong Luo
d0dde3d8e0 Fix code style in previous commit 2014-10-14 04:52:05 -04:00
Guangcong Luo
50ddb14229 Fix Assist bug
The noAssist table wasn't working because of a bug in ae6da14ca0
namely that the .moves array wasn't toId'd.

Come to think of it, there's no reason for .moves to exist at
all anymore. We should probably just refactor it out.
2014-10-14 03:15:09 -04:00
小太
ae6da14ca0 Misc cleanup
The important fixes from pull request #865
2014-10-12 21:34:59 -05:00
小太
5027be79fb Add jscs as a style checker, and add some extra jshint options 2014-09-29 18:38:01 +10:00
Ivo Julca
87274a9e44 Support modding BattleSide and BattlePokemon instances
In scripts.js, ´side´ and ´pokemon´ are now reserved keys for objects containing their respective moddded scripts.
2014-09-27 13:56:24 -05:00
V4Victini
5a1f72f6ce Remove outdated '-failed' message 2014-09-06 13:24:43 -04:00
V4Victini
39f17f4978 Save last request details.
Fixes the issue of team preview not resending the details after a player
disconnects and rejoins the battle.
2014-09-03 19:55:36 -04:00
Guangcong Luo
39082d5bbf Switch |split order
`|split` order used to be p1/p2/spectator/replay. It is now
spectator/p1/p2/replay.

Since the spectator version is the default, it makes a lot more
sense to have the default in index 0 (and more importantly
prepares it for an upcoming refactor).
2014-08-25 16:05:46 -04:00
Ivo Julca
892103076b Support pipe operator (|) in /evalbattle 2014-08-23 19:57:07 -05:00
Guangcong Luo
e295a61f23 Gen 2-4: Fix weird behavior when Pursuit KOs 2014-08-12 21:35:05 -04:00
Guangcong Luo
480b416d2d Nicer crash reports
`|split` is now parsed out, which should make battle logs much easier
to read.
2014-08-12 20:42:35 -04:00
Guangcong Luo
890c0b4ebd Gen 3: Fix Trace bug from 065e293c 2014-08-11 18:17:59 -04:00
Guangcong Luo
5ef8b245c3 Fix weird behavior on double-faint in early gens 2014-08-11 18:13:26 -04:00
Guangcong Luo
a4496af607 Comment gen 3 switch mechanics 2014-08-11 18:12:42 -04:00
Guangcong Luo
065e293c29 Gen 3: Traced Abilities don't run Start events
Specifically, things like Intimidate don't happen when Traced.
2014-08-11 05:48:45 -04:00
Guangcong Luo
b0a85dd33b Remove a stray debug line 2014-08-11 05:40:30 -04:00
Guangcong Luo
85994c45d8 Fix faint-switch mechanics for gens 1-3
The model is now:
- Gen 1: fainting ends the turn
- Gen 2-3: fainted mon is immediately switched, and the turn continues
- Gen 4-6: fainted mon is switched at the end of the turn
2014-08-11 05:38:46 -04:00
Guangcong Luo
af2026436a More style fixes and Gulpfile updates
JSHint is now a fair bit stricter, and is now correctly checking
files in `mods/`.

The code has been fixed to match the new stricter standards.

JSHint has now caught its second actual bug: Gen 5 Pinap Berry
was Ice instead of Grass.
2014-08-10 20:43:53 -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
V4Victini
78383ae2e9 Mold Breaker ignores ability redirection 2014-08-05 00:20:28 -04:00
Ivo Julca
b85ace8d7e Fix passing ending turns prematurely 2014-08-04 13:28:09 -05:00
Guangcong Luo
67a3776d86 Fix crash when Pursuiting fainted ally 2014-08-04 13:47:11 -04:00
The Immortal
e6ae62f6e4 Fix mega evolution mechanics
In Hackmons, Mega Charizard Y can mega evolve into Mega Charizard X, for example
2014-08-03 23:35:09 +04:00
Ivo Julca
e14cb84f0e Mold Breaker nullifies the ability of dragged-in pokemon 2014-07-31 01:16:56 -05:00
V4Victini
0186a3a1c9 Add Sexytuple Effectiveness
Up to 64x Resists and 64x Weaknesses
2014-07-27 20:03:57 -04:00
V4Victini
2ae9d3d229 Merge pull request #920 from Slayer95/illusion
Remove illusion on forme change
2014-07-22 10:11:19 -04:00
Slayer95
3f567f9faa Revert "Send source effect data to the client on pokemon.cureStatus"
This reverts commit 82b8a48ba4.
2014-07-20 16:36:16 -05:00
Slayer95
7c4ffd2365 Send 'silent' attribute on swapPosition for auto-centering
Also refacor battle.swapPosition a bit to use more generic arguments.
2014-07-17 06:21:19 -05:00
The Immortal
4f9f48bf27 Revert "Remove redundant check in auto-centering"
This reverts commit 86b49322f5.
2014-07-17 14:31:31 +04:00
Slayer95
82b8a48ba4 Send source effect data to the client on pokemon.cureStatus 2014-07-17 05:28:02 -05:00
Slayer95
86b49322f5 Remove redundant check in auto-centering 2014-07-17 05:05:18 -05:00
Slayer95
2b082a479c Finish implementation of linked volatiles 2014-07-15 02:49:06 -05:00
Slayer95
26edd63959 Make sure that switched out pokemon get their moves cancelled
There are several issues alike to the one fixed in 62611b926b
2014-07-13 06:54:18 -05:00
The Immortal
0e262a40ae Add triples center message 2014-07-13 15:45:27 +04:00
Slayer95
4c8df32744 Merge branch 'triples' 2014-07-09 22:29:18 -05:00
Slayer95
be8ab7a213 Fix player disconnection ending turns prematurely 2014-07-07 15:25:08 -05:00
Slayer95
91a5429929 Add Triples Custom Game format 2014-07-03 23:44:23 -05:00
Slayer95
dd44cf3e2a Mummy reveals the ability the affected pokemon had 2014-06-23 17:52:27 -05:00
Slayer95
937a79489b Items can be taken from fainting targets 2014-06-23 17:13:41 -05:00
Slayer95
a7efa2c350 Make sure that moves restricted to adjacent targets have valid targets
Also Helping Hand's targetting is not hard-coded anymore.
2014-06-16 17:28:30 -05:00
Slayer95
bbcf60cd71 Support leaving empty slots when switching multiple mons in
This happens in Doubles or Triples if, in a single turn, more pokemon faint than can switch in.
This commit introduces two changes. Namely:
- If more pokemon faint in a single turn than can switch in, those with the higher positions now can have switch flags on.
- Passing a switch is now a valid decision that gets added to battle queue with maximum priority and disables the pokemon's switch flag.

As a side effect, this also allows running the battle engine in JS strict mode.
2014-06-16 17:26:17 -05:00
Slayer95
3ddddc3333 Triples: implement autocenter 2014-06-16 17:11:54 -05:00
Slayer95
ce8dde79b7 Shifting is now a valid decision in Triples 2014-06-16 17:09:04 -05:00
Slayer95
3e1df13e8e Remove a check from prior work on Triples 2014-06-16 17:05:57 -05:00
Guangcong Luo
136cbf8317 Correct faint order for Final Gambit 2014-06-12 13:37:40 -04:00
Slayer95
6a48ce030d Tweaks for adjacency check methods 2014-06-12 02:02:37 -05:00
Slayer95
a103efee91 Swap: send the target position to the client 2014-06-10 14:53:43 -05:00
Guangcong Luo
9d884372b0 Properly fix faint order for Iron Barbs etc 2014-06-09 06:37:14 -04:00
The Immortal
e89eb3b0fd Revert "Fix faint order for Iron Barbs etc"
This reverts commit e94940cd5f.
2014-06-09 13:43:35 +04:00
Guangcong Luo
b5d0c0b190 Merge pull request #993 from Slayer95/pursuit
Fix Gen 4 Pursuit
2014-06-09 03:20:03 -05:00
Guangcong Luo
e94940cd5f Fix faint order for Iron Barbs etc 2014-06-09 04:16:35 -04:00
Guangcong Luo
9fa425bff1 Refactor selfdestruct faint order fix 2014-06-09 04:14:54 -04:00
Slayer95
8f012febb7 Fix Gen 4 Pursuit 2014-06-09 02:43:20 -05:00
V4Victini
bd959a6965 Last Pokemon to faint wins. 2014-06-08 22:52:30 -04:00
Guangcong Luo
75bb5dd186 Fix Explosion faint order 2014-06-08 22:37:38 -04:00
Slayer95
79f83f1d2c Fix prevention of Arceus´ setType 2014-05-31 19:40:34 -05:00
Slayer95
fdbafd81f7 Fix message on Gooey´s activation 2014-05-17 01:28:10 -05:00
Slayer95
5d82f38b41 Fix recoil for multihit moves
- Recoil for Parental Bond Double Edge, etc should happen after all the hits have finished.
- Also removed the event 'Secondary', currently unused in the codebase.
2014-05-14 13:30:12 -05:00
Slayer95
7602236814 Escape HTML in crash reports
This has been overlooked for a while.
Directly calling sugar.js strings' escapeHTML method to avoid further crashes if Tools.escapeHTML is missing for any reason.
2014-05-12 23:04:45 -05:00
Guangcong Luo
5a4c5bd614 Merge pull request #931 from Slayer95/stats
Update client pokemon stats on forme change
2014-05-12 22:37:47 -05:00
Slayer95
b025743d34 Global 'sanitize' is now 'escapeHTML' method of Tools 2014-05-12 20:52:29 -05:00
Slayer95
d035b2ac07 Update client pokemon stats on forme change 2014-05-12 20:03:38 -05:00
Slayer95
f318c1e652 Remove illusion on forme change 2014-05-10 16:41:31 -05:00
Slayer95
4adada6853 Fix some bugs with mega evolution graphics
- Don't play the forme change animation when switching in.
- Fix interaction with illusion in the base forme (http://replay.pokemonshowdown.com/almostanyability-117184227 Turn 11)
2014-05-06 15:35:12 -05:00
Slayer95
70ebbf1fd6 Pass target location to ´beforeTurnCallback´
This fixes Assurance sometimes failing to track damage dealt in the turn.
2014-05-03 16:32:51 -05:00
Guangcong Luo
a14c16e899 Locked moves aren't targetable 2014-04-25 01:12:30 -04: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
小太
6c6f5c1eb4 Remove all trailling whitespace 2014-04-21 18:58:09 +10:00
Guangcong Luo
9f87e79e51 Merge pull request #836 from Slayer95/master
Remove some globals
2014-04-18 19:15:55 -05:00
Slayer95
05e7060474 Deprecate 'toUserid' global
Replaced by 'toId'.
2014-04-18 16:49:16 -05:00
Slayer95
3fc36ef80f 'clampIntRange is now a method of 'Tools' and no longer global 2014-04-18 15:14:54 -05:00
Guangcong Luo
64f6cc98a2 Refactor two-turn moves
They can no longer be redirected
2014-04-17 18:00:51 -04:00
Slayer95
4c18aa60f1 Remove global 'fs' 2014-04-17 14:37:32 -05:00
Slayer95
75559362b4 Rename global config to Config 2014-04-17 01:12:28 -04:00
Slayer95
eaa3e08646 Add methods to get effective Item or Ability
pokemon.hasItem and pokemon.hasAbility account for Gastro Acid, Klutz, Magic Room and Embargo
2014-04-16 18:52:03 -05:00
V4Victini
adbed9d633 Add pokeball field to sets 2014-03-26 15:48:27 -04:00
Slayer95
3327d3731d Fix Symbiosis not activating on berry consumption 2014-03-23 22:38:11 -05:00
小太
b17377d1ec Merge branch 'tournaments' into tournaments-frontend 2014-03-22 20:27:27 +11:00