Merge pull request #11 from kwsch/master

Update from upstream repo kwsch/PKHeX
This commit is contained in:
ReignOfComputer 2017-02-27 07:08:05 +08:00 committed by GitHub
commit a989a73317
14 changed files with 217 additions and 2 deletions

View file

@ -938,6 +938,7 @@
this.TB_Level.Size = new System.Drawing.Size(22, 20);
this.TB_Level.TabIndex = 8;
this.TB_Level.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.TB_Level.Click += new System.EventHandler(this.clickLevel);
this.TB_Level.TextChanged += new System.EventHandler(this.updateEXPLevel);
//
// MT_Level

View file

@ -1714,6 +1714,15 @@ namespace PKHeX.WinForms
else
TB_Friendship.Text = TB_Friendship.Text == "255" ? SAV.Personal[pkm.Species].BaseFriendship.ToString() : "255";
}
private void clickLevel(object sender, EventArgs e)
{
if (ModifierKeys == Keys.Control)
{
((MaskedTextBox)sender).Text = "100";
}
}
private void clickGender(object sender, EventArgs e)
{
// Get Gender Threshold
@ -2814,6 +2823,8 @@ namespace PKHeX.WinForms
pkm.Nature = CB_Nature.SelectedIndex;
updateRandomPID(sender, e);
}
if (sender == CB_HeldItem && SAV.Generation == 7)
updateLegality();
}
updateNatureModification(sender, null);
updateIVs(null, null); // updating Nature will trigger stats to update as well

View file

@ -23,6 +23,8 @@
return GameVersion.RBY;
case GameVersion.GS:
case GameVersion.GD:
case GameVersion.SV:
case GameVersion.C:
return GameVersion.GSC;

View file

@ -8,7 +8,6 @@
BATREV = -7,
RSBOX = -5,
GS = -4,
C = -3,
// Indicators
Invalid = -2,
@ -23,6 +22,7 @@
/*Gen7*/ SN = 30, MN = 31,
/* GO */ GO = 34,
/* VC */ RD = 35, GN = 36, BU = 37, YW = 38, // GN = Blue for international release
GD, SV, C,
// Game Groupings (SaveFile type)
RBY = 98,

View file

@ -174,6 +174,7 @@ namespace PKHeX.Core
verifyForm();
verifyMisc();
verifyGender();
verifyItem();
verifyVersionEvolution();
// SecondaryChecked = true;

View file

