diff --git a/PKHeX.WinForms/MainWindow/Main.Designer.cs b/PKHeX.WinForms/MainWindow/Main.Designer.cs index 0ccc901dd..aa098b9d1 100644 --- a/PKHeX.WinForms/MainWindow/Main.Designer.cs +++ b/PKHeX.WinForms/MainWindow/Main.Designer.cs @@ -938,6 +938,7 @@ public void InitializeComponent() 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 diff --git a/PKHeX.WinForms/MainWindow/Main.cs b/PKHeX.WinForms/MainWindow/Main.cs index 3dc283f48..a70e8964a 100644 --- a/PKHeX.WinForms/MainWindow/Main.cs +++ b/PKHeX.WinForms/MainWindow/Main.cs @@ -1714,6 +1714,15 @@ private void clickFriendship(object sender, EventArgs e) 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 @@ private void validateComboBox2(object sender, EventArgs e) 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 diff --git a/PKHeX/Game/GameUtil.cs b/PKHeX/Game/GameUtil.cs index c11ead796..87aacdefe 100644 --- a/PKHeX/Game/GameUtil.cs +++ b/PKHeX/Game/GameUtil.cs @@ -23,6 +23,8 @@ public static GameVersion getMetLocationVersionGroup(GameVersion Version) return GameVersion.RBY; case GameVersion.GS: + case GameVersion.GD: + case GameVersion.SV: case GameVersion.C: return GameVersion.GSC; diff --git a/PKHeX/Game/GameVersion.cs b/PKHeX/Game/GameVersion.cs index c8ec6b49c..9301326c3 100644 --- a/PKHeX/Game/GameVersion.cs +++ b/PKHeX/Game/GameVersion.cs @@ -8,7 +8,6 @@ public enum GameVersion BATREV = -7, RSBOX = -5, GS = -4, - C = -3, // Indicators Invalid = -2, @@ -23,6 +22,7 @@ public enum GameVersion /*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, diff --git a/PKHeX/Legality/Analysis.cs b/PKHeX/Legality/Analysis.cs index 05aea68f1..d35e7afad 100644 --- a/PKHeX/Legality/Analysis.cs +++ b/PKHeX/Legality/Analysis.cs @@ -174,6 +174,7 @@ private void updateChecks() verifyForm(); verifyMisc(); verifyGender(); + verifyItem(); verifyVersionEvolution(); // SecondaryChecked = true; diff --git a/PKHeX/Legality/Checks.cs b/PKHeX/Legality/Checks.cs index 9b1c31a71..ecae506e4 100644 --- a/PKHeX/Legality/Checks.cs +++ b/PKHeX/Legality/Checks.cs @@ -69,6 +69,14 @@ private void verifyGender() // return; } } + + private void verifyItem() + { + var unreleasedItems = Legal.getUnreleasedItems(pkm.Format); + if (unreleasedItems.Contains(pkm.HeldItem)) + AddLine(Severity.Invalid, "Held item is unreleased.", CheckIdentifier.Form); + } + private void verifyECPID() { if (pkm.EncryptionConstant == 0) diff --git a/PKHeX/Legality/Core.cs b/PKHeX/Legality/Core.cs index d4ccad9d6..c61770c24 100644 --- a/PKHeX/Legality/Core.cs +++ b/PKHeX/Legality/Core.cs @@ -21,6 +21,8 @@ public static partial class Legal 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 @@ private static EncounterStatic[] getStaticEncounters(GameVersion Game) { 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 @@ private static void MarkG7SMSlots(ref EncounterArea[] Areas) // 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 { @@ -1072,6 +1081,11 @@ private static IEnumerable getEncounterSlots(PKM pkm, int lvl = - 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 +1111,11 @@ private static IEnumerable getStaticEncounters(PKM pkm, int lvl 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 +1365,23 @@ private static IEnumerable getMoves(PKM pkm, int species, int lvl, int form 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) { @@ -1457,5 +1493,14 @@ private static IEnumerable getTutorMoves(PKM pkm, int species, int form, bo // No tutors in G7 return moves.Distinct(); } + + public static int[] getUnreleasedItems(int generation) + { + switch (generation) + { + case 7: return UnreleasedItems_7; + default: return new int[0]; + } + } } } diff --git a/PKHeX/Legality/Tables2.cs b/PKHeX/Legality/Tables2.cs index 1fa38b361..41f235172 100644 --- a/PKHeX/Legality/Tables2.cs +++ b/PKHeX/Legality/Tables2.cs @@ -35,15 +35,29 @@ public static partial class Legal 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 }; } } diff --git a/PKHeX/Legality/Tables7.cs b/PKHeX/Legality/Tables7.cs index 55fbb84b8..ed4cb26ca 100644 --- a/PKHeX/Legality/Tables7.cs +++ b/PKHeX/Legality/Tables7.cs @@ -1250,5 +1250,97 @@ public static partial class Legal }; #endregion + + #region Unreleased Items + internal static readonly int[] UnreleasedItems_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 } } diff --git a/PKHeX/Resources/text/shortcuts.txt b/PKHeX/Resources/text/shortcuts.txt index 46c582466..7195fe319 100644 --- a/PKHeX/Resources/text/shortcuts.txt +++ b/PKHeX/Resources/text/shortcuts.txt @@ -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.