Add static/gift legend-for-legend

This commit is contained in:
sora10pls 2018-01-15 15:38:11 -05:00
parent 2690520ffc
commit ecef1be042
6 changed files with 138 additions and 59 deletions

View File

@ -302,10 +302,22 @@ public static partial class Legal
{
804, 805, 806, 807,
}).ToArray();
public static readonly int[] Legendary_Mythical =
/// <summary>
/// All Legendary and Mythical Pokemon. Used for Legendary-for-Legendary replacement.
/// Does not include un-evolved species in the array due to potential error with Force Fully Evolved.
/// </summary>
public static readonly int[] Legendary_Mythical_6 =
{
144, 145, 146, 150, 151, 243, 244, 245, 249, 250, 251, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 494, 638,
639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721, 785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802, 804, 805, 806, 807
639, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 716, 717, 718, 719, 720, 721,
};
public static readonly int[] Legendary_Mythical_SM = Legendary_Mythical_6.Concat(new int[]
{
785, 786, 787, 788, 791, 792, 793, 794, 795, 796, 797, 798, 799, 800, 801, 802,
}).ToArray();
public static readonly int[] Legendary_Mythical_USUM = Legendary_Mythical_SM.Concat(new int[]
{
804, 805, 806, 807
}).ToArray();
}
}

View File

@ -67,6 +67,7 @@ private void InitializeComponent()
this.CHK_G1 = new System.Windows.Forms.CheckBox();
this.NUD_LevelBoost = new System.Windows.Forms.NumericUpDown();
this.CHK_Level = new System.Windows.Forms.CheckBox();
this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_Level)).BeginInit();
@ -305,6 +306,7 @@ private void InitializeComponent()
//
// GB_Tweak
//
this.GB_Tweak.Controls.Add(this.CHK_ReplaceLegend);
this.GB_Tweak.Controls.Add(this.CHK_RandomAbility);
this.GB_Tweak.Controls.Add(this.CHK_RemoveShinyLock);
this.GB_Tweak.Controls.Add(this.CHK_AllowMega);
@ -321,7 +323,7 @@ private void InitializeComponent()
this.GB_Tweak.Controls.Add(this.CHK_G1);
this.GB_Tweak.Location = new System.Drawing.Point(5, 83);
this.GB_Tweak.Name = "GB_Tweak";
this.GB_Tweak.Size = new System.Drawing.Size(258, 147);
this.GB_Tweak.Size = new System.Drawing.Size(258, 160);
this.GB_Tweak.TabIndex = 509;
this.GB_Tweak.TabStop = false;
this.GB_Tweak.Text = "Extra Randomization Tweaks";
@ -518,6 +520,18 @@ private void InitializeComponent()
this.CHK_Level.Text = "Multiply PKM Level by";
this.CHK_Level.UseVisualStyleBackColor = true;
//
// CHK_ReplaceLegend
//
this.CHK_ReplaceLegend.AutoSize = true;
this.CHK_ReplaceLegend.Checked = true;
this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked;
this.CHK_ReplaceLegend.Location = new System.Drawing.Point(9, 140);
this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend";
this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17);
this.CHK_ReplaceLegend.TabIndex = 304;
this.CHK_ReplaceLegend.Text = "Replace Legendaries with Another Legendary";
this.CHK_ReplaceLegend.UseVisualStyleBackColor = true;
//
// StaticEncounterEditor6
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -590,5 +604,6 @@ private void InitializeComponent()
private System.Windows.Forms.Label L_Ability;
private System.Windows.Forms.ComboBox CB_Ability;
private System.Windows.Forms.CheckBox CHK_RandomAbility;
private System.Windows.Forms.CheckBox CHK_ReplaceLegend;
}
}

View File

@ -42,6 +42,7 @@ public StaticEncounterEditor6()
private EncounterStatic6[] EncounterData;
private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames);
private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames);
private static int[] ReplaceLegend;
private readonly string[] ability =
{
@ -81,6 +82,8 @@ private void loadData()
foreach (var s in ability) CB_Ability.Items.Add(s);
foreach (var s in gender) CB_Gender.Items.Add(s);
ReplaceLegend = Legal.Legendary_Mythical_6;
loaded = true;
LB_Encounters.SelectedIndex = 0;
}
@ -164,9 +167,19 @@ private void B_RandAll_Click(object sender, EventArgs e)
for (int i = 0; i < LB_Encounters.Items.Count; i++)
{
LB_Encounters.SelectedIndex = i;
int species = CB_Species.SelectedIndex;
species = specrand.GetRandomSpecies(species);
// replace Legendaries with another Legendary
if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(species))
{
int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length);
species = ReplaceLegend[randLegend()];
}
// every other entry
else
species = specrand.GetRandomSpecies(species);
CB_Species.SelectedIndex = species;
NUD_Form.Value = formrand.GetRandomForme(species);
CB_Gender.SelectedIndex = 0; // random

