Commit Graph

194 Commits

Author SHA1 Message Date
V4Victini
95ebb17968 Update hasType to work with any number of types 2013-11-19 00:53:01 -05:00
V4Victini
03a96f41ae Fix Trapping Implementation
Until the next overhaul
2013-11-15 02:11:07 -05:00
V4Victini
15bb0e9862 Properly block priority moves with Quick Guard 2013-11-10 18:59:35 -05:00
V4Victini
2c661fed82 Quick Guard blocks all priority moves
Even ones with artificially enhanced priority
2013-11-10 18:14:57 -05:00
The Immortal
61564574fb Stance Change can't be removed 2013-11-02 11:15:36 +04:00
Guangcong Luo
6adb049585 By default, setAbility forces abilities to restart
i.e. mega-evolution, and skill swap when both abilities are the same,
will still reactivate Snow Warning or Intimidate
2013-10-26 17:25:32 -07:00
Guangcong Luo
0764c19a2c Fix Mega evo sprite not appearing when phazing 2013-10-24 20:42:20 -07:00
Bill Meltsner
05e58f554c Revert the changes that added Hidden Power Fairy.
It doesn't appear to actually exist. :(
2013-10-24 11:31:01 -07:00
Bill Meltsner
6df6d3c8d9 Implement Terrain, and update Camouflage and Nature Power accordingly.
Terrain is basically a copy/paste of weather code right now.
2013-10-24 02:09:45 -07:00
Guangcong Luo
8858d45d77 Fix Hidden Power 2013-10-24 00:20:46 -07:00
Guangcong Luo
a4f7cb6722 Fix horrible crash in gen 5 Chandelure 2013-10-23 23:12:25 -07:00
Guangcong Luo
fa9b0a2453 Autocorrect Hidden Power type
Hidden Power uses a different formula in gen 5 and 6; if the
teambuilder built it in the wrong gen, IVs will be wrong. So
if the Hidden Power type doesn't match the IVs, we'll change the
IVs rather than the Hidden Power type, which is most likely
what the user wanted.
2013-10-23 22:26:00 -07:00
Guangcong Luo
d595c5ae15 Properly activate abilities after Transform 2013-10-19 18:45:57 -07:00
Guangcong Luo
31fd8ea76a Implement mega evolution 2013-10-19 16:08:54 -07:00
The Immortal
3576508db4 Change "Dream World" to "hidden" abilities
- Removed dreamWorldRelease and added unreleasedHidden
- Replaced maleOnlyDreamWorld with maleOnlyHidden
- Replace 'DW' ability with 'H' ability
- Changed isDW variable to isHidden
2013-10-19 00:25:02 +04:00
Guangcong Luo
5de2ee0e3c Fix crash with bad event depth tracking 2013-10-11 15:01:42 -07:00
Guangcong Luo
7ff9dc56cb Implement Freeze Dry 2013-10-11 14:17:12 -07:00
V4Victini
f84ce07dbf Merge remote-tracking branch 'upstream/master' into modifiers 2013-10-11 15:52:42 -04:00
V4Victini
26f4943cc1 Remove unused variables 2013-10-11 15:49:17 -04:00
Guangcong Luo
0fde0397c8 Fix crash in onEffect events 2013-10-11 12:47:54 -07:00
V4Victini
4e663da55e Use this.chainModify for base power modifiers
This also fixes Technician
2013-10-11 15:09:47 -04:00
Guangcong Luo
8eeac69acb Crits are 1.5x in gen 6 2013-10-11 11:59:30 -07:00
V4Victini
224a0f10e2 Merge remote-tracking branch 'upstream/master' into modifiers 2013-10-11 14:17:25 -04:00
V4Victini
fb33b72e87 Use this.chainModify for stat modifiers
Also apply Sandstorm and Hustle boosts directly to the stat.
2013-10-11 14:05:51 -04:00
Guangcong Luo
65ad375891 runEvent can now chain a singleEvent
runEvent can run a modifier chain, so it's relevant that it can also
trigger a singleEvent on the passed effect within that chain.
2013-10-11 10:44:14 -07:00
V4Victini
d5c84dc134 Use this.chainModify for final modifiers 2013-10-11 13:25:14 -04:00
Guangcong Luo
1dd94f1639 Properly chain modifiers in an event 2013-10-11 09:57:43 -07:00
Guangcong Luo
84f983ca06 New modifier event chain system 2013-10-11 09:40:45 -07:00
Joimer
6d8f648855 Gens 5 and 6: Update moves.
Add gen 6 nerf of elemental attacks.
Add gen 6 static base power of Hidden Power of 60.
Change type of some attacks to Fairy on gen 6.
Add to mod 5 all gen 6 changes so mod 5 keeps the same way.
2013-10-11 10:12:46 +02:00
Joimer
c5d9b19b4c Gen 6: Update Hidden Power
The prefered IVs change in Gen 6 due to the addition of a new type.
2013-10-11 09:47:18 +02:00
V4Victini
8a119fefeb Chain base power modifiers
onBasePower events now affect the base power modifier as opposed to the
base power directly. Also some moves had their base power changes moved
from basePowerCallback to onBasePower. These moves affect the modifier
and not the base power.

