This fixes Pokemon having two of the same type moves, for example
Fire-types with Fire Blast and Lava Plume or Psychic-types with Psychic
and Psyshock, because the Hidden Power was rejected.
Battle is now an ES6 class... mostly... it's complicated.
Battle's inheritance system has always been a mess. I tried to redo it
in a sensible way but it caused nondeterministic test failures. Not
even kidding; different things would fail each time I ran tests, even
without code changes. I'll investigate closer later, but this refactor
makes it use ES6 classes with only a small amount of hacking, which is
good enough. It is, at the very least, simpler than the previous mess.
BattleEngine.Battle.construct has been renamed BattleEngine.construct.
Corrects all of the following
Gen 2: lasts 2-3 turns
Gen 3: can't hit Ghosts
Gen 4: can hit Ghosts, stops immediately when the user falls asleep or
becomes frozen
Gens 2-6: Stops immediately when the user is prevented from moving
A variable named "pokemonLeft" should probably not be increasing. Since
it's effectively referring to the current size of the team, might as well
use Array.length.
Due to the "each type combination only once" restriction, Normal-type
teams had a ~0.1% chance of having only 5 members, as most of its type
combinations are only used by a single mon which could easily be skipped
due to tier restrictions or bad luck.
The types were also not sorted before filtering, so it was entirely
possible to have Fighting/Psychic and Psychic/Fighting on the same team.
So, this sorts before filtering, but raises the limit to 2 of each
combination per team, which hasn't yielded any 5 mon teams across 10000
generated teams.
- Boosts now show the correct boosting message (i.e. using Swords Dance
at +5 Attack will show the +1 message instead of +2).
- Boosts now show the appropriate maxed out message when a stat cannot
be raised/lowered further, instead of simply failing or failing
silently, unless the boost is an additional effect.
- Remove `randomMonotypeTeam` and use `randomTeam` for Monotype Random
Battle. This prevents having to maintain two functions, in addition to
removing duplicate code.
- Improve Monotype teams by preventing more than one of the same type
combination.
- Remove no longer needed Pichu-Spiky-eared check from
`randomDoublesTeam`.
While Slaking has a gimmick use with skill swap, gastro acid, simple ray, etc., in this random format it makes a battle basically a 5v6 battle, where you can Protect on its loafing around turns or make it switch, lowering offensive pressure and receiving more damage.
* Random Battle: Don't reject Swords Dance with no-sun Growth
This will allow Growth to be rejected first. Affects Victreebel.
* Implement fastPop function
fastPop is a generalization of sampleNoReplace. While sampleNoReplace
removes a random element from the array without regard to order, fastPop
allows for a specific element to be removed. This speeds up the removal of
items from the move pool in random battles in situations where it is
needed.
* Random Battle: Remove Weather Ball from pool if Sunny Day is rejected
Among the newly added rules, there are quite a few intended to enforce
compliance of CONTRIBUTING.md-blessed idioms, as well as ensure
safe usage of classes and constant bindings.
We are also now enforcing usage of early return in commands.js,
which has 100% compliance as of fd2c45c.
- Improve Flying types by making sure they have a second STAB if they
need it
- Revert bf0af09d7c and instead hardcode
the moveset modification for Aggron; Autotomize does have a benefit
with Heavy Slam
Now that nodejs/node#3072 is mostly fixed, we can finally start using
Node 4+ features.
This refactor:
- uses arrow functions where appropriate
Note that arrow functions still aren't used in Mocha, where `this`
is sometimes meaningful.
This also removes the need for .bind() nearly everywhere, as well
as the `self = this` trick.
- refactors Validator and Connection into ES6 classes
- no longer uses Array#forEach for iterating arrays
We strongly prefer for (let i = 0; i < arr.length; i++) because of
performance reasons. Most forEaches have been replaced with for..of,
though, which is 5x slower than the long-form loop but 2x faster
than forEach, which is good enough outside of most inner loops.
The only exception is tournaments, which is due for a more invasive
refactor soon anyway.
Crashlogger now supports passing in a dictionary of additional
information to report, so we no longer need to resort to making fake
errors.
The hadException parameter has now been removed entirely. I don't know
of a use case for it to be false.
Because of how moves are generated when a Pokemon has a setup move in its
move list, Seviper has a high chance of getting bad sets if Poison Jab is
rejected and Coil is added to its moves.
- Add a counter for draining moves; give Pokemon Life Orb with
Substitute if they have a draining move
- Do not Reject U-turn on Mega Beedrill
- Prevent Focus Sash on lead Pokemon that have a recovery move
- Increase the level of non-setup Slurpuff
- Remove AG Pokemon from Random Battle
- Do not reject attacking moves if they are none in the pool; no STAB
is better than a messed up set
- Set HP to activate Sitrus Berry after two subs
- Fixes#2306
- Fix Mega Lucario with only Bullet Punch as STAB
- Make sure dual typed Dark Pokemon have a reliable STAB
- Make sure dual typed Psychic Pokemon have a second STAB
- Only reject moves if there are moves in the pool to replace it
- Add Earth Power to Arceus-Dragon as it only has two Special moves
(which results in bad sets because of Calm Mind)
- Increment the correct type counter for Judgment
- Make sure Dragon types have a Dragon move, in certain circumstances
- Fix the “Pokemon should have benefiting moves” check to reject the
right moves (such as rejecting the 2nd setup move, and moves of the
incorrect setup type, first)
- Reject Focus Punch, Sucker Punch, and Hidden Power when moves are
processed, not after (if they are the only attacking move)
- Simplify the checks for too many Dark moves by using the new type
counter; this should fix remaining Spiritomb issues as well
Genesect formes tend to get bad sets because of the obligatory Techno
Blast. Removed Physical setup from them to fix this.
In addition, removed moveset modifications as they are no longer needed.
- Add Vacuum Wave to Infernape
- Replace Thunder Punch with Stone Edge on Hawlucha
- Don’t count Vacuum Wave as STAB
- Prevent Vacuum Wave with Close Combat or Mach Punch
- Make sure Darkrai has Dark Void
- Make sure Yveltal has a Dark move
- Check the move pool of a Pokemon when deciding to accept
Physical/Special setup
- Don’t count `NoStab` moves as STAB for Protean users
- Prevent Dark Pulse with Hyperspace Fury
- Fix Aura Sphere/Shadow Claw rejection to check setup
- Prevent too many Ice moves on Refrigerate Pokemon
- Reject Acid Spray with any Special moves
- Do not reject Bullet Punch with Adaptability
- Improved the rejection of moves that don’t satisfy setup requirements
- Make sure Gale Wings has a Flying move
- Remove unneeded combo checks (the consensus is that STAB is better
than Ghost/Fighting or Electric/Ice coverage)
- Give AG (Mega Rayquaza) the same chances of appearing as Uber
Gligar always gets Immunity.
Reject Solar Power on Mega Charizard (both formes)
Update move selection to ensure Fire Pokemon with Drought/Sunny Day get a
Fire move.
Adds counters for each type in queryMoves. Many updates to ability checks
were also needed.
Also, update Random Double Battles to use teamDetails like Singles.
By checking the damagingMoves index length instead of the number of
Physical and Special moves, it not only ensures no Life Orb for Pokemon
with Rapid Spin, but also Nuzzle (such as Pachirisu) and any other
potential cases that have been missed.
- Use the recently added `battleOnly` template property to handle formes not directly allowed in-battle.
- Implement utility method `checkBattleForme` to unify handling of Mega and Primal formes.
Reject Sucker Punch if it is the only STAB move on a Pokemon with moves
that boost Special attacks.
Fix issues with setupType not being set properly with setup moves
appearing in mixed sets.
- Prevent Quick Attack as the only STAB on -ate
- Make Adaptability Pokemon get more than one STAB
- Allow Guts with RestTalk
- Make sure Milotic has Marvel Scale with RestTalk
Assault Vest disallows it.
Choice Band and Specs lock into it without giving a proper boost.
We give Life Orb to those so they can get a general damage boost.
- Don’t count Pursuit as STAB
- Prevent phazing moves with setup (unless with RestTalk)
- Prevent Fire Fang with Fire Blast
- Prevent Zen Headbutt with Psychic
- Prevent Substitute with Rest
- Remove Counter exception so Pokemon with it get their sets checked
- Make sure certain Pokemon always get a recovery move (currently:
Alomomola, Chansey, Blissey)
Add new sets for Cherrim-Sunshine specifically.
Reject Mach Punch as the only STAB move if the Pokemon does not have
Technician. Affects almost every Fighting Pokemon except Breloom.
Reject Bullet Punch as the only STAB move if the Pokemon does not have
Technician. Affects Metagross and Mega Lucario.
Don't count Charge Beam as singular STAB, and add checks for redundancy
with Thunderbolt based on the number of remaining Special moves. Affects
Emolga and Magnezone.
Reject Sheer Force with Fake Out in Doubles. Affects Hariyama.
Reject Flash Cannon with Iron Head in Doubles to match the rule in
Singles. Affects Aegislash.
Add Freeze-Dry as an option to Mega Glalie sets. Removed Crunch from its
Singles set and Taunt from both sets. Reject Ice Shard with Freeze-Dry so
it doesn't get too many Ice-type moves.
- Add Protect and Sleep Talk to Registeel
- Allow Shadow Sneak as the only STAB on mono-Ghosts
- Prevent Night Shade/Seismic Toss with STAB
- Reject Thunder Wave with Toxic instead of the reverse
- Remove Wake Up Slap because it's no longer Technician boosted.
- Change Technician to reject if a Pokemon has Skill Link and all their
Technician-boosted moves are Skill Link moves.
- Added Aqua Tail.
Miscellaneous changes:
- Placed Sheer Force within the counterAbilities section.
- Sorted the coutnerAbilities in the Random Doubles Battle code.
Reject Solar Power if there are no Special moves (affects Charizard).
If Rampardos does not have Head Smash, make sure it gets Sheer Force.
Don't set the setup type to Physical if there are no Physical moves and at
least two Special moves (or vice versa for Special setup)