From 543e7bab88f729a8c4a9f3a4ed4c03b7283612a2 Mon Sep 17 00:00:00 2001 From: wwwwwwzx Date: Sun, 26 Mar 2017 20:23:45 -0700 Subject: [PATCH] Add daily changing pokemon in Great Marsh (dppt) add batch encounterarea generation function --- PKHeX/Legality/Core.cs | 8 +++--- PKHeX/Legality/Structures/EncounterArea.cs | 31 ++++++++++++++++++++++ PKHeX/Legality/Tables4.cs | 14 ++++++++++ 3 files changed, 50 insertions(+), 3 deletions(-) diff --git a/PKHeX/Legality/Core.cs b/PKHeX/Legality/Core.cs index 55f2f5c46..387532c8b 100644 --- a/PKHeX/Legality/Core.cs +++ b/PKHeX/Legality/Core.cs @@ -499,6 +499,8 @@ namespace PKHeX.Core var Pt_Slots = getEncounterTables(GameVersion.Pt); var HG_Slots = getEncounterTables(GameVersion.HG); var SS_Slots = getEncounterTables(GameVersion.SS); + var DP_GreatMarshAlt = EncounterArea.getSimpleEncounterArea(DP_GreatMarshAlt_Speices, new[] {22,22, 24,24, 26,26}, 52, SlotType.Grass_Safari); + var Pt_GreatMarshAlt = EncounterArea.getSimpleEncounterArea(Pt_GreatMarshAlt_Speices, new[] {27,30}, 52, SlotType.Grass_Safari); var DP_Trophy = EncounterArea.getTrophyArea(TrophyDP, new[] {16, 18}); var Pt_Trophy = EncounterArea.getTrophyArea(TrophyPt, new[] {22, 22}); var HG_Headbutt_Slots = EncounterArea.getArray4HGSS_Headbutt(Data.unpackMini(Resources.encunters_hb_hg, "hg")); @@ -533,9 +535,9 @@ namespace PKHeX.Core MarkG4SlotsGreatMarsh(ref P_Slots, 52); MarkG4SlotsGreatMarsh(ref Pt_Slots, 52); - SlotsD = addExtraTableSlots(D_Slots, D_HoneyTrees_Slots, SlotsDPPPtAlt, DP_Trophy); - SlotsP = addExtraTableSlots(P_Slots, P_HoneyTrees_Slots, SlotsDPPPtAlt, DP_Trophy); - SlotsPt = addExtraTableSlots(Pt_Slots, Pt_HoneyTrees_Slots, SlotsDPPPtAlt, Pt_Trophy); + SlotsD = addExtraTableSlots(D_Slots, D_HoneyTrees_Slots, DP_GreatMarshAlt, SlotsDPPPtAlt, DP_Trophy); + SlotsP = addExtraTableSlots(P_Slots, P_HoneyTrees_Slots, DP_GreatMarshAlt, SlotsDPPPtAlt, DP_Trophy); + SlotsPt = addExtraTableSlots(Pt_Slots, Pt_HoneyTrees_Slots, Pt_GreatMarshAlt, SlotsDPPPtAlt, Pt_Trophy); SlotsHG = addExtraTableSlots(HG_Slots, HG_Headbutt_Slots, SlotsHGSSAlt); SlotsSS = addExtraTableSlots(SS_Slots, SS_Headbutt_Slots, SlotsHGSSAlt); diff --git a/PKHeX/Legality/Structures/EncounterArea.cs b/PKHeX/Legality/Structures/EncounterArea.cs index 4683694f6..a69eadb75 100644 --- a/PKHeX/Legality/Structures/EncounterArea.cs +++ b/PKHeX/Legality/Structures/EncounterArea.cs @@ -890,6 +890,37 @@ namespace PKHeX.Core return new[] { new EncounterArea { Location = 68, Slots = l.ToArray() } }; } + /// + /// Gets the encounter areas for species with same level range and same slottype at same location + /// + /// List of species that exist in the Area. + /// Paired LevelMins and LevelMaxs of the encounter slots. + /// Location index of the encounter area. + /// Encounter slot type of the encounter area. + /// + public static EncounterArea[] getSimpleEncounterArea(IEnumerable species, int[] lvls, int location, SlotType t) + { + var l = new List(); + // levels data not paired + if ((lvls.Length & 1) == 1) + return new[] { new EncounterArea { Location = location, Slots = l.ToArray() } }; + + foreach (var s in species) + { + for (int i = 0; i < lvls.Length;) + { + l.Add(new EncounterSlot + { + LevelMin = lvls[i++], + LevelMax = lvls[i++], + Species = s, + Type = t + }); + } + } + return new[] { new EncounterArea { Location = location, Slots = l.ToArray() } }; + } + public static EncounterArea[] getArray(byte[][] entries) { if (entries == null) diff --git a/PKHeX/Legality/Tables4.cs b/PKHeX/Legality/Tables4.cs index f89b46f45..1af461542 100644 --- a/PKHeX/Legality/Tables4.cs +++ b/PKHeX/Legality/Tables4.cs @@ -992,6 +992,20 @@ namespace PKHeX.Core private static int[] TrophyDP = {035, 039, 052, 113, 133, 137, 173, 174, 183, 298, 311, 312, 351, 438, 439, 440}; // Porygon private static int[] TrophyPt = {035, 039, 052, 113, 133, 132, 173, 174, 183, 298, 311, 312, 351, 438, 439, 440}; // Ditto + private static readonly int[] DP_GreatMarshAlt_Speices = + { + // Daily changing Pokemon are not in the raw data http://bulbapedia.bulbagarden.net/wiki/Great_Marsh + 055,315,397,451,453,455, + 183,194,195,298,399,400, // Pre-National Pokédex + 046,102,115,193,285,316,452,454 // Post-National Pokédex + }; + private static readonly int[] Pt_GreatMarshAlt_Speices = + { + 114,193,195,357,451,453,455, + 194, // Pre-National Pokédex + 046,102,115,285,316,352,452,454 // Post-National Pokédex + }; + private static readonly int[] Shellos_EastSeaLocation_DP = { 28, // Route 213