Note: The effects of weather and burn are still incorrectly applied as
base power modifiers
2013-10-05 18:56:32 -04:00
V4Victini
fb4dd5e385 Merge remote-tracking branch 'upstream/master' into damage 2013-10-05 15:55:26 -04:00
V4Victini
61bb6f218e Fix crits breaking multi-hit moves
If one hit crit the rest would negate the atk penalties/def boosts as
well

Also I moved some stuff around to decrease redundancy
2013-10-04 22:58:46 -04:00
V4Victini
1755aab059 Reset isStarted flag for forced switches
i.e Dragon Tail, Circle Throw
These would only set isActive to false, which caused Trace to behave
improperly
2013-10-04 18:47:30 -04:00
V4Victini
697ab493e5 Use RNG for getRandomSwitchable 2013-09-28 15:46:24 -04:00
V4Victini
1c2a9a76c0 Chain Final Modifiers 2013-09-27 23:30:55 -04:00
The Immortal
2a9d249074 Transform ignores Substitute in Gen 4 2013-09-23 14:34:49 +04:00
Joimer
ec71aa13a2 Gen 6: Add Hidden Power Fairy support
With the blooming of gen 6 mods and the advent of gen 6, add support
for Fairy-type Hidden Power so it can be used in gen 6 or gen 5.5 mods.
hpTypes max at 15 on gen 2 calcs and gen 3+ calcs if the maxTypes var
is at 15, so adding Fairy-type to the types array is harmless.
2013-09-17 14:24:09 +02:00
小太
250aeb3260 Merge branch 'tournaments' into tournaments-frontend
Conflicts:
	app.js
