private TrainerRandomizer GetRandomizer() { var moves = Game.Data.MoveData.LoadAll(); var rmove = new MoveRandomizer(Game.Info, moves, Personal); int[] banned = Legal.GetBannedMoves(Game.Info.Game, moves.Length); rmove.Initialize((MovesetRandSettings)PG_Moves.SelectedObject, banned); int[] ban = new int[0]; if (Game.Info.SWSH) { var pt = Game.Data.PersonalData; ban = pt.Table.Take(Game.Info.MaxSpeciesID + 1) .Select((z, i) => new { Species = i, Present = ((PersonalInfoSWSH)z).IsPresentInGame }) .Where(z => !z.Present).Select(z => z.Species).ToArray(); } var rspec = new SpeciesRandomizer(Game.Info, Personal); rspec.Initialize((SpeciesSettings)PG_Species.SelectedObject, ban); learn.Moves = moves; var evos = Game.Data.EvolutionData; var trand = new TrainerRandomizer(Game.Info, Personal, Trainers.LoadAll(), evos.LoadAll()) { ClassCount = CB_Trainer_Class.Items.Count, Learn = learn, RandMove = rmove, RandSpec = rspec, GetBlank = () => (Game.Info.SWSH ? (TrainerPoke) new TrainerPoke8() : new TrainerPoke7b()), // this should probably be less specific }; trand.Initialize((TrainerRandSettings)PG_RTrainer.SelectedObject); return(trand); }
private void B_Randomize_Click(object sender, EventArgs e) { SaveEntry(); var moves = Game.Data.MoveData.LoadAll(); var rmove = new MoveRandomizer(Game.Info, moves, Personal); int[] banned = Legal.GetBannedMoves(Game.Info.Game, moves); rmove.Initialize((MovesetRandSettings)PG_Moves.SelectedObject, banned); var rspec = new SpeciesRandomizer(Game.Info, Personal); rspec.Initialize((SpeciesSettings)PG_Species.SelectedObject); var trand = new TrainerRandomizer(Game.Info, Personal, Trainers.LoadAll()) { ClassCount = CB_Trainer_Class.Items.Count, Learn = learn, RandMove = rmove, RandSpec = rspec, GetBlank = () => new TrainerPoke7b(), // this should probably be less specific }; trand.Initialize((TrainerRandSettings)PG_RTrainer.SelectedObject); trand.Execute(); LoadEntry(); System.Media.SystemSounds.Asterisk.Play(); }
private TrainerRandomizer GetRandomizer() { var moves = Game.Data.MoveData.LoadAll(); var rmove = new MoveRandomizer(Game.Info, moves, Personal); int[] banned = Legal.GetBannedMoves(Game.Info.Game, moves.Length); rmove.Initialize((MovesetRandSettings)PG_Moves.SelectedObject, banned); var rspec = new SpeciesRandomizer(Game.Info, Personal); rspec.Initialize((SpeciesSettings)PG_Species.SelectedObject); learn.Moves = moves; var evos = Game.Data.EvolutionData; var trand = new TrainerRandomizer(Game.Info, Personal, Trainers.LoadAll(), evos.LoadAll()) { ClassCount = CB_Trainer_Class.Items.Count, Learn = learn, RandMove = rmove, RandSpec = rspec, GetBlank = () => (Game.Info.SWSH ? (TrainerPoke) new TrainerPoke8() : new TrainerPoke7b()), // this should probably be less specific }; trand.Initialize((TrainerRandSettings)PG_RTrainer.SelectedObject); return(trand); }