@ -69,6 +69,13 @@ namespace PKHeX.Core
// return;
}
}
private void verifyItem()
{
if (!Legal.getHeldItemAllowed(pkm.Format, pkm.HeldItem))
AddLine(Severity.Invalid, "Held item is unreleased.", CheckIdentifier.Form);
}
private void verifyECPID()
{
if (pkm.EncryptionConstant == 0)

View file

@ -21,6 +21,8 @@ namespace PKHeX.Core
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;
private static readonly EncounterArea[] SlotsGSC;
private static readonly EncounterStatic[] StaticGSC;
// Gen 6
private static readonly EggMoves[] EggMovesXY = EggMoves6.getArray(Data.unpackMini(Resources.eggmove_xy, "xy"));
@ -46,6 +48,9 @@ namespace PKHeX.Core
{
case GameVersion.RBY:
return Encounter_RBY; // GameVersion filtering not possible, return immediately
case GameVersion.GSC:
return Encounter_GSC;
case GameVersion.X: case GameVersion.Y:
table = Encounter_XY;
break;
@ -161,6 +166,10 @@ namespace PKHeX.Core
// Gen 2
{
Evolves2 = new EvolutionTree(new[] { Resources.evos_gsc }, GameVersion.GSC, PersonalTable.C, MaxSpeciesID_2);
SlotsGSC = new EncounterArea[0]; // todo
StaticGSC = getStaticEncounters(GameVersion.GSC);
}
// Gen 6
{
@ -647,6 +656,30 @@ namespace PKHeX.Core
}
}
internal static bool[] getReleasedHeldItems(int generation)
{
switch (generation)
{
case 2: return ReleasedHeldItems_2;
case 3: return ReleasedHeldItems_3;
case 4: return ReleasedHeldItems_4;
case 5: return ReleasedHeldItems_5;
case 6: return ReleasedHeldItems_6;
case 7: return ReleasedHeldItems_7;
default: return new bool[0];
}
}
internal static bool getHeldItemAllowed(int generation, int item)
{
if (item < 0)
return false;
if (item == 0)
return true;
var items = getReleasedHeldItems(generation);
return items.Length > item && items[item];
}
internal static bool getDexNavValid(PKM pkm)
{
if (!pkm.AO || !pkm.InhabitedGeneration(6))
@ -1072,6 +1105,11 @@ namespace PKHeX.Core
case GameVersion.GN: case GameVersion.YW:
return getSlots(pkm, SlotsRBY, lvl);
case GameVersion.GSC:
case GameVersion.GD: case GameVersion.SV:
case GameVersion.C:
return getSlots(pkm, SlotsGSC, lvl);
case GameVersion.X:
return getSlots(pkm, SlotsX, lvl);
case GameVersion.Y:
@ -1097,6 +1135,11 @@ namespace PKHeX.Core
case GameVersion.GN: case GameVersion.YW:
return getStatic(pkm, StaticRBY, lvl);
case GameVersion.GSC:
case GameVersion.GD: case GameVersion.SV:
case GameVersion.C:
return getStatic(pkm, StaticGSC, lvl);
case GameVersion.X:
return getStatic(pkm, StaticX, lvl);
case GameVersion.Y:
@ -1346,6 +1389,23 @@ namespace PKHeX.Core
r.AddRange(getTutorMoves(pkm, species, form, specialTutors));
break;
}
case 2:
{
int index = PersonalTable.C.getFormeIndex(species, 0);
var pi_c = (PersonalInfoG1)PersonalTable.C[index];
if (LVL)
{
r.AddRange(LevelUpGS[index].getMoves(lvl));
r.AddRange(LevelUpC[index].getMoves(lvl));
}
if (Machine)
{
r.AddRange(TMHM_GSC.Where((t, m) => pi_c.TMHM[m]));
}
if (moveTutor)
r.AddRange(getTutorMoves(pkm, species, form, specialTutors));
break;
}
case 6:
switch (ver)
{

View file

@ -35,15 +35,34 @@ namespace PKHeX.Core
10, 05, 10, 20, 20, 40, 15, 10, 20, 20, 25, 05, 15, 10, 05, 20, 15, 20, 25, 20, 05, 30, 05, 10, 20, 40, 05, 20, 40, 20, 15, 35, 10, 05, 05, 05, 15, 05, 20, 05, 05, 15, 20, 10, 05, 05, 15, 15, 15, 15,
10, 00, 00, 00, 00
};
internal static readonly int[] TMHM_GSC =
{
223, 029, 174, 205, 046, 092, 192, 249, 244, 237,
241, 230, 173, 059, 063, 196, 182, 240, 202, 203,
218, 076, 231, 225, 087, 089, 216, 091, 094, 247,
189, 104, 008, 207, 214, 188, 201, 126, 129, 111,
009, 138, 197, 156, 213, 168, 211, 007, 210, 171,
015, 019, 057, 070, 148, 250, 127
};
internal static readonly int[] WildPokeBalls2 = { 4 };
internal static readonly int[] FutureEvolutionsGen2 =
{
424,429,430,461,462,463,464,465,466,467,468,469,470,471,472,473,474,700
};
internal static readonly EncounterStatic[] Encounter_GSC =
{
// todo
};
internal static readonly EncounterTrade[] TradeGift_GSC =
{
// todo
};
internal static readonly int[] UnreleasedItems_2 =
{
// todo
};
internal static readonly bool[] ReleasedHeldItems_2 = Enumerable.Range(1, MaxItemID_2).Select(i => HeldItems_GSC.Contains((ushort)i) && !UnreleasedItems_2.Contains(i)).ToArray();
}
}

View file

@ -94,5 +94,10 @@ namespace PKHeX.Core
};
// Ambipom Weavile Magnezone Lickilicky Tangrowth
// Yanmega Leafeon Glaceon Mamoswine Gliscor Probopass
internal static readonly int[] UnreleasedItems_3 =
{
// todo
};
internal static readonly bool[] ReleasedHeldItems_3 = Enumerable.Range(1, MaxItemID_3).Select(i => HeldItems_RS.Contains((ushort)i) && !UnreleasedItems_3.Contains(i)).ToArray();
}
}

View file

@ -135,5 +135,10 @@ namespace PKHeX.Core
{
700
};
internal static readonly int[] UnreleasedItems_4 =
{
// todo
};
internal static readonly bool[] ReleasedHeldItems_4 = Enumerable.Range(1, MaxItemID_4_HGSS).Select(i => HeldItems_HGSS.Contains((ushort)i) && !UnreleasedItems_4.Contains(i)).ToArray();
}
}