2013-09-16 16:05:45 +10:00
V4Victini
78edf360f2 Re-add getStat function 2013-09-11 19:50:00 -04:00
V4Victini
0ef4a02b0c Run ModifyDef/SpD events properly
and remove Chlorophyll's debug message
2013-09-11 04:10:14 -04:00
V4Victini
3a7296df75 Overhaul the stat system and implement chaining
- Add Battle.prototype.chain to chain modifiers
- BattlePokemon.prototype.getStat is passed different parameters and no longer runs the ModifyBoost event nor the ModifyStat events.
2013-09-11 03:12:23 -04:00
Guangcong Luo
5403120683 Fix crits ignoring boosts for all hits of multi-hit moves 2013-09-07 16:29:23 -07:00
Joimer
8c3ad040f0 Remove outdated comments 2013-09-07 16:26:44 -07:00
Guangcong Luo
1ac2924de5 Healing moves now fail when the user's at full health 2013-08-17 23:10:04 -07:00
Guangcong Luo
70f78202e1 Fix Red Card activating on inactive pokemon 2013-08-11 21:33:58 -07:00
Joimer
5cfa629173 Remove annoying Debug message 2013-08-10 22:31:34 +02:00
Joimer
e96630ed4a Gen 2: Correct Hidden Power Base Power calculation
Brackets were missing.
2013-08-10 17:22:19 +02:00
Joimer
948ea295e7 Gen 2: Add format and ladder 2013-08-09 22:06:00 +02:00
Joimer
64d783aea0 Gen 2: Implement Hidden Power
Typechart is necessary for the types IVs for specific hidden powers.
2013-08-09 22:03:02 +02:00
小太
24279166b3 Core file edits to support frontend 2013-08-07 23:22:07 +10:00
The Immortal
a53c3d3e0d Abilities/items of fainted Pokemon should not activate 2013-08-04 23:23:33 +04:00
Guangcong Luo
f5647c5564 Fainted pokemon should still have singleEvents
This is relevant for having Future Sight hit from a fainted pokemon.
2013-08-03 15:04:03 -07:00
Joim
9671687fa9 Gen 1: Fix partial trapping moves at 0 PP.
In gen 1, previous to this fix, when you used the last PP of a partial trapping move you couldn't continue the sequence and would be forced into Struggle. This fixes it.
2013-08-02 12:32:56 +02:00
Guangcong Luo
9e7e589733 Fix confusion damage message 2013-08-01 15:41:10 -07:00
V4Victini
4f9ae3098e Properly seed RNG 2013-07-24 02:41:02 -04:00
Marty-D
1a02b3f23b Fix Mold Breaker and friends.
- With the recent changes to the damage formula, ModifyDamage must also
be negated by Mold Breaker.
2013-07-23 12:26:12 -04:00
Guangcong Luo
365e3dbbbc A lobby room is no longer required to exist
Without a lobby room, joining your server will default to displaying
the room list.
2013-07-14 17:59:48 -07:00
Guangcong Luo
a6608e5817 Refactor: Remove typeof ... === 'undefined' 2013-07-14 11:37:01 -07:00
Guangcong Luo
562d1edbba Refactor: Data is no longer a global
It can still be accessed with Tools.data or Tools.mod(mod).data
2013-07-14 11:37:01 -07:00
Guangcong Luo
76530e66ec Refactor: lockdown now a property of Rooms.global
(and no longer a global)
2013-07-13 19:15:31 -07:00
V4Victini
fb6b9ebde0 Correct RNG 2013-07-10 16:24:01 -04:00
小太
2ed8dbac3f Implement a faster and generalised Gen 5 LCRNG 2013-07-10 23:36:37 +10:00
V4Victini
441288743c Add missing bracket 2013-07-10 03:26:56 -04:00
V4Victini
e2e960aaf1 Force words unsigned
Make sure values in words remained unsigned integers
2013-07-10 02:18:20 -04:00
V4Victini
5588f4a3ca Upgrade RNG
Battle.prototype.random now uses the LCRNG for Gen 5
Battle.prototype.nextFrame calculates what the seed will be next turn or
next n turns.
2013-07-10 00:22:50 -04:00
Guangcong Luo
9961535879 Raise maximum event stack depth to 8 2013-07-05 14:10:34 -07:00
Marty-D
25597b01e4 Another Transform fix.
- Gen 5: Does not copy IVs.
- Gen 4 and earlier: Does copy IVs. (As a result, Hidden Power type and
Base Power are copied.)
2013-07-05 14:29:50 -04:00
Guangcong Luo
020fcec0d0 Throw an error on an event stack overflow
This will allow our crash logger and emailer to have detailed
information about the error.
2013-07-04 17:53:06 -07:00
Joim
0098202e05 Add final modifier after min damage check
In-game, final modifiers like Life Orb are calculated after the minimum damage is calculated instead of calculating it earlier on base power.