View File

@ -64,7 +64,7 @@ public SMTE(byte[][] trc, byte[][] trd, byte[][] trp)
TrainerClasses = Main.Config.USUM ? Legal.SpecialClasses_USUM : Legal.SpecialClasses_SM;
ImportantTrainers = Main.Config.USUM ? Legal.ImportantTrainers_USUM : Legal.ImportantTrainers_SM;
FinalEvo = Main.Config.USUM ? Legal.FinalEvolutions_USUM : Legal.FinalEvolutions_SM;
ReplaceLegend = Legal.Legendary_Mythical;
ReplaceLegend = Legal.Legendary_Mythical_USUM;
RandSettings.GetFormSettings(this, Tab_Misc.Controls);
}

View File

@ -49,6 +49,8 @@ private void InitializeComponent()
this.NUD_GLevel = new System.Windows.Forms.NumericUpDown();
this.LB_Gift = new System.Windows.Forms.ListBox();
this.Tab_Encounters = new System.Windows.Forms.TabPage();
this.L_EGender = new System.Windows.Forms.Label();
this.NUD_EGender = new System.Windows.Forms.NumericUpDown();
this.CB_EAbility = new System.Windows.Forms.ComboBox();
this.L_EAbility = new System.Windows.Forms.Label();
this.CHK_EIV3 = new System.Windows.Forms.CheckBox();
@ -98,6 +100,8 @@ private void InitializeComponent()
this.NUD_ELevel = new System.Windows.Forms.NumericUpDown();
this.LB_Encounter = new System.Windows.Forms.ListBox();
this.Tab_Trades = new System.Windows.Forms.TabPage();
this.L_TGender = new System.Windows.Forms.Label();
this.NUD_TGender = new System.Windows.Forms.NumericUpDown();
this.CB_TAbility = new System.Windows.Forms.ComboBox();
this.L_TAbility = new System.Windows.Forms.Label();
this.CB_TNature = new System.Windows.Forms.ComboBox();
@ -155,15 +159,13 @@ private void InitializeComponent()
this.B_Starters = new System.Windows.Forms.Button();
this.B_Save = new System.Windows.Forms.Button();
this.B_Cancel = new System.Windows.Forms.Button();
this.L_EGender = new System.Windows.Forms.Label();
this.NUD_EGender = new System.Windows.Forms.NumericUpDown();
this.L_TGender = new System.Windows.Forms.Label();
this.NUD_TGender = new System.Windows.Forms.NumericUpDown();
this.CHK_ReplaceLegend = new System.Windows.Forms.CheckBox();
this.TC_Tabs.SuspendLayout();
this.Tab_Gifts.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_GForm)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).BeginInit();
this.Tab_Encounters.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).BeginInit();
this.GB_EEVs.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_EV5)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_EV4)).BeginInit();
@ -182,6 +184,7 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.NUD_EForm)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).BeginInit();
this.Tab_Trades.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).BeginInit();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_TIV3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_TIV4)).BeginInit();
@ -195,8 +198,6 @@ private void InitializeComponent()
this.Tab_Randomizer.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).BeginInit();
this.GB_Tweak.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).BeginInit();
this.SuspendLayout();
//
// TC_Tabs
@ -447,6 +448,27 @@ private void InitializeComponent()
this.Tab_Encounters.Text = "Encounters";
this.Tab_Encounters.UseVisualStyleBackColor = true;
//
// L_EGender
//
this.L_EGender.Location = new System.Drawing.Point(131, 71);
this.L_EGender.Name = "L_EGender";
this.L_EGender.Size = new System.Drawing.Size(55, 23);
this.L_EGender.TabIndex = 519;
this.L_EGender.Text = "Gender:";
this.L_EGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_EGender
//
this.NUD_EGender.Location = new System.Drawing.Point(187, 74);
this.NUD_EGender.Maximum = new decimal(new int[] {
2,
0,
0,
0});
this.NUD_EGender.Name = "NUD_EGender";
this.NUD_EGender.Size = new System.Drawing.Size(34, 20);
this.NUD_EGender.TabIndex = 518;
//
// CB_EAbility
//
this.CB_EAbility.FormattingEnabled = true;
@ -1071,6 +1093,27 @@ private void InitializeComponent()
this.Tab_Trades.Text = "Trades";
this.Tab_Trades.UseVisualStyleBackColor = true;
//
// L_TGender
//
this.L_TGender.Location = new System.Drawing.Point(131, 71);
this.L_TGender.Name = "L_TGender";
this.L_TGender.Size = new System.Drawing.Size(55, 23);
this.L_TGender.TabIndex = 523;
this.L_TGender.Text = "Gender:";
this.L_TGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_TGender
//
this.NUD_TGender.Location = new System.Drawing.Point(187, 74);
this.NUD_TGender.Maximum = new decimal(new int[] {
2,
0,
0,
0});
this.NUD_TGender.Name = "NUD_TGender";
this.NUD_TGender.Size = new System.Drawing.Size(34, 20);
this.NUD_TGender.TabIndex = 522;
//
// CB_TAbility
//
this.CB_TAbility.FormattingEnabled = true;
@ -1522,7 +1565,7 @@ private void InitializeComponent()
//
// B_RandAll
//
this.B_RandAll.Location = new System.Drawing.Point(192, 321);
this.B_RandAll.Location = new System.Drawing.Point(192, 330);
this.B_RandAll.Name = "B_RandAll";
this.B_RandAll.Size = new System.Drawing.Size(122, 23);
this.B_RandAll.TabIndex = 509;
@ -1532,6 +1575,7 @@ private void InitializeComponent()
//
// GB_Tweak
//
this.GB_Tweak.Controls.Add(this.CHK_ReplaceLegend);
this.GB_Tweak.Controls.Add(this.CHK_RandomAbility);
this.GB_Tweak.Controls.Add(this.CHK_SpecialMove);
this.GB_Tweak.Controls.Add(this.CHK_RandomAura);
@ -1551,7 +1595,7 @@ private void InitializeComponent()
this.GB_Tweak.Controls.Add(this.CHK_G1);
this.GB_Tweak.Location = new System.Drawing.Point(119, 113);
this.GB_Tweak.Name = "GB_Tweak";
this.GB_Tweak.Size = new System.Drawing.Size(258, 193);
this.GB_Tweak.Size = new System.Drawing.Size(258, 205);
this.GB_Tweak.TabIndex = 508;
this.GB_Tweak.TabStop = false;
this.GB_Tweak.Text = "Extra Randomization Tweaks";
@ -1747,7 +1791,7 @@ private void InitializeComponent()
//
// B_Starters
//
this.B_Starters.Location = new System.Drawing.Point(192, 350);
this.B_Starters.Location = new System.Drawing.Point(192, 359);
this.B_Starters.Name = "B_Starters";
this.B_Starters.Size = new System.Drawing.Size(122, 23);
this.B_Starters.TabIndex = 9;
@ -1775,47 +1819,17 @@ private void InitializeComponent()
this.B_Cancel.UseVisualStyleBackColor = true;
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click);
//
// L_EGender
// CHK_ReplaceLegend
//
this.L_EGender.Location = new System.Drawing.Point(131, 71);
this.L_EGender.Name = "L_EGender";
this.L_EGender.Size = new System.Drawing.Size(55, 23);
this.L_EGender.TabIndex = 519;
this.L_EGender.Text = "Gender:";
this.L_EGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_EGender
//
this.NUD_EGender.Location = new System.Drawing.Point(187, 74);
this.NUD_EGender.Maximum = new decimal(new int[] {
2,
0,
0,
0});
this.NUD_EGender.Name = "NUD_EGender";
this.NUD_EGender.Size = new System.Drawing.Size(34, 20);
this.NUD_EGender.TabIndex = 518;
//
// L_TGender
//
this.L_TGender.Location = new System.Drawing.Point(131, 71);
this.L_TGender.Name = "L_TGender";
this.L_TGender.Size = new System.Drawing.Size(55, 23);
this.L_TGender.TabIndex = 523;
this.L_TGender.Text = "Gender:";
this.L_TGender.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_TGender
//
this.NUD_TGender.Location = new System.Drawing.Point(187, 74);
this.NUD_TGender.Maximum = new decimal(new int[] {
2,
0,
0,
0});
this.NUD_TGender.Name = "NUD_TGender";
this.NUD_TGender.Size = new System.Drawing.Size(34, 20);
this.NUD_TGender.TabIndex = 522;
this.CHK_ReplaceLegend.AutoSize = true;
this.CHK_ReplaceLegend.Checked = true;
this.CHK_ReplaceLegend.CheckState = System.Windows.Forms.CheckState.Checked;
this.CHK_ReplaceLegend.Location = new System.Drawing.Point(9, 186);
this.CHK_ReplaceLegend.Name = "CHK_ReplaceLegend";
this.CHK_ReplaceLegend.Size = new System.Drawing.Size(242, 17);
this.CHK_ReplaceLegend.TabIndex = 303;
this.CHK_ReplaceLegend.Text = "Replace Legendaries with Another Legendary";
this.CHK_ReplaceLegend.UseVisualStyleBackColor = true;
//
// StaticEncounterEditor7
//
@ -1834,6 +1848,7 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.NUD_GLevel)).EndInit();
this.Tab_Encounters.ResumeLayout(false);
this.Tab_Encounters.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).EndInit();
this.GB_EEVs.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.NUD_EV5)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_EV4)).EndInit();
@ -1853,6 +1868,7 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.NUD_ELevel)).EndInit();
this.Tab_Trades.ResumeLayout(false);
this.Tab_Trades.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).EndInit();
this.groupBox1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.NUD_TIV3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_TIV4)).EndInit();
@ -1868,8 +1884,6 @@ private void InitializeComponent()
((System.ComponentModel.ISupportInitialize)(this.NUD_LevelBoost)).EndInit();
this.GB_Tweak.ResumeLayout(false);
this.GB_Tweak.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_EGender)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_TGender)).EndInit();
this.ResumeLayout(false);
}
@ -2007,5 +2021,6 @@ private void InitializeComponent()
private System.Windows.Forms.NumericUpDown NUD_EGender;
private System.Windows.Forms.Label L_TGender;
private System.Windows.Forms.NumericUpDown NUD_TGender;
private System.Windows.Forms.CheckBox CHK_ReplaceLegend;
}
}

