Commit Graph

287 Commits

Author SHA1 Message Date
Kevin Lau
94734a837c Fix ModifyBoost in calculateStat
It doesn't use the Pokemon's boosts.
2015-03-27 21:02:40 -07:00
Kevin Lau
ab80397192 Refactor Unaware to use ModifyBoost
Cleans up the code quite a bit because it no longer needs the hardcoding
option that it was having.
2015-03-26 20:06:47 -07:00
Marty-D
70e465157c Merge pull request #1656 from ascriptmaster/oldgens
Generation 4: Fix Transform's interaction with items
2015-03-26 18:23:59 -04:00
Kevin Lau
47ea3b5f32 Refactor ModifyBoost to use objects
This allows ModifyBoost handlers to check the stat names properly.
2015-03-26 13:00:49 -07:00
Kevin Lau
52d5721471 Generation 4: Multitype prevents the removal of any item from Arceus 2015-03-24 22:11:23 -07:00
The Immortal
bf3898273e Fix Mirror Move mechanics for gens 3 and 4
lastAttackedBy is now reset if the attacker is no longer active.

Note: Mirror Move has extremely complicated mechanics and this does not
implement it completely but does as much as possible.
2015-03-25 03:25:48 +04:00
Ivo Julca
dbf3993a64 Improve validation of team order decisions
- Split it off from `runDecision` to `parseChoice`
- Internally, `decision.team` is now an array of zero-based positions.
- Guard against slot duplicates.
2015-03-23 14:37:06 -05:00
Ivo Julca
cedc60c7fc Fix fallback for switch-in requests 2015-03-22 15:55:02 -05:00
Guangcong Luo
d89a77ac87 Merge pull request #1639 from ascriptmaster/modifypokemon
Weight Refactor: Do not modify weight in ModifyPokemon
2015-03-21 22:38:43 -05:00
Kevin Lau
2eebf29d92 Generation 4: Fix Transform's interaction with item-based forme changes
Causes Dittos transforming into Giratina-O without Griseous Orb to revert
to Giratina-A in Generation 4, etc.
2015-03-21 19:05:42 -07:00
Marty-D
ed074532c6 Make sure the flags object always exists 2015-03-21 14:29:07 -04:00
The Immortal
7e6d18a93e Change triples comment again 2015-03-21 19:25:25 +04:00
The Immortal
0affd4ee8d Change triples comment 2015-03-21 15:37:21 +04:00
Guangcong Luo
9c4a376d2c Support onAny for side conditions
This improves the battle engine by adding support for onAny in side
conditions.
2015-03-20 17:28:45 -04:00
Kevin Lau
b0c2dcde5f Weight Refactor: Do not modify weight in ModifyPokemon
Added a new event, ModifyWeight, to deal with weight changes from items,
abilities, and moves. Add a function getWeight to call the event and
return a Pokemon's current weight.
2015-03-18 18:44:01 -07:00
DanUgore
848992001e RNG: Use Gen 6 Damage Roll Calculation 2015-03-18 03:16:32 -04:00
Juanma Serrano
cde53e7fea Gen 1: Reorder and document code
Put the functions in the order they are found in scripts.js and battle-engine.js.
Use main addQueue and runDecision options, minor past gens change are dealt with in there.
Add comments on what everything does and relevant Gen 1 mechanics for ease of understanding.
2015-03-17 16:41:00 +01:00
Kevin Lau
d36297d491 Generation 4: Fix Simple to use proper DPP mechanics
In Generation 4, Simple did not double stat boosts as they changed.
Instead, it treated each stat boost as if it had twice the effect.
Reimplemented the deprecated ModifyBoost event, but with slightly
different functionality as before; it now modifies the live boosts so that
they work properly with Simple.
2015-03-13 18:02:33 -07:00
Guangcong Luo
1284f7097c Update before switches in Gen 5+
This fixes the bug where berries don't activate before a U-turn
switch, or before an Outrage faint-switch.
2015-03-06 21:19:51 -05:00
Guangcong Luo
6fd5f057ab Only damage/heal/boost active Pokemon
This mainly fixes a bug where Life Orb would activate after Red Card
in Doubles.
2015-03-06 00:30:38 -05:00
Guangcong Luo
0bce4b3c7b Merge pull request #1560 from ascriptmaster/move-fixes
Item Removal Fixes
2015-02-26 13:57:41 -06:00
Kevin Lau
aaea0556f7 Fix Pickup to use correct behavior
Pickup was not retrieving items consumed by allies, was picking up items
from nonadjacent foes, and had a chance of failing to retrieve an item
from a foe if the other one had not used its item that turn. Pickup now
queries all eligible Pokemon before randomly choosing one of the items to
pick up, instead of choosing the target before checking whether it had an
item that could be retrieved.
2015-02-25 20:19:09 -08:00
Kevin Lau
45a43e0e8c Remove irrlevant events from Mold Breaker suppression
There are currently no abilities negated by Mold Breaker that use the
EatItem or UseItem events. This fixes Mold Breaker's interaction with
Cheek Pouch.
2015-02-25 19:13:38 -08:00
Marty-D
6ebb25d142 Gen II, IV: Fix (Hi) Jump Kick crash damage
Gen 2: 1/8 potential damage, not capped; no damage if target is immune
Gen 4: damage is 1/2 target's max HP if it is immune
2015-02-24 10:06:32 -05:00
Ivo Julca
968acffd5d Save RNG initial state in battle logs 2015-02-14 17:07:28 -05:00
Guangcong Luo
2ea6963f03 Merge pull request #1527 from Slayer95/resolve-decision
Choice parsing: support turn timeout decisions
2015-02-14 02:19:27 -06:00
Ivo Julca
1e6d387cf7 Choice parsing: 'default' is now a valid choice for move requests
- Its result is equivalent as timing out on own turn in-game: it forces the Pokémon, as well as any remaining active Pokémon to use their first available move, and target randomly. To maximize similarity, this decision is not be cancelable.
- Reject move choices in Doubles/Triples that don't specify a target when required.
- 'default' is not implemented -but reserved- for switch requests as it's currently no different from choosing the next available Pokémon.
2015-02-13 19:43:28 -05:00
Ivo Julca
b9137d5d37 Implement BattleSide#resolveDecision
It will be useful to support decision fallbacks for turn timeouts.
2015-02-13 19:43:10 -05:00
Kevin Lau
4884ec66ba Weather Refactor: Regular weathers don't activate w/ Primal Weather set
Moved all checks for primal weather into setWeather() instead of
hard-coding the check into every effect attempting to change the weather.