This event run will call all onModifyDamage events on said modifiers to thus correctly modify the damage using BattlePokemon.prototype.modify
2013-06-27 23:45:23 +02:00
Marty-D
40bb42f92d Correct Transformed PP and max PP. 2013-06-27 12:48:14 -04:00
Marty-D
2e54904458 Make sure minimum recoil damage is 1HP. 2013-06-21 16:50:31 -04:00
Guangcong Luo
b986a39c79 Fix 'Failed' message on Restart event 2013-06-17 10:53:57 -05:00
Guangcong Luo
b43ff0b645 Nearly all move failures now display a message 2013-06-16 03:41:00 -07:00
Cathy J. Fitzpatrick
9f1f47c4ce Introduce globals explicitly 2013-06-11 19:14:32 -06:00
Cathy J. Fitzpatrick
837f6a69ac Remove useless check for 'mustRecharge' volatile
There is no volatile called 'mustRecharge', so this check is pointless.
2013-06-10 20:48:14 -06:00
Cathy J. Fitzpatrick
871ed33d78 Fix move choice validation properly
The previous implementation of move choice validation allowed various
checks to be bypassed with crafted /move commands. For example, it was
possible to use arbitrary moves while in the invincibiltiy phase of
two-turn moves:

  http://pokemonshowdown.com/replay/dev-customgamenoteampreview-205

This commit fixes the validation mecahnics.

Compared to the last attempt at this, this commit also properly
handles Hidden Power.
2013-06-10 20:05:38 -06:00
Cathy J. Fitzpatrick
e4b5c92a27 Revert "Fix move choice validation" for now
This reverts commit 59ae64f840.
2013-06-10 19:56:35 -06:00
Cathy J. Fitzpatrick
59ae64f840 Fix move choice validation
The previous implementation of move choice validation allowed various
checks to be bypassed with crafted /move commands. For example, it was
possible to use arbitrary moves while in the invincibiltiy phase of
two-turn moves:

  http://pokemonshowdown.com/replay/dev-customgamenoteampreview-205

This commit fixes the validation mecahnics.
2013-06-10 16:19:37 -06:00
Marty-D
743c85127c Fix Transform.
- Gen 5: User cannot Transform if it or the target is already
Transformed.
- Gens 2-4: User cannot Transform if the target is already Transformed.
- Gen 1: User can Transform in both situations.
2013-06-10 11:52:25 -04:00
Guangcong Luo
f762f34385 Suppress a crash when a user leaves during a switch 2013-06-06 18:41:23 -05:00
Guangcong Luo
f527634692 Suppress an error for a weird race condition 2013-06-03 18:39:05 -05:00
Cathy J. Fitzpatrick
ee0cf88f7c Revert "Correct turn order mechanics"
This reverts commit c21674c835.
2013-06-02 15:15:54 -06:00
Cathy J. Fitzpatrick
c21674c835 Correct turn order mechanics
1) For the purpose of action sorting, a Pokemon's effective speed is
   `speed & 8191`.

2) Trick Room works by replacing a Pokemon's speed by `0x2710 - speed`.
2013-06-02 15:12:59 -06:00
Guangcong Luo
fee174e2a8 Multiline eval
">> " and ">>> " now accept multiple lines. In addition, ">> "
does not broadcast by default.

Their functionality are also available by !eval (which does
broadcast) and !evalbattle, although those are single-line.

While /eval doesn't broadcast, /evalbattle still does because
it's unnecessarily difficult to make simulator processes send
things privately.
2013-05-31 00:10:24 -07:00
Guangcong Luo
af80d6f3d5 Fix singleEvent relayVars 2013-05-29 03:31:47 -07:00
Guangcong Luo
26b527e261 Support NEXT base power modding 2013-05-29 03:06:13 -07:00
Guangcong Luo
9c54ddf05b Fix crash when a battle detects a crash
(Yo dawg, we heard you like... etc)
2013-05-29 02:47:36 -07:00
Guangcong Luo
32312a8468 Fix crash in sendUpdates 2013-05-29 02:20:47 -07:00
Cathy J. Fitzpatrick
3bfb0a46c2 Fix crashes in battles 2013-05-28 19:59:04 -06:00
Guangcong Luo
37ff5a4130 Nicer crash messages 2013-05-28 03:43:52 -07:00
Guangcong Luo
d5ca89b557 Better error handling for battle crashes 2013-05-28 03:18:55 -07:00
Guangcong Luo
84fa2443ec Update crash messages to new protocol 2013-05-28 03:18:55 -07:00
Guangcong Luo
238a709f3b Rename battles.js to battle-engine.js 2013-05-24 20:50:30 -07:00