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 void B_Boost_Click(object sender, EventArgs e) { SaveEntry(); var trand = GetRandomizer(); var settings = (TrainerRandSettings)PG_RTrainer.SelectedObject; trand.ModifyAllPokemon(pk => TrainerRandomizer.BoostLevel(pk, settings.LevelBoostRatio)); 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); }
private static void Main(string[] args) { string inPath = null, outPath = $"{DateTime.Now.Ticks}.nds"; if (args.Length > 0) { inPath = args[0]; } if (args.Length > 1) { outPath = args[1]; } if (inPath == null) { Console.WriteLine(@"Input path was not specified"); return; } var romHandler = new Gen5RomHandler(inPath); // TODO: Given pokemons were not randomized // TODO: Field items not randomized var world = new WorldRandomizer(romHandler); world.RandomizeStarters(true); world.RandomizeStaticPokemon(true); world.RandomizeIngameTrades(true, true, true); world.RandomizeFieldItems(true); world.RandomizeHiddenHollowPokemon(); // TODO: Only Shedinjas var trainer = new TrainerRandomizer(romHandler); trainer.TypeThemeTrainerPokes(true, false, true, true); var wild = new WildRandomizer(romHandler); wild.RandomEncounters(EncountersRandomization.CatchEmAll, false); // TODO: TMs were not randomized var move = new MoveRandomizer(romHandler); move.RandomizeTmMoves(true, false, true, 1.0); move.RandomizeTmhmCompatibility(TmsHmsCompatibility.RandomPreferType); move.RandomizeMoveTutorMoves(true, false, 1.0); move.RandomizeMoveTutorCompatibility(true); var util = new UtilityTweacker(romHandler); util.ApplyFastestText(); util.RemoveBrokenMoves(); util.RemoveTradeEvolutions(false); if (File.Exists(outPath)) { for (;;) { Console.Write(@"{0} allready exists. Want to replace it? [Y/n]: "); var readLine = Console.ReadLine(); if (readLine == null) { continue; } var answer = readLine.Trim().ToLower(); Console.WriteLine(); if (answer == "" || answer == "y") { File.Delete(outPath); romHandler.SaveRom(outPath); break; } if (answer == "n") { break; } } } else { romHandler.SaveRom(outPath); } }