Port the Current Levelup Moves and High Attack Levelup Moves buttons/behavior from SMTE to StaticEncounterEditor7.

Also add autocomplete settings to avoid unnecessary breakings.
This commit is contained in:
Egzon Qukovci Jusufi 2019-10-08 22:48:35 +02:00
parent 86c8cb9ba5
commit 59ba986d98
3 changed files with 565 additions and 308 deletions

View File

@ -1386,17 +1386,6 @@ private void InitializeComponent()
this.CB_Move1.Size = new System.Drawing.Size(121, 21);
this.CB_Move1.TabIndex = 1;
//
// CB_Move4
//
this.CB_Move4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CB_Move4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CB_Move4.FormattingEnabled = true;
this.CB_Move4.Location = new System.Drawing.Point(40, 82);
this.CB_Move4.Margin = new System.Windows.Forms.Padding(0);
this.CB_Move4.Name = "CB_Move4";
this.CB_Move4.Size = new System.Drawing.Size(121, 21);
this.CB_Move4.TabIndex = 2;
//
// CB_Move2
//
this.CB_Move2.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
@ -1406,7 +1395,7 @@ private void InitializeComponent()
this.CB_Move2.Margin = new System.Windows.Forms.Padding(0);
this.CB_Move2.Name = "CB_Move2";
this.CB_Move2.Size = new System.Drawing.Size(121, 21);
this.CB_Move2.TabIndex = 1;
this.CB_Move2.TabIndex = 2;
//
// CB_Move3
//
@ -1417,7 +1406,18 @@ private void InitializeComponent()
this.CB_Move3.Margin = new System.Windows.Forms.Padding(0);
this.CB_Move3.Name = "CB_Move3";
this.CB_Move3.Size = new System.Drawing.Size(121, 21);
this.CB_Move3.TabIndex = 2;
this.CB_Move3.TabIndex = 3;
//
// CB_Move4
//
this.CB_Move4.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend;
this.CB_Move4.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems;
this.CB_Move4.FormattingEnabled = true;
this.CB_Move4.Location = new System.Drawing.Point(40, 82);
this.CB_Move4.Margin = new System.Windows.Forms.Padding(0);
this.CB_Move4.Name = "CB_Move4";
this.CB_Move4.Size = new System.Drawing.Size(121, 21);
this.CB_Move4.TabIndex = 4;
//
// L_TrainerName
//

File diff suppressed because it is too large Load Diff

View File

@ -1,10 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using pk3DS.Core;
using pk3DS.Core.Randomizers;
using pk3DS.Core.Structures;
using pk3DS.Core.Structures.PersonalInfo;
namespace pk3DS
{
@ -14,6 +16,7 @@ public partial class StaticEncounterEditor7 : Form
private readonly EncounterGift7[] Gifts;
private readonly EncounterStatic7[] Encounters;
private readonly EncounterTrade7[] Trades;
private readonly LearnsetRandomizer learn = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets);
private readonly string[] movelist = Main.Config.getText(TextName.MoveNames);
private readonly string[] itemlist = Main.Config.getText(TextName.ItemNames);
private readonly string[] specieslist = Main.Config.getText(TextName.SpeciesNames);
@ -80,7 +83,7 @@ public StaticEncounterEditor7(byte[][] infiles)
{
byte[] entry = new byte[EncounterGift7.SIZE];
Array.Copy(data, i, entry, 0, entry.Length);
Gifts[i/EncounterGift7.SIZE] = new EncounterGift7(entry);
Gifts[i / EncounterGift7.SIZE] = new EncounterGift7(entry);
}
}
oldStarters = Gifts.Take(3).Select(gift => gift.Species).ToArray();
@ -93,7 +96,7 @@ public StaticEncounterEditor7(byte[][] infiles)
{
byte[] entry = new byte[EncounterStatic7.SIZE];
Array.Copy(data, i, entry, 0, entry.Length);
Encounters[i/EncounterStatic7.SIZE] = new EncounterStatic7(entry);
Encounters[i / EncounterStatic7.SIZE] = new EncounterStatic7(entry);
}
}
@ -105,7 +108,7 @@ public StaticEncounterEditor7(byte[][] infiles)
{
byte[] entry = new byte[EncounterTrade7.SIZE];
Array.Copy(data, i, entry, 0, entry.Length);
Trades[i/EncounterTrade7.SIZE] = new EncounterTrade7(entry);
Trades[i / EncounterTrade7.SIZE] = new EncounterTrade7(entry);
}
}
@ -555,7 +558,7 @@ private void B_Starters_Click(object sender, EventArgs e)
{
int rv;
do { rv = Util.rand.Next(1, CB_SpecialMove.Items.Count); }
while (banned.Contains(rv)) ;
while (banned.Contains(rv));
t.SpecialMove = rv;
}
@ -795,5 +798,32 @@ private void ModifyLevels(object sender, EventArgs e)
}
WinFormsUtil.Alert("Modified all Levels according to specification!");
}
private void B_CurrentAttackSE_Click(object sender, EventArgs e)
{
int species = CB_ESpecies.SelectedIndex;
int lvl = (int)NUD_ELevel.Value;
int frm = (int)NUD_EForm.Value;
int[] moves = learn.GetCurrentMoves(species, frm, lvl, 4);
SetMoves(moves);
}
private void B_HighAttackSE_Click(object sender, EventArgs e)
{
int species = CB_ESpecies.SelectedIndex;
int frm = (int)NUD_EForm.Value;
int[] moves = learn.GetHighPoweredMoves(species, frm, 4);
SetMoves(moves);
}
private void B_ClearSE_Click(object sender, EventArgs e) => SetMoves(new int[4]);
private void SetMoves(IList<int> moves)
{
var mcb = new[] { CB_EMove0, CB_EMove1, CB_EMove2, CB_EMove3 };
for (int i = 0; i < mcb.Length; i++)
mcb[i].SelectedIndex = moves[i];
}
}
}