private void B_RandAll_Click(object sender, EventArgs e) { setList(); var sets = files.Select(z => new Learnset6(z)).ToArray(); var banned = new List <int>(new[] { 165, 621, 464 }.Concat(Legal.Z_Moves)); // Struggle, Hyperspace Fury, Dark Void if (CHK_NoFixedDamage.Checked) { banned.AddRange(MoveRandomizer.FixedDamageMoves); } var rand = new LearnsetRandomizer(Main.Config, sets) { Expand = CHK_Expand.Checked, ExpandTo = (int)NUD_Moves.Value, Spread = CHK_Spread.Checked, SpreadTo = (int)NUD_Level.Value, STAB = CHK_STAB.Checked, rSTABPercent = NUD_STAB.Value, STABFirst = CHK_STAB.Checked, BannedMoves = banned, Learn4Level1 = CHK_4MovesLvl1.Checked, }; rand.Execute(); sets.Select(z => z.Write()).ToArray().CopyTo(files, 0); getList(); WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!"); }
private void B_RandAll_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize Static Encounters? Cannot undo.", "Double check Randomization Settings before continuing.") != DialogResult.Yes) { return; } setGift(); setEncounter(); setTrade(); var specrand = getRandomizer(); var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); for (int i = 3; i < Gifts.Length; i++) // Skip Starters { var t = Gifts[i]; t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); if (CHK_Level.Checked) { t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } } foreach (EncounterStatic7 t in Encounters) { t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); if (CHK_Level.Checked) { t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } } foreach (EncounterTrade7 t in Trades) { t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); t.TradeRequestSpecies = specrand.GetRandomSpecies(t.TradeRequestSpecies); if (CHK_Level.Checked) { t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } } getListBoxEntries(); getGift(); getEncounter(); getTrade(); WinFormsUtil.Alert("Randomized Static Encounters according to specification!"); }
private void B_LearnMetronome_Click(object sender, EventArgs e) { var settings = (LearnSettings)PG_Learn.SelectedObject; var rand = new LearnsetRandomizer(ROM.Info, Editor.Learn.LoadAll(), Editor.Personal); rand.Initialize(ROM.Data.MoveData.LoadAll(), settings, EditUtil.Settings.Move); rand.ExecuteMetronome(); LoadIndex(CB_Species.SelectedIndex); System.Media.SystemSounds.Asterisk.Play(); }
private void B_RandLearn_Click(object sender, EventArgs e) { SaveCurrent(); var settings = (LearnSettings)PG_Learn.SelectedObject; var rand = new LearnsetRandomizer(ROM.Info, Editor.Learn.LoadAll(), Editor.Personal); var moves = ROM.Data.MoveData.LoadAll(); int[] banned = Legal.GetBannedMoves(ROM.Info.Game, moves.Length); rand.Initialize(moves, settings, EditUtil.Settings.Move, banned); rand.Execute(); LoadIndex(CB_Species.SelectedIndex); System.Media.SystemSounds.Asterisk.Play(); }
public BTTE(GameData data, TrainerEditor editor, GameManager game) { Game = game; Data = data; Trainers = editor; InitializeComponent(); pba = new[] { PB_Team1, PB_Team2, PB_Team3, PB_Team4, PB_Team5, PB_Team6 }; Stats.Personal = Personal = data.PersonalData; learn = new LearnsetRandomizer(game.Info, data.LevelUpData.LoadAll(), Personal); AltForms = new byte[Personal.TableLength] .Select(_ => Enumerable.Range(0, 32).Select(i => i.ToString()).ToArray()).ToArray(); trClass = Game.GetStrings(TextName.TrainerClasses); trName = Game.GetStrings(TextName.TrainerClasses); abilitylist = Game.GetStrings(TextName.AbilityNames); movelist = Game.GetStrings(TextName.MoveNames); itemlist = Game.GetStrings(TextName.ItemNames); specieslist = Game.GetStrings(TextName.SpeciesNames); types = Game.GetStrings(TextName.Types); natures = Game.GetStrings(TextName.Natures); trName = Game.GetStrings(TextName.TrainerNames); trClass = Game.GetStrings(TextName.TrainerClasses); movelist = EditorUtil.SanitizeMoveList(movelist); AIBits = Game.Info.SWSH ? new[] { CHK_AI_Basic, CHK_AI_Strong, CHK_AI_Expert, CHK_AI_Double, CHK_AI_Raid, CHK_AI_Allowance, CHK_AI_PokeChange, CHK_AI_FireGym1, CHK_AI_FireGym2, CHK_AI_Unused1, CHK_AI_Item, CHK_AI_FireGym3, CHK_AI_Unused2 } : new[] { CHK_AI_Basic, CHK_AI_Strong, CHK_AI_Expert, CHK_AI_Double, CHK_AI_Allowance, CHK_AI_Item, CHK_AI_PokeChange, CHK_AI_Unused1 }; mnuView.Click += ClickView; mnuSet.Click += ClickSet; mnuDelete.Click += ClickDelete; Setup(); foreach (var pb in pba) { pb.Click += ClickSlot; } CB_TrainerID.SelectedIndex = 0; PG_Moves.SelectedObject = EditUtil.Settings.Move; PG_RTrainer.SelectedObject = EditUtil.Settings.Trainer; PG_Species.SelectedObject = EditUtil.Settings.Species; L_Gift.Visible = CB_Gift.Visible = NUD_GiftCount.Visible = Game.Info.GG; GB_Additional_AI.Visible = Game.Info.SWSH; }
private void B_LearnExpand_Click(object sender, EventArgs e) { var settings = (LearnSettings)PG_Learn.SelectedObject; if (!settings.Expand) { WinFormsUtil.Error("Expand moves not selected. Please double check settings.", "Not expanding learnsets."); return; } var rand = new LearnsetRandomizer(ROM.Info, Editor.Learn.LoadAll(), Editor.Personal); rand.Initialize(ROM.Data.MoveData.LoadAll(), settings, EditUtil.Settings.Move); rand.ExecuteExpandOnly(); LoadIndex(CB_Species.SelectedIndex); System.Media.SystemSounds.Asterisk.Play(); }
public BTTE(GameManager game, TrainerEditor editor) { InitializeComponent(); Stats.Personal = Personal = game.Data.PersonalData; Game = game; Trainers = editor; learn = new LearnsetRandomizer(game.Info, game.Data.LevelUpData.LoadAll(), Personal); trClass = Game.GetStrings(TextName.TrainerClasses); trName = Game.GetStrings(TextName.TrainerClasses); abilitylist = Game.GetStrings(TextName.AbilityNames); movelist = Game.GetStrings(TextName.MoveNames); itemlist = Game.GetStrings(TextName.ItemNames); specieslist = Game.GetStrings(TextName.SpeciesNames); types = Game.GetStrings(TextName.Types); natures = Game.GetStrings(TextName.Natures); trName = Game.GetStrings(TextName.TrainerNames); trClass = Game.GetStrings(TextName.TrainerClasses); movelist = EditorUtil.SanitizeMoveList(movelist); AIBits = Game.Info.SWSH ? new[] { CHK_AI_Basic, CHK_AI_Strong, CHK_AI_Expert, CHK_AI_Double, CHK_AI_Raid, CHK_AI_Allowance, CHK_AI_PokeChange, CHK_AI_FireGym1, CHK_AI_FireGym2, CHK_AI_Unused1, CHK_AI_Item, CHK_AI_FireGym3, CHK_AI_Unused2 } : new[] { CHK_AI_Basic, CHK_AI_Strong, CHK_AI_Expert, CHK_AI_Double, CHK_AI_Allowance, CHK_AI_Item, CHK_AI_PokeChange, CHK_AI_Unused1 }; mnuView.Click += ClickView; mnuSet.Click += ClickSet; mnuDelete.Click += ClickDelete; Setup(); foreach (var pb in pba) { pb.Click += ClickSlot; } CB_TrainerID.SelectedIndex = 0; PG_Moves.SelectedObject = EditUtil.Settings.Move; PG_RTrainer.SelectedObject = EditUtil.Settings.Trainer; PG_Species.SelectedObject = EditUtil.Settings.Species; L_Gift.Visible = CB_Gift.Visible = NUD_GiftCount.Visible = Game.Info.GG; GB_Additional_AI.Visible = Game.Info.SWSH; }
private void B_RandAll_Click(object sender, EventArgs e) { ushort[] HMs = { 15, 19, 57, 70, 127, 249, 291 }; ushort[] TMs = {}; if (CHK_HMs.Checked && Main.ExeFSPath != null) { TMHMEditor6.getTMHMList(Main.Config.ORAS, out TMs, out HMs); } List <int> banned = new List <int> { 165, 621 }; // Struggle, Hyperspace Fury if (!CHK_HMs.Checked) { banned.AddRange(HMs.Select(z => (int)z)); } if (CHK_NoFixedDamage.Checked) { banned.AddRange(MoveRandomizer.FixedDamageMoves); } setList(); var sets = files.Select(z => new Learnset6(z)).ToArray(); var rand = new LearnsetRandomizer(Main.Config, sets) { Expand = CHK_Expand.Checked, ExpandTo = (int)NUD_Moves.Value, Spread = CHK_Spread.Checked, SpreadTo = (int)NUD_Level.Value, STAB = CHK_STAB.Checked, rSTABPercent = NUD_STAB.Value, STABFirst = CHK_STAB.Checked, BannedMoves = banned.ToArray(), Learn4Level1 = CHK_4MovesLvl1.Checked, }; rand.Execute(); sets.Select(z => z.Write()).ToArray().CopyTo(files, 0); getList(); WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!", "Press the Dump button to see the new Level Up Moves!"); }
private void B_RandAll_Click(object sender, EventArgs e) { setList(); var sets = files.Select(z => new Learnset7(z)).ToArray(); var rand = new LearnsetRandomizer(Main.Config, sets) { Expand = CHK_Expand.Checked, ExpandTo = (int)NUD_Moves.Value, Spread = CHK_Spread.Checked, SpreadTo = (int)NUD_Level.Value, STAB = CHK_STAB.Checked, rSTABPercent = NUD_STAB.Value, BannedMoves = new[] { 165, 621, 464 }.Concat(Legal.Z_Moves).ToArray(), // Struggle, Hyperspace Fury, Dark Void }; rand.Execute(); sets.Select(z => z.Write()).ToArray().CopyTo(files, 0); getList(); WinFormsUtil.Alert("All Pokémon's Level Up Moves have been randomized!"); }
public BTTE(GameManager game, TrainerEditor editor) { InitializeComponent(); Stats.Personal = Personal = game.Data.PersonalData; Game = game; Trainers = editor; learn = new LearnsetRandomizer(game.Info, game.Data.LevelUpData.LoadAll(), Personal); trClass = Game.GetStrings(TextName.TrainerClasses); trName = Game.GetStrings(TextName.TrainerClasses); abilitylist = Game.GetStrings(TextName.AbilityNames); movelist = Game.GetStrings(TextName.MoveNames); itemlist = Game.GetStrings(TextName.ItemNames); specieslist = Game.GetStrings(TextName.SpeciesNames); types = Game.GetStrings(TextName.Types); natures = Game.GetStrings(TextName.Natures); trName = Game.GetStrings(TextName.TrainerNames); trClass = Game.GetStrings(TextName.TrainerClasses); movelist = EditorUtil.SanitizeMoveList(movelist); AIBits = new[] { CHK_AI0, CHK_AI1, CHK_AI2, CHK_AI3, CHK_AI4, CHK_AI5, CHK_AI6, CHK_AI7 }; mnuView.Click += ClickView; mnuSet.Click += ClickSet; mnuDelete.Click += ClickDelete; Setup(); foreach (var pb in pba) { pb.Click += ClickSlot; } CB_TrainerID.SelectedIndex = 0; PG_Moves.SelectedObject = EditUtil.Settings.Move; PG_RTrainer.SelectedObject = EditUtil.Settings.Trainer; PG_Species.SelectedObject = EditUtil.Settings.Species; L_Gift.Visible = CB_Gift.Visible = NUD_GiftCount.Visible = Game.Info.GG; }
private static void RandomizeTeam(trdata6 t, MoveRandomizer move, LearnsetRandomizer learn, ushort[] itemvals, int type, bool mevo, bool typerand) { int last = t.Team.Length - 1; for (int p = 0; p < t.Team.Length; p++) { var pk = t.Team[p]; int[] stones = null; if (rPKM) { // randomize pokemon int species; if (typerand) { species = rSpeciesRand.GetRandomSpeciesType(pk.Species, type); if (p == last && mevo) { int tries = 0; do { stones = GetRandomMega(out species); }while (Main.Config.Personal[species].Types.All(z => z != type) && tries++ < 100); } } else if (p == last && mevo) { stones = GetRandomMega(out species); } else { species = rSpeciesRand.GetRandomSpecies(pk.Species); } pk.Species = (ushort)species; pk.Gender = 0; // Set Gender to Random bool mega = rRandomMegas & !(mevo && p == last); // except if mega evolution is forced for the last slot pk.Form = (ushort)Randomizer.GetRandomForme(pk.Species, mega, true, Main.SpeciesStat); } if (rLevel) { pk.Level = (ushort)Randomizer.getModifiedLevel(pk.Level, rLevelMultiplier); } if (rAbility) { pk.Ability = (int)(1 + rnd32() % 3); } if (rDiffIV) { pk.IVs = 255; } if (mevo && p == last && stones != null) { pk.Item = (ushort)stones[rnd32() % stones.Length]; } else if (rItem) { pk.Item = itemvals[rnd32() % itemvals.Length]; } if (rForceFullyEvolved && pk.Level >= rForceFullyEvolvedLevel && !rFinalEvo.Contains(pk.Species)) { int randFinalEvo() => (int)(Util.rnd32() % rFinalEvo.Length); pk.Species = (ushort)rFinalEvo[randFinalEvo()]; pk.Form = (ushort)Randomizer.GetRandomForme(pk.Species, rRandomMegas, true, Main.SpeciesStat); } // random if (rMove) { var pkMoves = move.GetRandomMoveset(pk.Species, 4); for (int m = 0; m < 4; m++) { pk.Moves[m] = (ushort)pkMoves[m]; } } // levelup if (rNoMove) { t.Moves = true; var pkMoves = learn.GetCurrentMoves(pk.Species, pk.Form, pk.Level, 4); for (int m = 0; m < 4; m++) { pk.Moves[m] = (ushort)pkMoves[m]; } } // high-power attacks if (rForceHighPower && pk.Level >= rForceHighPowerLevel) { var pkMoves = learn.GetHighPoweredMoves(pk.Species, pk.Form, 4); for (int m = 0; m < 4; m++) { pk.Moves[m] = (ushort)pkMoves[m]; } } } }
private void B_RandAll_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize Static Encounters? Cannot undo.", "Double check Randomization Settings before continuing.") != DialogResult.Yes) { return; } setGift(); setEncounter(); setTrade(); var specrand = getRandomizer(); var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); var items = Randomizer.getRandomItemList(); int[] banned = Legal.Z_Moves.Concat(new int[] { 165, 621 }).ToArray(); int randFinalEvo() => (int)(Util.rnd32() % FinalEvo.Length); int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length); for (int i = 3; i < Gifts.Length; i++) // Skip Starters { var t = Gifts[i]; // Legendary-for-Legendary if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(t.Species) || UnevolvedLegend.Contains(t.Species)) { t.Species = ReplaceLegend[randLegend()]; } // every other entry else { t.Species = specrand.GetRandomSpecies(t.Species); } if (CHK_AllowMega.Checked) { formrand.AllowMega = true; } if (CHK_Item.Checked) { t.HeldItem = items[Util.rnd32() % items.Length]; } if (CHK_Level.Checked) { t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } if (CHK_RemoveShinyLock.Checked) { t.ShinyLock = false; } if (CHK_SpecialMove.Checked) { int rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); if (banned.Contains(rv)) { continue; // disallow banned moves } t.SpecialMove = rv; } if (CHK_RandomAbility.Checked) { t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H } if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) { t.Species = FinalEvo[randFinalEvo()]; } t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); t.Nature = -1; // random } foreach (EncounterStatic7 t in Encounters) { // Legendary-for-Legendary if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(t.Species)) { t.Species = ReplaceLegend[randLegend()]; } // fully evolved Totems else if (CHK_ForceTotem.Checked && Totem.Contains(t.Species)) { t.Species = FinalEvo[randFinalEvo()]; } // every other entry else { t.Species = specrand.GetRandomSpecies(t.Species); } if (CHK_AllowMega.Checked) { formrand.AllowMega = true; } if (CHK_Item.Checked) { t.HeldItem = items[Util.rnd32() % items.Length]; } if (CHK_Level.Checked) { t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } if (CHK_RemoveShinyLock.Checked) { t.ShinyLock = false; } if (CHK_RandomAura.Checked && t.Aura != 0) // don't apply aura to a pkm without it { t.Aura = Util.rand.Next(1, CB_Aura.Items.Count); // don't allow none } if (CHK_RandomAbility.Checked) { t.Ability = (sbyte)(Util.rand.Next(1, 4)); // 1, 2, or H } if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) { t.Species = FinalEvo[randFinalEvo()]; } t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); t.Gender = 0; // random t.Nature = 0; // random } foreach (EncounterTrade7 t in Trades) { t.Species = specrand.GetRandomSpecies(t.Species); t.TradeRequestSpecies = specrand.GetRandomSpecies(t.TradeRequestSpecies); if (CHK_AllowMega.Checked) { formrand.AllowMega = true; } if (CHK_Item.Checked) { t.HeldItem = items[Util.rnd32() % items.Length]; } if (CHK_Level.Checked) { t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } if (CHK_RandomAbility.Checked) { t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H } if (CHK_ForceFullyEvolved.Checked && t.Level >= NUD_ForceFullyEvolved.Value && !FinalEvo.Contains(t.Species)) { t.Species = FinalEvo[randFinalEvo()]; // only do offered species to be fair } t.Form = Randomizer.GetRandomForme(t.Species, CHK_AllowMega.Checked, true, Main.SpeciesStat); t.Nature = (int)(Util.rnd32() % CB_TNature.Items.Count); // randomly selected } getListBoxEntries(); getGift(); getEncounter(); getTrade(); WinFormsUtil.Alert("Randomized Static Encounters according to specification!"); }
private void B_RandAll_Click(object sender, EventArgs e) { if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize Static Encounters? Cannot undo.", "Double check Randomization Settings before continuing.") != DialogResult.Yes) { return; } setGift(); setEncounter(); setTrade(); var specrand = getRandomizer(); var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true }; var move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets); var items = Randomizer.getRandomItemList(); for (int i = 3; i < Gifts.Length; i++) // Skip Starters { var t = Gifts[i]; t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); t.Nature = -1; // random if (CHK_AllowMega.Checked) { formrand.AllowMega = true; } if (CHK_Item.Checked) { t.HeldItem = items[Util.rnd32() % items.Length]; } if (CHK_Level.Checked) { t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } if (CHK_RemoveShinyLock.Checked) { t.ShinyLock = false; } if (CHK_SpecialMove.Checked) { t.SpecialMove = Util.rand.Next(1, CB_SpecialMove.Items.Count); // don't allow none } if (CHK_RandomAbility.Checked) { t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H } } foreach (EncounterStatic7 t in Encounters) { t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); t.RelearnMoves = move.GetCurrentMoves(t.Species, t.Form, t.Level, 4); t.Gender = 0; // random t.Nature = 0; // random if (CHK_AllowMega.Checked) { formrand.AllowMega = true; } if (CHK_Item.Checked) { t.HeldItem = items[Util.rnd32() % items.Length]; } if (CHK_Level.Checked) { t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } if (CHK_RemoveShinyLock.Checked) { t.ShinyLock = false; } if (CHK_RandomAura.Checked && t.Aura != 0) // don't apply aura to a pkm without it { t.Aura = Util.rand.Next(1, CB_Aura.Items.Count); // don't allow none } if (CHK_RandomAbility.Checked) { t.Ability = (sbyte)(Util.rand.Next(1, 4)); // 1, 2, or H } } foreach (EncounterTrade7 t in Trades) { t.Species = specrand.GetRandomSpecies(t.Species); t.Form = formrand.GetRandomForme(t.Species); t.TradeRequestSpecies = specrand.GetRandomSpecies(t.TradeRequestSpecies); t.Nature = (int)(Util.rnd32() % CB_TNature.Items.Count); // randomly selected if (CHK_AllowMega.Checked) { formrand.AllowMega = true; } if (CHK_Item.Checked) { t.HeldItem = items[Util.rnd32() % items.Length]; } if (CHK_Level.Checked) { t.Level = Randomizer.getModifiedLevel(t.Level, NUD_LevelBoost.Value); } if (CHK_RandomAbility.Checked) { t.Ability = (sbyte)(Util.rand.Next(0, 3)); // 1, 2, or H } } getListBoxEntries(); getGift(); getEncounter(); getTrade(); WinFormsUtil.Alert("Randomized Static Encounters according to specification!"); }