mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-04-25 07:37:02 -05:00
Refactoring
use new randomization objects in other forms re-standardize namespaces a little
This commit is contained in:
parent
ddc7b8558d
commit
fa5bdee781
|
|
@ -118,9 +118,6 @@
|
|||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="ETC1Lib" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ETC1Lib.dll;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="Distributed" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\romdata\byte\Logo\Distributed.bin;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using pk3DS.Core.Structures.Gen6;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS.Core
|
||||
namespace pk3DS.Core.Randomizers
|
||||
{
|
||||
public class EvolutionRandomizer : IRandomizer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System.Linq;
|
||||
using pk3DS.Core.Structures.PersonalInfo;
|
||||
|
||||
namespace pk3DS.Core
|
||||
namespace pk3DS.Core.Randomizers
|
||||
{
|
||||
public class FormRandomizer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace pk3DS.Core
|
||||
namespace pk3DS.Core.Randomizers
|
||||
{
|
||||
/// <summary> Cyclical Shuffled Randomizer </summary>
|
||||
/// <remarks>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace pk3DS.Core
|
||||
namespace pk3DS.Core.Randomizers
|
||||
{
|
||||
public interface IRandomizer
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
using System;
|
||||
|
||||
using pk3DS.Core.Randomizers;
|
||||
using System.Linq;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS.Core
|
||||
namespace pk3DS.Core.Randomizers
|
||||
{
|
||||
// https://twitter.com/Drayano60/status/807297858244411397
|
||||
// ORAS: 10682 moves learned on levelup/birth.
|
||||
|
|
@ -82,5 +81,21 @@ private int[] GetRandomMoves(int count, int index)
|
|||
moverand.GetRandomLearnset(index, count - 1).CopyTo(moves, 1);
|
||||
return moves;
|
||||
}
|
||||
|
||||
public int[] GetHighPoweredMoves(int species, int form, int count = 4)
|
||||
{
|
||||
int index = Config.Personal.getFormeIndex(species, form);
|
||||
var moves = Learnsets[index].Moves.OrderByDescending(move => Config.Moves[move].Power).Distinct().Take(count).ToArray();
|
||||
Array.Resize(ref moves, count);
|
||||
return moves;
|
||||
}
|
||||
|
||||
public int[] GetCurrentMoves(int species, int form, int level, int count = 4)
|
||||
{
|
||||
int i = Config.Personal.getFormeIndex(species, form);
|
||||
var moves = Learnsets[i].getCurrentMoves(level);
|
||||
Array.Resize(ref moves, count);
|
||||
return moves;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
11
pk3DS.Core/Randomizers/MoveInfoRandomizer.cs
Normal file
11
pk3DS.Core/Randomizers/MoveInfoRandomizer.cs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace pk3DS.Core.Randomizers
|
||||
{
|
||||
public class MoveInfoRandomizer
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
using pk3DS.Core.Structures.PersonalInfo;
|
||||
|
||||
namespace pk3DS.Core
|
||||
namespace pk3DS.Core.Randomizers
|
||||
{
|
||||
public class SpeciesRandomizer
|
||||
{
|
||||
|
|
@ -49,18 +50,31 @@ public void Initialize()
|
|||
private const int h = 11;
|
||||
#endregion
|
||||
|
||||
public int GetRandomSpecies(int oldSpecies, int index)
|
||||
internal int GetRandomSpecies(int oldSpecies, int bannedSpecies)
|
||||
{
|
||||
// Get a new random species
|
||||
PersonalInfo oldpkm = SpeciesStat[oldSpecies];
|
||||
|
||||
loopctr = 0; // altering calculations to prevent infinite loops
|
||||
int newSpecies;
|
||||
while (!GetNewSpecies(index, oldpkm, out newSpecies))
|
||||
while (!GetNewSpecies(bannedSpecies, oldpkm, out newSpecies))
|
||||
loopctr++;
|
||||
return newSpecies;
|
||||
}
|
||||
|
||||
public int GetRandomSpeciesType(int oldSpecies, int type)
|
||||
{
|
||||
// Get a new random species
|
||||
PersonalInfo oldpkm = SpeciesStat[oldSpecies];
|
||||
|
||||
loopctr = 0; // altering calculations to prevent infinite loops
|
||||
int newSpecies;
|
||||
while (!GetNewSpecies(oldSpecies, oldpkm, out newSpecies) || !GetIsTypeMatch(newSpecies, type))
|
||||
loopctr++;
|
||||
return newSpecies;
|
||||
}
|
||||
private bool GetIsTypeMatch(int newSpecies, int type) => SpeciesStat[newSpecies].Types.Any(z => z == type) || loopctr > 9000;
|
||||
|
||||
public int GetRandomSpecies(int oldSpecies)
|
||||
{
|
||||
// Get a new random species
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System.IO;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen6
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class EncounterGift6
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen6
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class EncounterStatic6
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen6
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class EvolutionMethod
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System.IO;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen6
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class Item
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen6
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class Maison6
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System.IO;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen6
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class MegaEvolutions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen6
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class trdata6
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen7
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class EncounterGift7 : EncounterStatic
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen7
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class EncounterStatic7 : EncounterStatic
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen7
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class EncounterTrade7 : EncounterStatic
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen7
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class Maison7
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen7
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class ZoneData7
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen7
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class trdata7
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace pk3DS.Core.Structures.Gen7
|
||||
namespace pk3DS.Core.Structures
|
||||
{
|
||||
public class trpoke7
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
using pk3DS.Core.Structures;
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Randomizers;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,8 +6,9 @@
|
|||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using pk3DS.Properties;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Randomizers;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Randomizers;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class GiftEditor6 : Form
|
||||
|
|
@ -157,8 +159,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
|||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings in the Randomizer Options tab.") != DialogResult.Yes) return;
|
||||
|
||||
// Randomize by BST
|
||||
var formrand = new FormRandomizer(Main.Config) { AllowMega = false };
|
||||
var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = false };
|
||||
var specrand = new SpeciesRandomizer(Main.Config)
|
||||
{
|
||||
G1 = CHK_G1.Checked,
|
||||
|
|
@ -174,6 +175,7 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
|||
|
||||
rBST = CHK_BST.Checked,
|
||||
};
|
||||
specrand.Initialize();
|
||||
for (int i = 0; i < LB_Gifts.Items.Count; i++)
|
||||
{
|
||||
LB_Gifts.SelectedIndex = i;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -8,6 +6,9 @@
|
|||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class MaisonEditor6 : Form
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -8,6 +6,9 @@
|
|||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class MegaEvoEditor6 : Form
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
using pk3DS.Core.Structures.PersonalInfo;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
|
|
@ -10,6 +7,10 @@
|
|||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures;
|
||||
using pk3DS.Core.Structures.PersonalInfo;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class RSTE : Form
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core.Randomizers;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class StaticEncounterEditor6 : Form
|
||||
|
|
@ -120,19 +122,31 @@ private void B_RandAll_Click(object sender, EventArgs e)
|
|||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings in the Randomizer Options tab.") != DialogResult.Yes) return;
|
||||
|
||||
// Randomize by BST
|
||||
bool bst = CHK_BST.Checked;
|
||||
int[] sL = Randomizer.getSpeciesList(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked, CHK_G4.Checked, CHK_G5.Checked, CHK_G6.Checked, false,
|
||||
CHK_L.Checked, CHK_E.Checked);
|
||||
int ctr = 0;
|
||||
var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = false };
|
||||
var specrand = new SpeciesRandomizer(Main.Config)
|
||||
{
|
||||
G1 = CHK_G1.Checked,
|
||||
G2 = CHK_G2.Checked,
|
||||
G3 = CHK_G3.Checked,
|
||||
G4 = CHK_G4.Checked,
|
||||
G5 = CHK_G5.Checked,
|
||||
G6 = CHK_G6.Checked,
|
||||
G7 = false,
|
||||
|
||||
E = CHK_E.Checked,
|
||||
L = CHK_L.Checked,
|
||||
|
||||
rBST = CHK_BST.Checked,
|
||||
};
|
||||
specrand.Initialize();
|
||||
for (int i = 0; i < LB_Encounters.Items.Count; i++)
|
||||
{
|
||||
LB_Encounters.SelectedIndex = i;
|
||||
|
||||
int species = CB_Species.SelectedIndex;
|
||||
species = Randomizer.getRandomSpecies(ref sL, ref ctr, species, bst, Main.SpeciesStat);
|
||||
species = specrand.GetRandomSpecies(species);
|
||||
CB_Species.SelectedIndex = species;
|
||||
NUD_Form.Value = Randomizer.GetRandomForme(species, false, true);
|
||||
NUD_Form.Value = formrand.GetRandomForme(species);
|
||||
NUD_Gender.Value = 0; // random
|
||||
|
||||
if (CHK_Level.Checked)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
using pk3DS.Core.Structures;
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Randomizers;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Media;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Randomizers;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class EvolutionEditor7 : Form
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.CTR;
|
||||
using pk3DS.Core.Structures.Gen7;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
using System;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class ItemEditor7 : Form
|
||||
|
|
|
|||
|
|
@ -6,9 +6,12 @@
|
|||
using System.Media;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Properties;
|
||||
|
||||
using pk3DS.Core.Structures;
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Randomizers;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen7;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -8,6 +6,9 @@
|
|||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class MaisonEditor7 : Form
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen6;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -8,6 +6,9 @@
|
|||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class MegaEvoEditor7 : Form
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen7;
|
||||
using System;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
|
@ -8,10 +6,15 @@
|
|||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Randomizers;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class SMTE : Form
|
||||
{
|
||||
private readonly LearnsetRandomizer move = new LearnsetRandomizer(Main.Config, Main.Config.Learnsets);
|
||||
private readonly trdata7[] Trainers;
|
||||
private string[][] AltForms;
|
||||
private int index = -1;
|
||||
|
|
@ -388,22 +391,6 @@ private void prepareTR7(trdata7 tr)
|
|||
tr.AI = (int)NUD_AI.Value;
|
||||
tr.Flag = CHK_Flag.Checked;
|
||||
}
|
||||
private static int[] getHighAttacks(trpoke7 pk)
|
||||
{
|
||||
int i = Main.Config.Personal.getFormeIndex(pk.Species, pk.Form);
|
||||
var learnset = Main.Config.Learnsets[i];
|
||||
var moves = learnset.Moves.OrderByDescending(move => Main.Config.Moves[move].Power).Distinct().Take(4).ToArray();
|
||||
Array.Resize(ref moves, 4);
|
||||
return moves;
|
||||
}
|
||||
private static int[] getCurrentAttacks(trpoke7 pk)
|
||||
{
|
||||
int i = Main.Config.Personal.getFormeIndex(pk.Species, pk.Form);
|
||||
var learnset = Main.Config.Learnsets[i];
|
||||
var moves = learnset.getCurrentMoves(pk.Level);
|
||||
Array.Resize(ref moves, 4);
|
||||
return moves;
|
||||
}
|
||||
|
||||
protected override void OnFormClosing(FormClosingEventArgs e)
|
||||
{
|
||||
|
|
@ -586,12 +573,21 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize all? Cannot undo.", "Double check Randomization settings in the Misc/Rand tab.") != DialogResult.Yes) return;
|
||||
|
||||
CB_TrainerID.SelectedIndex = 0;
|
||||
Randomizer rnd = new Randomizer(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked, CHK_G4.Checked, CHK_G5.Checked,
|
||||
CHK_G6.Checked, CHK_G7.Checked, CHK_L.Checked, CHK_E.Checked, Shedinja: true)
|
||||
var rnd = new SpeciesRandomizer(Main.Config)
|
||||
{
|
||||
BST = CHK_BST.Checked,
|
||||
Stats = Main.SpeciesStat
|
||||
G1 = CHK_G1.Checked,
|
||||
G2 = CHK_G2.Checked,
|
||||
G3 = CHK_G3.Checked,
|
||||
G4 = CHK_G4.Checked,
|
||||
G5 = CHK_G5.Checked,
|
||||
G6 = CHK_G6.Checked,
|
||||
G7 = CHK_G7.Checked,
|
||||
|
||||
E = CHK_E.Checked,
|
||||
L = CHK_L.Checked,
|
||||
rBST = CHK_BST.Checked,
|
||||
};
|
||||
rnd.Initialize();
|
||||
|
||||
var items = Randomizer.getRandomItemList();
|
||||
for (int i = 0; i < Trainers.Length; i++)
|
||||
|
|
@ -620,7 +616,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
for (int p = tr.NumPokemon; p < NUD_RMin.Value; p++)
|
||||
tr.Pokemon.Add(new trpoke7
|
||||
{
|
||||
Species = rnd.getRandomSpecies(avgSpec),
|
||||
Species = rnd.GetRandomSpecies(avgSpec),
|
||||
Level = avgLevel,
|
||||
});
|
||||
tr.NumPokemon = (int)NUD_RMin.Value;
|
||||
|
|
@ -637,7 +633,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
if (CHK_RandomPKM.Checked)
|
||||
{
|
||||
int Type = CHK_TypeTheme.Checked ? (int)Util.rnd32()%17 : -1;
|
||||
pk.Species = rnd.getRandomSpecies(pk.Species, Type);
|
||||
pk.Species = rnd.GetRandomSpeciesType(pk.Species, Type);
|
||||
pk.Form = Randomizer.GetRandomForme(pk.Species, CHK_RandomMegaForm.Checked, true, Main.SpeciesStat);
|
||||
pk.Gender = 0; // Random Gender
|
||||
}
|
||||
|
|
@ -662,10 +658,10 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
CHK_STAB.Checked, (int)NUD_STAB.Value);
|
||||
break;
|
||||
case 2: // Current LevelUp
|
||||
pk.Moves = getCurrentAttacks(pk);
|
||||
pk.Moves = move.GetCurrentMoves(pk.Species, pk.Form, pk.Level, 4);
|
||||
break;
|
||||
case 3: // High Attacks
|
||||
pk.Moves = getHighAttacks(pk);
|
||||
pk.Moves = move.GetHighPoweredMoves(pk.Species, pk.Form, 4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -678,7 +674,7 @@ private void B_HighAttack_Click(object sender, EventArgs e)
|
|||
pkm.Species = CB_Species.SelectedIndex;
|
||||
pkm.Level = (int)NUD_Level.Value;
|
||||
pkm.Form = CB_Forme.SelectedIndex;
|
||||
var moves = getHighAttacks(pkm);
|
||||
var moves = move.GetHighPoweredMoves(pkm.Species, pkm.Form, 4);
|
||||
setMoves(moves);
|
||||
}
|
||||
private void B_CurrentAttack_Click(object sender, EventArgs e)
|
||||
|
|
@ -686,7 +682,7 @@ private void B_CurrentAttack_Click(object sender, EventArgs e)
|
|||
pkm.Species = CB_Species.SelectedIndex;
|
||||
pkm.Level = (int)NUD_Level.Value;
|
||||
pkm.Form = CB_Forme.SelectedIndex;
|
||||
var moves = getCurrentAttacks(pkm);
|
||||
var moves = move.GetCurrentMoves(pkm.Species, pkm.Form, 4);
|
||||
setMoves(moves);
|
||||
}
|
||||
private void B_Clear_Click(object sender, EventArgs e)
|
||||
|
|
|
|||
|
|
@ -9,7 +9,8 @@
|
|||
|
||||
using pk3DS.Core.CTR;
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures.Gen7;
|
||||
using pk3DS.Core.Randomizers;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
|
|
@ -572,12 +573,21 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
break;
|
||||
}
|
||||
|
||||
Randomizer rnd = new Randomizer(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked, CHK_G4.Checked, CHK_G5.Checked,
|
||||
CHK_G6.Checked, CHK_G7.Checked, CHK_L.Checked, CHK_E.Checked, Shedinja: true)
|
||||
var rnd = new SpeciesRandomizer(Main.Config)
|
||||
{
|
||||
BST = CHK_BST.Checked,
|
||||
Stats = Main.SpeciesStat
|
||||
G1 = CHK_G1.Checked,
|
||||
G2 = CHK_G2.Checked,
|
||||
G3 = CHK_G3.Checked,
|
||||
G4 = CHK_G4.Checked,
|
||||
G5 = CHK_G5.Checked,
|
||||
G6 = CHK_G6.Checked,
|
||||
G7 = CHK_G7.Checked,
|
||||
|
||||
E = CHK_E.Checked,
|
||||
L = CHK_L.Checked,
|
||||
rBST = CHK_BST.Checked,
|
||||
};
|
||||
rnd.Initialize();
|
||||
|
||||
foreach (var Map in Areas)
|
||||
{
|
||||
|
|
@ -595,7 +605,7 @@ private void B_Randomize_Click(object sender, EventArgs e)
|
|||
var EncounterSet = Table.Encounters[s];
|
||||
foreach (var enc in EncounterSet.Where(enc => enc.Species != 0))
|
||||
{
|
||||
enc.Species = (uint)rnd.getRandomSpecies((int)enc.Species);
|
||||
enc.Species = (uint)rnd.GetRandomSpecies((int)enc.Species);
|
||||
enc.Forme = GetRandomForme((int) enc.Species);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
using pk3DS.Core;
|
||||
using pk3DS.Core.Structures;
|
||||
using pk3DS.Core.Structures.Gen7;
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using pk3DS.Core;
|
||||
using pk3DS.Core.Randomizers;
|
||||
using pk3DS.Core.Structures;
|
||||
|
||||
namespace pk3DS
|
||||
{
|
||||
public partial class StaticEncounterEditor7 : Form
|
||||
|
|
@ -298,26 +299,42 @@ private void changeTID(object sender, EventArgs e)
|
|||
}
|
||||
|
||||
// Randomization
|
||||
private int[] getRandomSpeciesList()
|
||||
private SpeciesRandomizer getRandomizer()
|
||||
{
|
||||
return Randomizer.getSpeciesList(CHK_G1.Checked, CHK_G2.Checked, CHK_G3.Checked, CHK_G4.Checked, CHK_G5.Checked, CHK_G6.Checked, CHK_G7.Checked,
|
||||
CHK_L.Checked, CHK_E.Checked);
|
||||
var specrand = new SpeciesRandomizer(Main.Config)
|
||||
{
|
||||
G1 = CHK_G1.Checked,
|
||||
G2 = CHK_G2.Checked,
|
||||
G3 = CHK_G3.Checked,
|
||||
G4 = CHK_G4.Checked,
|
||||
G5 = CHK_G5.Checked,
|
||||
G6 = CHK_G6.Checked,
|
||||
G7 = false,
|
||||
|
||||
E = CHK_E.Checked,
|
||||
L = CHK_L.Checked,
|
||||
|
||||
rBST = CHK_BST.Checked,
|
||||
};
|
||||
specrand.Initialize();
|
||||
return specrand;
|
||||
}
|
||||
private void B_Starters_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize Starters? Cannot undo.", "Double check Randomization settings before continuing.") != DialogResult.Yes) return;
|
||||
|
||||
int[] sL = getRandomSpeciesList();
|
||||
int ctr = 0;
|
||||
if (WinFormsUtil.Prompt(MessageBoxButtons.YesNo, "Randomize Starters? Cannot undo.", "Double check Randomization settings before continuing.") != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
setGift();
|
||||
|
||||
var specrand = getRandomizer();
|
||||
var formrand = new FormRandomizer(Main.Config) { AllowMega = false, AllowAlolanForm = true };
|
||||
|
||||
// Assign Species
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
var t = Gifts[i];
|
||||
t.Species = Randomizer.getRandomSpecies(ref sL, ref ctr, oldStarters[i], CHK_BST.Checked, Main.SpeciesStat);
|
||||
t.Form = Randomizer.GetRandomForme(t.Species, false, true);
|
||||
t.Species = specrand.GetRandomSpecies(oldStarters[i]);
|
||||
t.Form = formrand.GetRandomForme(t.Species);
|
||||
|
||||
// no level boosting
|
||||
}
|
||||
|
|
@ -329,39 +346,40 @@ private void B_Starters_Click(object sender, EventArgs e)
|
|||
}
|
||||
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;
|
||||
|
||||
int[] sL = getRandomSpeciesList();
|
||||
int ctr = 0;
|
||||
|
||||
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 = Randomizer.getRandomSpecies(ref sL, ref ctr, t.Species, CHK_BST.Checked, Main.SpeciesStat);
|
||||
t.Form = Randomizer.GetRandomForme(t.Species, false, true);
|
||||
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 = Randomizer.getRandomSpecies(ref sL, ref ctr, t.Species, CHK_BST.Checked, Main.SpeciesStat);
|
||||
t.Form = Randomizer.GetRandomForme(t.Species, false, true);
|
||||
int[] moves = Main.Config.Learnsets[t.Species].getCurrentMoves(t.Level); Array.Resize(ref moves, 4);
|
||||
t.RelearnMoves = moves;
|
||||
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 = Randomizer.getRandomSpecies(ref sL, ref ctr, t.Species, CHK_BST.Checked, Main.SpeciesStat);
|
||||
t.Form = Randomizer.GetRandomForme(t.Species, false, true);
|
||||
t.TradeRequestSpecies = Randomizer.getRandomSpecies(ref sL, ref ctr, t.TradeRequestSpecies, CHK_BST.Checked, Main.SpeciesStat);
|
||||
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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user