PKHeX/PKHeX.Core/Legality/Tables/Locations.cs

122 lines
4.9 KiB
C#
Raw Normal View History

namespace PKHeX.Core
{
/// <summary>
/// Decoration and logic for Met Location IDs
/// </summary>
public static class Locations
{
public const int LinkTrade4 = 2002;
public const int LinkTrade5 = 30003;
public const int LinkTrade6 = 30002;
public const int Daycare4 = 2000;
public const int Daycare5 = 60002;
public const int LinkTrade2NPC = 126;
public const int LinkTrade3NPC = 254;
public const int LinkTrade4NPC = 2001;
public const int LinkTrade5NPC = 30002;
public const int LinkTrade6NPC = 30001;
public const int PokeWalker4 = 233;
public const int Ranger4 = 3001;
public const int Faraway4 = 3002;
/// <summary> Goldenrod City in <see cref="GameVersion.C"/> </summary>
public const int HatchLocationC = 16;
/// <summary> Route 117 in <see cref="GameVersion.RSE"/> </summary>
public const int HatchLocationRSE = 32;
/// <summary> Route 17 in <see cref="GameVersion.FRLG"/> </summary>
public const int HatchLocationFRLG = 117;
/// <summary> Solaceon Town in <see cref="GameVersion.DPPt"/> </summary>
public const int HatchLocationDPPt = 4;
/// <summary> Route 34 in <see cref="GameVersion.HGSS"/> </summary>
public const int HatchLocationHGSS = 182;
/// <summary> Skyarrow Bridge in <see cref="GameVersion.Gen5"/> </summary>
public const int HatchLocation5 = 64;
/// <summary> Route 7 in <see cref="GameVersion.XY"/> </summary>
public const int HatchLocation6XY = 38;
/// <summary> Battle Resort in <see cref="GameVersion.ORAS"/> </summary>
public const int HatchLocation6AO = 318;
/// <summary> Paniola Ranch in <see cref="GameVersion.Gen7"/> </summary>
public const int HatchLocation7 = 78;
2019-11-16 01:34:18 +00:00
/// <summary> Route 5 in <see cref="GameVersion.SWSH"/> </summary>
public const int HatchLocation8 = 40;
/// <summary> Generation 1 -> Generation 7 Transfer Location (Kanto) </summary>
public const int Transfer1 = 30013;
/// <summary> Generation 2 -> Generation 7 Transfer Location (Johto) </summary>
public const int Transfer2 = 30017;
/// <summary> Generation 3 -> Generation 4 Transfer Location (Pal Park) </summary>
public const int Transfer3 = 0x37;
/// <summary> Generation 4 -> Generation 5 Transfer Location (Poké Transporter) </summary>
public const int Transfer4 = 30001;
/// <summary> Generation 4 -> Generation 5 Transfer Location (Crown Celebi - Event not activated in Gen 5) </summary>
public const int Transfer4_CelebiUnused = 30010;
/// <summary> Generation 4 -> Generation 5 Transfer Location (Crown Celebi - Event activated in Gen 5) </summary>
public const int Transfer4_CelebiUsed = 30011;
/// <summary> Generation 4 -> Generation 5 Transfer Location (Crown Beast - Event not activated in Gen 5) </summary>
public const int Transfer4_CrownUnused = 30012;
/// <summary> Generation 4 -> Generation 5 Transfer Location (Crown Beast - Event activated in Gen 5) </summary>
public const int Transfer4_CrownUsed = 30013;
/// <summary> Generation 6 Gift from Pokémon Link </summary>
public const int LinkGift6 = 30011;
/// <summary> Generation 7 Transfer from GO to Pokémon LGP/E's GO Park </summary>
public const int GO7 = 50;
/// <summary> Generation 8 Transfer from GO to Pokémon HOME </summary>
public const int GO8 = 30012;
/// <summary> Generation 8 Gift from Pokémon HOME </summary>
public const int HOME8 = 30018;
Offload EncounterSlot loading logic to reduce complexity (#2980) * Rework gen1 slot loading Slot templates are precomputed from ROM data and just loaded straight in, with tight coupling to the encounter area (grouped by slot types). * Revise fuzzy met check for underleveled wild evos Example: Level 23 poliwhirl in RBY as a level 50 poliwhirl, will assume the chain is 25-50 for poliwhirl (as poliwag evolves at 25). Instead of revising the origin chain, just ignore the evo min level in the comparison. Previous commit fixed it for gen1. * Rework gen2-4 slot loading Gen4 not finished, Type Encounter data and some edge encounters not recognizing yet... * Add feebas slots for old/good encounters * Begin moving properties Great news! Gen5-7 need to be de-dumbed like Gen1-4. Then I can remove the bang (!) on the Area accessor and ensure that it's never null! * Split off XD pokespot slot encounter table type * Set area in constructor * Deduplicate g3 roaming encounters * Deduplicate xd encounter locations (rebattle) Only difference is met location; no need to create 500 extra encounter objects. A simple contains check is ok (rarely in gen3 format). * Make all slots have a readonly reference to their parent area * Minor clean * Remove "Safari" slot type flag Can be determined via other means (generation-location), allows us to reduce the size of SlotType member to a byte Output of slot binaries didn't preserve the Safari flag anyway. * Update SlotType.cs * Handle type encounters correctly * Merge safari area into regular xy area * Merge dexnav accessor logic * fix some logic so that tests pass again rearrange g5 dw init to be done outside of static constructor (initializer instead) PIDGenerator: friend safari slots now generate with required flawless IV count * Add cianwood tentacool gift encounter * Remove unnecessary abstractions Fake area just returned a slot; since Slots have a non-null reference to the area, we can just return the slot and use the API to grab a list of possible slots for the chain. Increase restrictiveness of location/type get-set operations * Minor tweaks, pass parameters DexNav observed state isn't necessary to use, only need to see if it's possible to dexnav. Now that we have metadata for slots, we can. * Remove unused legality tables
2020-08-30 17:23:22 +00:00
public const int BugCatchingContest4 = 207;
public static int TradedEggLocationNPC(int generation) => generation switch
{
1 => LinkTrade2NPC,
2 => LinkTrade2NPC,
3 => LinkTrade3NPC,
4 => LinkTrade4NPC,
5 => LinkTrade5NPC,
_ => LinkTrade6NPC
};
public static int TradedEggLocation(int generation) => generation switch
{
4 => LinkTrade4,
5 => LinkTrade5,
_ => LinkTrade6
};
public static bool IsPtHGSSLocation(int location) => 111 < location && location < 2000;
public static bool IsPtHGSSLocationEgg(int location) => 2010 < location && location < 3000;
public static bool IsEventLocation5(int location) => 40000 < location && location < 50000;
Offload EncounterSlot loading logic to reduce complexity (#2980) * Rework gen1 slot loading Slot templates are precomputed from ROM data and just loaded straight in, with tight coupling to the encounter area (grouped by slot types). * Revise fuzzy met check for underleveled wild evos Example: Level 23 poliwhirl in RBY as a level 50 poliwhirl, will assume the chain is 25-50 for poliwhirl (as poliwag evolves at 25). Instead of revising the origin chain, just ignore the evo min level in the comparison. Previous commit fixed it for gen1. * Rework gen2-4 slot loading Gen4 not finished, Type Encounter data and some edge encounters not recognizing yet... * Add feebas slots for old/good encounters * Begin moving properties Great news! Gen5-7 need to be de-dumbed like Gen1-4. Then I can remove the bang (!) on the Area accessor and ensure that it's never null! * Split off XD pokespot slot encounter table type * Set area in constructor * Deduplicate g3 roaming encounters * Deduplicate xd encounter locations (rebattle) Only difference is met location; no need to create 500 extra encounter objects. A simple contains check is ok (rarely in gen3 format). * Make all slots have a readonly reference to their parent area * Minor clean * Remove "Safari" slot type flag Can be determined via other means (generation-location), allows us to reduce the size of SlotType member to a byte Output of slot binaries didn't preserve the Safari flag anyway. * Update SlotType.cs * Handle type encounters correctly * Merge safari area into regular xy area * Merge dexnav accessor logic * fix some logic so that tests pass again rearrange g5 dw init to be done outside of static constructor (initializer instead) PIDGenerator: friend safari slots now generate with required flawless IV count * Add cianwood tentacool gift encounter * Remove unnecessary abstractions Fake area just returned a slot; since Slots have a non-null reference to the area, we can just return the slot and use the API to grab a list of possible slots for the chain. Increase restrictiveness of location/type get-set operations * Minor tweaks, pass parameters DexNav observed state isn't necessary to use, only need to see if it's possible to dexnav. Now that we have metadata for slots, we can. * Remove unused legality tables
2020-08-30 17:23:22 +00:00
private const int SafariLocation_RSE = 57;
private const int SafariLocation_FRLG = 136;
private const int SafariLocation_HGSS = 202;
private const int MarshLocation_DPPt = 52;
2020-12-25 20:30:26 +00:00
public static bool IsSafariZoneLocation3(int loc) => loc is SafariLocation_RSE or SafariLocation_FRLG;
public static bool IsSafariZoneLocation4(int loc) => loc is MarshLocation_DPPt or SafariLocation_HGSS;
}
}