Also to prevent hardcoding, the check now runs on the event system, and
the primal weathers themselves deny regular weathers from being set.
2015-02-12 14:39:50 -08:00
Marty-D
22505556ec Fix Powder 2015-02-10 11:41:01 -05:00
Guangcong Luo
956566f856 Merge pull request #1502 from Joimer/UnawareFix
Fix Unaware in Doubles and refactor stat ignoring abilities
2015-02-05 11:59:21 -06:00
Juanma Serrano
64b2246260 Fix Unaware in Doubles and refactor stat ignoring abilities
Unaware currently doesn't work because the ModifyMove event is fired on the move before each target is caculated in doubles and triples.
This means that the ModifyMove event should be fired for each target and the move not modified unless it fits the attacker-target.
It's easier and less expensive to use an ability property to check on attacker/target than to fire events.
This fixes Unaware in doubles/triples.
It takes account interaction with Mold Breaker, Gastro Acid, and other ability supressers.
2015-02-05 10:38:17 +01:00
Guangcong Luo
23c67c9140 Quit PS child processes when parent quits
Previously, child processes would stick around in certain cases.

Fixes #1507.
2015-02-05 01:16:47 -06:00
Guangcong Luo
43ed3cbbbf Merge pull request #1487 from Slayer95/mega-evolution
Pokémon cannot megaevolve to themselves
2015-01-30 20:44:54 -06:00
Ivo Julca
6607d1c53b Pokémon cannot megaevolve to themselves
- Rename randbats helper function `canMegaEvo` to `hasMegaEvo`.
- Move duplicate mega evolution possibility checks from `runMegaEvo` and BattlePokemon constructor to `canMegaEvo` battle script.
2015-01-30 20:54:34 -05:00
Ivo Julca
332cd2af79 Support making cancel unavailable
- Whether players can undo actions or not is toggled by the Battle property `supportCancel`.
- Send information to the client regarding availability of cancel for each battle request.
2015-01-29 21:38:33 -05:00
Juanma Serrano
0b394381bc Fix Travis build after npm update
Fix errors that weren't triggering before:
Missing spaces after semicolons.
Missing spaces after tests.
2015-01-15 09:22:08 +01:00
Juanma Serrano
6b672a1b37 Stadium: Exact HP is always shown for both sides 2015-01-14 17:37:45 +01:00
Juanma Serrano
e4b67dae41 Gen 2: Residual happens even after switch in after a faint
This is the case for Leftovers, which happens at the end of the turn even if the Pokémon was switched in after a faint
2015-01-13 10:14:17 +01:00
Guangcong Luo
5c8ddc6983 Refactor gen 2 fainting
Makes gen 2 use the modern fainting system.
2015-01-10 01:39:35 -05:00
Guangcong Luo
ba426e0a73 Fix Burn+Explosion
Explosion/Selfdestruct used to be unaffected by burn. This commit
fixes that.
2015-01-10 01:39:35 -05:00
Guangcong Luo
2a3c4e71dd Gen 1-3: Fix faint mechanics
Faint mechanics are now handled in the battle engine, instead of
hackily in the data files.

This also makes it so the case of Pokemon fainting mid-turn in
gen 3 singles correctly ends the turn.
2015-01-09 01:45:19 -05:00
Marty-D
9832f6b73b Fix bug in Hidden Power display for past gens 2015-01-02 12:58:31 -05:00
Marty-D
7ad8977a74 Weather can be reset by its own move in Gen II 2015-01-02 12:55:44 -05:00
Joimer
91f5f5f6b2 Gen 1: Fix faint mechanics with two turn moves
End events were not being called as queue was being emptied too soon.
Reverting with this commit part of commit 85994c45d8, as turn is properly ended on gen 1 modded's faint function.
Turn still ends after a faint properly, statuses (like psn) do not drop health from surviving Explosion targets.
2014-12-29 01:29:09 +01:00
Juanma Serrano
6fc7ce6ffa Implement challenge logging
Servers that change their configuration to do so can now log challenge battles.
2014-12-18 19:05:33 +01:00
小太
6138ab9e0b Add REPL sockets 2014-12-14 23:11:13 +11:00
Ivo Julca
1dae1ef02e Add missing send method to BattleSide
9406a4a62d
2014-12-10 13:54:17 -05:00
Guangcong Luo
80704c272d Merge pull request #1298 from Slayer95/disabled-maybe
Hide moves disabled by Imprison or NEXT's Telepathy
2014-12-10 03:57:30 -06:00
Guangcong Luo
549d9d5b0a Revert "Explosion and Self-Destruct bug-fix"
It broke faint mechanics. :(

This reverts commit 40b2c8ec47.
2014-12-07 16:33:28 -06:00