Move effects

*For defining a move, see Defining a move.*
*For animating a move used in battle, see Attack animations.*
*For things that some moves can do in the overworld, see Using moves outside battle.*
This page describes the kinds of in-battle **move effects** that exist in Essentials.

## Move effects

Moves can have special effects or properties that govern what they do and how they interact with other moves/abilities/etc. Even a move like Tackle, which just deals damage, has some properties that indicate that it can be blocked by Protect and that the user makes physical contact with the target.

Generally speaking, a **function code** defines what a move does, and **flags** define certain aspects of what the move is.

## Flags

A move can have any number of flags. Each flag is a piece of text as defined in the PBS file "moves.txt". There are a number of existing flags, each of which means something about the move. The flag "ThawsUser" indicates that the move will thaw the user before being used if the user is frozen, while the flag "Sound" indicates that the move is based on the use of sound. Moves with the flag "Bomb" are resisted by the ability Bulletproof. Some flags, like "Sound", have a variety of special interactions with other moves and effects.

See the Defining a move for a full list of existing flags and their meanings.

## Function codes

Most damaging moves, and all status moves, have a special effect beyond simply dealing damage. This effect can range from simple ones like poisoning the foe, to complex and/or unique ones like Transform. To describe what a particular move does, it is assigned a function code. Note that even "just deals damage" has its own function code, although this more accurately means "has no special effect beyond dealing damage".

A function code describes a particular move effect (e.g. "moves with this function code may poison the foe"). Several moves can share the same function code, although a move can only have exactly one function code. Each function code is written as a string of text with no spaces (e.g. "None", "FreezeTarget", "HitTwoTimes", "PowerDependsOnUserStockpile").

The various effects associated with a particular function code are (mostly) defined in a number of script sections beginning with **MoveEffects\_**, with each function code having its own class called `class Battle::Move::XXX` (where "XXX" is the function code). The contained methods can be any of the methods found in `class Battle::Move` (which the function code's class is always a child class of), and can either replace or supplement them. The names of the methods are usually self-explanatory.

Rarely, a function code's class will empty, because its effect has to be handled elsewhere in the scripts and cannot easily be separated out into its function code's class. See below for more information.

### Function codes in other scripts

Some move effects, or parts thereof, exist outside of the **MoveEffects\_** script sections. These effects are referred to by their function codes (because one function code is one effect regardless of which particular move has it).

Function codes which appear elsewhere include the ones for:

* Curse, Helping Hand, Hidden Power, Psyshock, Rage, Secret Power, some others.

These effects (or parts of effects) exist elsewhere because they cannot be extracted from where they are and put neatly into the function code's class as described above.

## Priority

A move's priority is a number between -6 (lowest) and +6 (highest) which helps to determine in which order moves should be used in a round of battle. A full description of what this number does can be found on the Internet, as it is a fundamental Pokémon mechanic.

In Essentials, a move's priority is defined separately from its effect. For example, Quick Attack has the function code "None" (no special effect) yet it has a priority of +1 (higher than normal).

## Causing a lingering effect

A lingering effect is one which applies to the battle even after the move causing it has been used (even if it is just part of/a result of that move's effect). Such effects include Leech Seed, Reflect, weather-creating effects, Bide, Disable, Ingrain, toxic poisoning, and so forth. That is, they can perform a wide range of functions.

A number of variables are defined at the start of a battle, either for each battler, each position, each side or for the whole field. They usually start in their "off" state. Using a move with a lingering effect will change the appropriate variable. Various things will depend on the values of these variables (e.g. if a battler's `effects[PBEffects::Confusion]` value is greater than 0, then it is confused and should behave accordingly). A full list of these variables is available in the script section **PBEffects**. They are typically named after the move that has the lingering effect.

Some lingering effects have multiple variables associated with them. For example, Bide has three: one to state that it is being used, one which records the damage taken, and one which remembers the last Pokémon to attack it (which will be Bide's target when it deals damage). On the other hand, some variables are used by multiple moves. For example, the variable `TwoTurnAttack` is used by several different moves with several different function codes; no more than 1 of them can ever be used at once so they don't clash, and this particular part of the effect is the same for all of them.

As mentioned earlier, some effects are battler-specific while some are side-specific, and some apply only to the whole field. All kinds are listed in the script section **PBEffects**. The position-specific, side-specific and field-specific effects are defined (i.e. set to their "off" values) in the script section **Battle\_ActiveField**, while the battler-specific effects are defined in the script section **Battler\_Initialize**.

All lingering effects will always be referred to in the form `effects[PBEffects::Confusion]`, with the actual name of the effect being the only difference. This makes them easy to search for.

Any further details about lingering effects are unnecessary and would be overly specific. You will likely not need to know even this much. If you are creating your own move effect with a lingering effect, this information shows how they are defined and how to find them; you can look at relevant examples yourself.

## Tips

* If you are making a new move which is similar to an existing move, look at how the existing move works and copy it.