View File

@ -20,6 +20,7 @@ public partial class StaticEncounterEditor7 : Form
private readonly string[] natures = Main.Config.getText(TextName.Natures);
private readonly string[] types = Main.Config.getText(TextName.Types);
private readonly int[] oldStarters;
private static int[] ReplaceLegend;
private readonly string[] ability =
{
@ -134,6 +135,8 @@ public StaticEncounterEditor7(byte[][] infiles)
LB_Encounter.SelectedIndex = 0;
LB_Trade.SelectedIndex = 0;
ReplaceLegend = Main.Config.USUM ? Legal.Legendary_Mythical_USUM : Legal.Legendary_Mythical_SM;
// Select last tab (Randomization) by default in case info already randomized.
TC_Tabs.SelectedIndex = TC_Tabs.TabCount - 1;
@ -506,7 +509,18 @@ private void B_RandAll_Click(object sender, EventArgs e)
for (int i = 3; i < Gifts.Length; i++) // Skip Starters
{
var t = Gifts[i];
t.Species = specrand.GetRandomSpecies(t.Species);
// replace Legendaries with another Legendary
if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(t.Species))
{
int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length);
t.Species = ReplaceLegend[randLegend()];
}
// every other entry
else
t.Species = specrand.GetRandomSpecies(t.Species);
t.Form = formrand.GetRandomForme(t.Species);
t.Nature = -1; // random
@ -530,7 +544,17 @@ private void B_RandAll_Click(object sender, EventArgs e)
}
foreach (EncounterStatic7 t in Encounters)
{
t.Species = specrand.GetRandomSpecies(t.Species);
// replace Legendaries with another Legendary
if (CHK_ReplaceLegend.Checked && ReplaceLegend.Contains(t.Species))
{
int randLegend() => (int)(Util.rnd32() % ReplaceLegend.Length);
t.Species = ReplaceLegend[randLegend()];
}
// every other entry
else
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