mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 20:43:07 +00:00
Add memory rarity table
This commit is contained in:
parent
c8d874462c
commit
b7acb7fa1d
4 changed files with 71 additions and 43 deletions
|
@ -146,6 +146,13 @@ namespace PKHeX.Core
|
|||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the <see cref="g1"/> version (or subset versions) is equivalent to <see cref="g2"/>.
|
||||
/// </summary>
|
||||
/// <param name="g1">Version (set)</param>
|
||||
/// <param name="g2">Individual version</param>
|
||||
public static bool Contains(this GameVersion g1, int g2) => g1.Contains((GameVersion) g2);
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the <see cref="g1"/> version (or subset versions) is equivalent to <see cref="g2"/>.
|
||||
/// </summary>
|
||||
|
|
|
@ -59,46 +59,55 @@ namespace PKHeX.Core
|
|||
new[] { 57, 19, 70, 15, 249, 127, 291}, // Move IDs
|
||||
};
|
||||
|
||||
internal static readonly int[][] LocationsWithPKCenter =
|
||||
internal static readonly int[] LocationsWithPKCenter =
|
||||
{
|
||||
new[] {
|
||||
// Kalos locations with a PKMN CENTER
|
||||
18, // Santalune City
|
||||
22, // Lumiose City
|
||||
30, // Camphrier Town
|
||||
40, // Cyllage City
|
||||
44, // Ambrette Town
|
||||
52, // Geosenge Towny
|
||||
58, // Shalour City
|
||||
64, // Coumarine City
|
||||
70, // Laverre City
|
||||
76, // Dendemille Town
|
||||
86, // Anistar City
|
||||
90, // Couriway Town
|
||||
94, // Snowbelle City
|
||||
106, // Pokémon League (X/Y)
|
||||
// Hoenn locations with a PKMN CENTER
|
||||
172, // Oldale Town
|
||||
174, // Dewford Town
|
||||
176, // Lavaridge Town
|
||||
178, // Fallarbor Town
|
||||
180, // Verdanturf Town
|
||||
182, // Pacifidlog Town
|
||||
184, // Petalburg City
|
||||
186, // Slateport City
|
||||
188, // Mauville City
|
||||
190, // Rustboro City
|
||||
192, // Fortree City
|
||||
194, // Lilycove City
|
||||
196, // Mossdeep City
|
||||
198, // Sootopolis City
|
||||
200, // Ever Grande City
|
||||
202, // Pokémon League (OR/AS)
|
||||
},
|
||||
new[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, // Region matching
|
||||
// Kalos locations with a PKMN CENTER
|
||||
18, // Santalune City
|
||||
22, // Lumiose City
|
||||
30, // Camphrier Town
|
||||
40, // Cyllage City
|
||||
44, // Ambrette Town
|
||||
52, // Geosenge Towny
|
||||
58, // Shalour City
|
||||
64, // Coumarine City
|
||||
70, // Laverre City
|
||||
76, // Dendemille Town
|
||||
86, // Anistar City
|
||||
90, // Couriway Town
|
||||
94, // Snowbelle City
|
||||
106, // Pokémon League (X/Y)
|
||||
|
||||
// Hoenn locations with a PKMN CENTER
|
||||
172, // Oldale Town
|
||||
174, // Dewford Town
|
||||
176, // Lavaridge Town
|
||||
178, // Fallarbor Town
|
||||
180, // Verdanturf Town
|
||||
182, // Pacifidlog Town
|
||||
184, // Petalburg City
|
||||
186, // Slateport City
|
||||
188, // Mauville City
|
||||
190, // Rustboro City
|
||||
192, // Fortree City
|
||||
194, // Lilycove City
|
||||
196, // Mossdeep City
|
||||
198, // Sootopolis City
|
||||
200, // Ever Grande City
|
||||
202, // Pokémon League (OR/AS)
|
||||
};
|
||||
|
||||
internal static readonly byte[] MemoryMinIntensity =
|
||||
internal static GameVersion GetGameVersionForPokeCenterIndex(int index)
|
||||
{
|
||||
return PokeCenterVersion[index] == 0 ? GameVersion.XY : GameVersion.ORAS;
|
||||
}
|
||||
|
||||
private static readonly int[] PokeCenterVersion = // Region matching
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
|
||||
};
|
||||
|
||||
private static readonly byte[] MemoryMinIntensity =
|
||||
{
|
||||
0, 1, 1, 1, 1, 2, 2, 2, 2, 2,
|
||||
2, 2, 2, 2, 3, 3, 3, 3, 4, 4,
|
||||
|
@ -109,7 +118,20 @@ namespace PKHeX.Core
|
|||
3, 3, 3, 3, 3, 2, 3, 4, 4, 2,
|
||||
};
|
||||
|
||||
internal static readonly uint[] MemoryFeelings =
|
||||
public static int GetMemoryRarity(int memory) => (uint) memory >= MemoryRandChance.Length ? -1 : MemoryRandChance[memory];
|
||||
|
||||
private static readonly byte[] MemoryRandChance =
|
||||
{
|
||||
000, 100, 100, 100, 100, 005, 005, 005, 005, 005,
|
||||
005, 005, 005, 005, 010, 020, 010, 001, 050, 030,
|
||||
005, 005, 020, 005, 005, 005, 001, 050, 100, 050,
|
||||
050, 002, 002, 005, 005, 005, 005, 005, 005, 002,
|
||||
020, 020, 005, 010, 001, 001, 050, 030, 020, 020,
|
||||
010, 010, 001, 010, 001, 050, 030, 030, 030, 002,
|
||||
050, 020, 020, 020, 020, 010, 010, 050, 020, 005,
|
||||
};
|
||||
|
||||
private static readonly uint[] MemoryFeelings =
|
||||
{
|
||||
0x000000, 0x04CBFD, 0x004BFD, 0x04CBFD, 0x04CBFD, 0xFFFBFB, 0x84FFF9, 0x47FFFF, 0xBF7FFA, 0x7660B0,
|
||||
0x80BDF9, 0x88FB7A, 0x083F79, 0x0001FE, 0xCFEFFF, 0x84EBAF, 0xB368B0, 0x091F7E, 0x0320A0, 0x080DDD,
|
||||
|
|
|
@ -57,7 +57,6 @@ namespace PKHeX.Core
|
|||
var eabil = GetEncounterFixedAbilityNumber(EncounterMatch);
|
||||
if (eabil >= 0)
|
||||
{
|
||||
|
||||
if ((data.pkm.AbilityNumber == 4) != (eabil == 4))
|
||||
return GetInvalid(LAbilityHiddenFail);
|
||||
if (eabil > 0)
|
||||
|
|
|
@ -207,7 +207,7 @@ namespace PKHeX.Core
|
|||
|
||||
switch (m)
|
||||
{
|
||||
case 6 when !Memories.LocationsWithPKCenter[0].Contains(t):
|
||||
case 6 when !Memories.LocationsWithPKCenter.Contains(t):
|
||||
return GetInvalid(string.Format(LMemoryArgBadPokecenter, tr));
|
||||
|
||||
// {0} saw {2} carrying {1} on its back. {4} that {3}.
|
||||
|
@ -296,11 +296,11 @@ namespace PKHeX.Core
|
|||
return;
|
||||
|
||||
case 6: // {0} went to the Pokémon Center in {2} with {1} and had its tired body healed there. {4} that {3}.
|
||||
int matchingOriginGame = Array.IndexOf(Memories.LocationsWithPKCenter[0], pkm.OT_TextVar);
|
||||
int matchingOriginGame = Array.IndexOf(Memories.LocationsWithPKCenter, pkm.OT_TextVar);
|
||||
if (matchingOriginGame != -1)
|
||||
{
|
||||
int gameID = Memories.LocationsWithPKCenter[1][matchingOriginGame];
|
||||
if ((pkm.XY && gameID != 0) || (pkm.AO && gameID != 1))
|
||||
var gameID = Memories.GetGameVersionForPokeCenterIndex(matchingOriginGame);
|
||||
if (!gameID.Contains((GameVersion)pkm.Version))
|
||||
data.AddLine(Severity.Invalid, string.Format(LMemoryArgBadLocation, L_XOT), CheckIdentifier.Memory);
|
||||
}
|
||||
data.AddLine(VerifyCommonMemory(pkm, 0));
|
||||
|
|
Loading…
Reference in a new issue