void SetSpecies(PokemonSpecies PokemonSpecies, int?AbilityIndex = null) { // Update if not nick name if (Name == null || Species != null && Name == Species.Name) { Name = PokemonSpecies.Name; } Species = PokemonSpecies; PrimaryType = Species.PrimaryType; SecondaryType = Species.SecondaryType; var newStats = new PokemonStats(this); if (Stats != null) { newStats.OnMegaEvolve(Stats); } Stats = newStats; if (AbilityIndex != null && AbilityIndex >= 1 && AbilityIndex <= 3) { Ability = Species.GetAbility(AbilityIndex.Value); AbilitySlot = AbilityIndex.Value; } else { Ability = Species.GetAbility(out var slot); AbilitySlot = slot; } }
public void OnMegaEvolve(PokemonStats Previous) { foreach (var key in _stages.Keys.ToArray()) { _stages[key] = Previous.GetStage(key); } IV = Previous.IV; EV = Previous.EV; CurrentHP = Previous.CurrentHP; }