Pokémon Gold Version, Silver Version, and Crystal Version - Last move used
Several moves rely on the the last move a Pokémon had used, which need not
occur immediately beforehand. For instance, the Pokémon may use an item or
try to run away in between. This variable is reset when either Pokémon
leaves the battle. This variable is reset if the move is Metronome, Mimic,
Mirror Move, Sketch, Sleep Talk, or Transform, and the variable is not set
to moves used by other moves. Hyper Beam and two-turn attacks are considered
the last move used on both attack segments of use (except if they were used
by other moves). The use of Pursuit as the opposing Pokémon is about to
switch, and the returned attack from Future Sight, are ignored when
determining the last move used.
Each Pokémon in battle has a different "last move used" variable.
The "last move used" is not reset if an attack is prevented from being used or if it can’t be used because it has zero PP.
Encore uses a variant of the last move used, with the difference being that the variable is not reset for a Pokémon if it remains in battle but its the opposing Pokémon leaves the battle.