Add gen2 evolutions/learnset

This commit is contained in:
Kurt 2017-02-25 12:37:01 -08:00
parent 90300dccd2
commit ef5dc3f6e9
9 changed files with 110 additions and 17 deletions

View file

@ -11,12 +11,17 @@ namespace PKHeX.Core
public static MysteryGift[] MGDB_G6, MGDB_G7 = new MysteryGift[0];
// Gen 1
private static readonly Learnset[] LevelUpRB = Learnset1.getArray(Resources.lvlmove_rb);
private static readonly Learnset[] LevelUpY = Learnset1.getArray(Resources.lvlmove_y);
private static readonly Learnset[] LevelUpRB = Learnset1.getArray(Resources.lvlmove_rb, MaxSpeciesID_1);
private static readonly Learnset[] LevelUpY = Learnset1.getArray(Resources.lvlmove_y, MaxSpeciesID_1);
private static readonly EvolutionTree Evolves1;
private static readonly EncounterArea[] SlotsRBY;
private static readonly EncounterStatic[] StaticRBY;
// Gen 2
private static readonly Learnset[] LevelUpGS = Learnset1.getArray(Resources.lvlmove_gs, MaxSpeciesID_2);
private static readonly Learnset[] LevelUpC = Learnset1.getArray(Resources.lvlmove_c, MaxSpeciesID_2);
private static readonly EvolutionTree Evolves2;
// Gen 6
private static readonly EggMoves[] EggMovesXY = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_xy, "xy"));
private static readonly Learnset[] LevelUpXY = Learnset6.getArray(Data.unpackMini(Resources.lvlmove_xy, "xy"));
@ -153,6 +158,10 @@ namespace PKHeX.Core
SlotsRBY[SlotsRBY.Length - 1] = FishOldGood_RBY;
StaticRBY = getStaticEncounters(GameVersion.RBY);
}
// Gen 2
{
Evolves2 = new EvolutionTree(new[] { Resources.evos_gsc }, GameVersion.GSC, PersonalTable.C, MaxSpeciesID_2);
}
// Gen 6
{
StaticX = getStaticEncounters(GameVersion.X);
@ -439,6 +448,8 @@ namespace PKHeX.Core
{
case 1:
return Evolves1;
case 2:
return Evolves2;
case 6:
return Evolves6;

View file

@ -20,7 +20,10 @@ namespace PKHeX.Core
switch (game)
{
case GameVersion.RBY:
Entries = EvolutionSet1.getArray(data[0]);
Entries = EvolutionSet1.getArray(data[0], maxSpeciesTree);
break;
case GameVersion.GSC:
Entries = EvolutionSet2.getArray(data[0], maxSpeciesTree);
break;
case GameVersion.ORAS:
Entries.AddRange(data.Select(d => new EvolutionSet6(d)));
@ -174,7 +177,7 @@ namespace PKHeX.Core
case 1: // Level
var m1 = new EvolutionMethod
{
Method = 1, // Use Item
Method = 1, // Level Up
Level = data[offset + 1],
Species = data[offset + 2]
};
@ -202,11 +205,11 @@ namespace PKHeX.Core
}
return null;
}
public static List<EvolutionSet> getArray(byte[] data)
public static List<EvolutionSet> getArray(byte[] data, int maxSpecies)
{
var evos = new List<EvolutionSet>();
int offset = 0;
for (int i = 0; i <= Legal.MaxSpeciesID_1; i++)
for (int i = 0; i <= maxSpecies; i++)
{
var m = new List<EvolutionMethod>();
while (data[offset] != 0)
@ -217,6 +220,42 @@ namespace PKHeX.Core
return evos;
}
}
public class EvolutionSet2 : EvolutionSet
{
private static EvolutionMethod getMethod(byte[] data, ref int offset)
{
int method = data[offset];
int arg = data[offset + 1];
int species = data[offset + 2];
offset += 3;
switch (method)
{
case 1: /* Level Up */ return new EvolutionMethod { Method = 1, Species = species, Level = arg };
case 2: /* Use Item */ return new EvolutionMethod { Method = 8, Species = species, Argument = arg };
case 3: /* Trade */ return new EvolutionMethod { Method = 5, Species = species };
case 4: /*Friendship*/ return new EvolutionMethod { Method = 1, Species = species };
case 5: /* Stats */
// species is currently stat ID, we don't care about evo type as stats can be changed after evo
return new EvolutionMethod { Method = 1, Species = data[offset++], Level = arg }; // Tyrogue stats
}
return null;
}
public static List<EvolutionSet> getArray(byte[] data, int maxSpecies)
{
var evos = new List<EvolutionSet>();
int offset = 0;
for (int i = 0; i <= maxSpecies; i++)
{
var m = new List<EvolutionMethod>();
while (data[offset] != 0)
m.Add(getMethod(data, ref offset));
++offset;
evos.Add(new EvolutionSet2 { PossibleEvolutions = m.ToArray() });
}
return evos;
}
}
public class EvolutionSet6 : EvolutionSet
{
private const int SIZE = 6;

View file

@ -36,9 +36,9 @@ namespace PKHeX.Core
Levels = levels.ToArray();
Count = Moves.Length;
}
public static Learnset[] getArray(byte[] input)
public static Learnset[] getArray(byte[] input, int maxSpecies)
{
var data = new Learnset[Legal.MaxSpeciesID_1 + 1];
var data = new Learnset[maxSpecies + 1];
int offset = 0;
for (int s = 0; s < data.Length; s++)

View file

@ -270,12 +270,15 @@
<None Include="Resources\byte\encounter_sn_sos.pkl" />
<None Include="Resources\byte\encounter_yellow.pkl" />
<None Include="Resources\byte\encounter_yellow_f.pkl" />
<None Include="Resources\byte\evos_gsc.pkl" />
<None Include="Resources\byte\evos_rby.pkl" />
<None Include="Resources\byte\evos_sm.pkl" />
<None Include="Resources\byte\fashion_f_sm" />
<None Include="Resources\byte\fashion_f_sm_illegal" />
<None Include="Resources\byte\fashion_m_sm" />
<None Include="Resources\byte\fashion_m_sm_illegal" />
<None Include="Resources\byte\lvlmove_c.pkl" />
<None Include="Resources\byte\lvlmove_gs.pkl" />
<None Include="Resources\byte\lvlmove_rb.pkl" />
<None Include="Resources\byte\lvlmove_rby.pkl" />
<None Include="Resources\byte\lvlmove_sm.pkl" />

View file

@ -12324,14 +12324,15 @@ namespace PKHeX.Core.Properties {
/// Looks up a localized string similar to PKHeX - By Kaphotics
///http://projectpokemon.org/pkhex
///
///17/02/07 - New Update:
///17/02/25 - New Update:
/// - Legality:
/// - - Added: Legality indication for exported QR images (if legality check is available for origin).
/// - - Added: Legality indication for Box/Party pkm slots (^ + opt-in via Options-&gt;Set to SAV).
/// - - Added: Legality checking for RBY Pokémon as pk1 and pk7+.
/// - - Fixed: More edge cases for legality checks.
/// - Added: More Generation 7 trainer stat record labels. Thanks skywalker25 &amp; Holla!
/// - Added: G7TID -&gt; TID/SID generator for Generation 7 Trainer Editor. Thanks RoC!
/// - [rest of string was truncated]&quot;;.
/// - Batch Editor:
/// - - Added: Nickname clearing to batch editor (via .IsNicknamed=False).
/// - - Added: Legality filtering and bulk suggestions for Met Location, Current Moves &amp; Relearn Moves.
/// - - - Use $suggest to use suggested result from the legality analysis.
/// - - Changed: Properties are now sort [rest of string was truncated]&quot;;.
/// </summary>
public static string changelog {
get {
@ -12591,6 +12592,16 @@ namespace PKHeX.Core.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
public static byte[] evos_gsc {
get {
object obj = ResourceManager.GetObject("evos_gsc", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
@ -17823,6 +17834,26 @@ namespace PKHeX.Core.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
public static byte[] lvlmove_c {
get {
object obj = ResourceManager.GetObject("lvlmove_c", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
public static byte[] lvlmove_gs {
get {
object obj = ResourceManager.GetObject("lvlmove_gs", resourceCulture);
return ((byte[])(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Byte[].
/// </summary>
@ -18084,7 +18115,7 @@ namespace PKHeX.Core.Properties {
}
/// <summary>
/// Looks up a localized string similar to 20170207.
/// Looks up a localized string similar to 20170225.
/// </summary>
public static string ProgramVersion {
get {
@ -34274,8 +34305,8 @@ namespace PKHeX.Core.Properties {
///小磁怪
///三合一磁怪
///大蔥鴨
///都都
///都都
///嘟嘟
///嘟嘟
///小海獅
///白海獅
///臭泥

View file

@ -7411,4 +7411,13 @@
<data name="personal_y" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\personal_y;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="evos_gsc" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\evos_gsc.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="lvlmove_c" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\lvlmove_c.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="lvlmove_gs" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\byte\lvlmove_gs.pkl;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
</root>

Binary file not shown.

Binary file not shown.

Binary file not shown.