namespace PKHeX.Core
{
///
/// Interface that exposes a for allowing a Pokémon into ranked battles if it originated from a prior game.
///
public interface IBattleVersion
{
///
/// Indicates which the Pokémon's moves were reset on.
///
int BattleVersion { get; set; }
}
public static class BattleVersionExtensions
{
///
/// Resets the 's moves and sets the requested version.
///
/// Reference to the object to set the
/// Reference to the same object that gets moves reset
/// Version to apply
public static void AdaptToBattleVersion(this IBattleVersion v, PKM pk, GameVersion version)
{
var moves = MoveLevelUp.GetEncounterMoves(pk, pk.CurrentLevel, version);
pk.Move1 = pk.Move2 = pk.Move3 = pk.Move4 = 0;
pk.RelearnMove1 = pk.RelearnMove2 = pk.RelearnMove3 = pk.RelearnMove4 = 0;
pk.SetMoves(moves);
pk.FixMoves();
v.BattleVersion = (int) version;
}
}
}