View file

@ -94,5 +94,10 @@ namespace PKHeX.Core
{
700
};
internal static readonly int[] UnreleasedItems_5 =
{
// todo
};
internal static readonly bool[] ReleasedHeldItems_5 = Enumerable.Range(1, MaxItemID_5_B2W2).Select(i => HeldItems_BW.Contains((ushort)i) && !UnreleasedItems_5.Contains(i)).ToArray();
}
}

View file

@ -762,5 +762,10 @@ namespace PKHeX.Core
05, 10, 05, 05, 15, 10, 05, 05, 05, 10, 10, 10, 10, 20, 25, 10, 20, 30, 25, 20, 20, 15, 20, 15, 20, 20, 10, 10, 10, 10, 10, 20, 10, 30, 15, 10, 10, 10, 20, 20, 05, 05, 05, 20, 10, 10, 20, 15, 20, 20,
10, 20, 30, 10, 10, 40, 40, 30, 20, 40, 20, 20, 10, 10, 10, 10, 05, 10, 10, 05, 05,
};
internal static readonly int[] UnreleasedItems_6 =
{
// todo
};
internal static readonly bool[] ReleasedHeldItems_6 = Enumerable.Range(0, MaxItemID_6_AO).Select(i => HeldItem_AO.Contains((ushort)i) && !UnreleasedItems_6.Contains(i)).ToArray();
}
}

View file

@ -1250,5 +1250,98 @@ namespace PKHeX.Core
};
#endregion
#region Unreleased Items
internal static readonly int[] UnreleasedHeldItems_7 =
{
016, // Cherish Ball
064, // Fluffy Tail
065, // Blue Flute
066, // Yellow Flute
067, // Red Flute
068, // Black Flute
069, // White Flute
070, // Shoal Salt
071, // Shoal Shell
099, // Root Fossil
100, // Claw Fossil
101, // Helix Fossil
102, // Dome Fossil
103, // Old Amber
111, // Odd Keystone
164, // Razz Berry
166, // Nanab Berry
167, // Wepear Berry
175, // Cornn Berry
176, // Magost Berry
177, // Rabuta Berry
178, // Nomel Berry
179, // Spelon Berry
180, // Pamtre Berry
181, // Watmel Berry
182, // Durin Berry
183, // Belue Berry
208, // Enigma Berry
209, // Micle Berry
210, // Custap Berry
211, // Jaboca Berry
212, // Rowap Berry
215, // Macho Brace
260, // Red Scarf
261, // Blue Scarf
262, // Pink Scarf
263, // Green Scarf
264, // Yellow Scarf
548, // Fire Gem
549, // Water Gem
550, // Electric Gem
551, // Grass Gem
552, // Ice Gem
553, // Fighting Gem
554, // Poison Gem
555, // Ground Gem
556, // Flying Gem
557, // Psychic Gem
558, // Bug Gem
559, // Rock Gem
560, // Ghost Gem
561, // Dragon Gem
562, // Dark Gem
563, // Steel Gem
657, // Gardevoirite
658, // Ampharosite
662, // Mewtwonite X
663, // Mewtwonite Y
664, // Blazikenite
665, // Medichamite
666, // Houndoominite
667, // Aggronite
668, // Banettite
669, // Tyranitarite
674, // Abomasite
680, // Heracronite
681, // Mawilite
682, // Manectite
684, // Latiasite
685, // Latiosite
710, // Jaw Fossil
711, // Sail Fossil
715, // Fairy Gem
752, // Swamperite
753, // Sceptilite
755, // Altarianite
756, // Galladite
757, // Audinite
761, // Steelixite
762, // Pidgeotite
764, // Diancite
767, // Cameruptite
768, // Lopunnite
770, // Beeddrillite
802, // Marshadium Z
836, // Pikashunium Z
};
#endregion
internal static readonly bool[] ReleasedHeldItems_7 = Enumerable.Range(1, MaxItemID_7).Select(i => HeldItems_SM.Contains((ushort)i) && !UnreleasedHeldItems_7.Contains(i)).ToArray();
}
}

View file

@ -24,6 +24,7 @@ Control + Click on...
- Randomize EVs: Set all EVs to 0.
- PP Ups Label: Set all PP Ups to 0. (Click = 3)
- Friendship Label: Set Friendship to 0. (Click = 255 or Base)
- Level box: Set Level to 100.
Alt + Click on...
- Preview Sprite to load from a QR url on your clipboard.