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.
- Split it off from `runDecision` to `parseChoice`
- Internally, `decision.team` is now an array of zero-based positions.
- Guard against slot duplicates.
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.
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.
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.
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.
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.
- 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.
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.
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.
- Rename randbats helper function `canMegaEvo` to `hasMegaEvo`.
- Move duplicate mega evolution possibility checks from `runMegaEvo` and BattlePokemon constructor to `canMegaEvo` battle script.
- 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.
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.
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.