Skip to content

Commit

Permalink
Add support for Indigo Disk (#4111)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwsch committed Dec 18, 2023
1 parent 4f56aa2 commit 01c82e4
Show file tree
Hide file tree
Showing 308 changed files with 6,290 additions and 2,568 deletions.
2 changes: 1 addition & 1 deletion .github/README-de.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PKHeX erwartet entschlüsselte Spielstände. Da diese konsolenspezifisch verschl

## Screenshots

![Main Window](https://i.imgur.com/37SMQSr.png)
![Main Window](https://i.imgur.com/7ErmRJI.png)

## Erstellen

Expand Down
2 changes: 1 addition & 1 deletion .github/README-es.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PKHeX espera archivos de guardado que no estén cifrados con las claves específ

## Capturas de Pantalla

![Pantalla principal](https://i.imgur.com/gREbXFH.png)
![Pantalla principal](https://i.imgur.com/oM407mV.png)

## Building

Expand Down
2 changes: 1 addition & 1 deletion .github/README-fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ PKHeX attend des fichiers de sauvegarde qui ne sont pas chiffrés avec des clés

## Captures d'écran

![Main Window](https://i.imgur.com/fk6IX2a.png)
![Main Window](https://i.imgur.com/YEdBzlt.png)

## Construction

Expand Down
2 changes: 1 addition & 1 deletion .github/README-it.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PKHeX si aspetta file di salvataggio non criptati con le chiavi specifiche della

## Screenshots

![Main Window](https://i.imgur.com/epXOQ5M.png)
![Main Window](https://i.imgur.com/ICmQ41m.png)

## Building

Expand Down
2 changes: 1 addition & 1 deletion .github/README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PKHeX 所读取存档文件必须是未经主机唯一密钥加密,因此请

## 截图

![主介面](https://i.imgur.com/hM8GJ4U.png)
![主介面](https://i.imgur.com/SfskT2Q.png)

## 构建

Expand Down
2 changes: 1 addition & 1 deletion .github/README-zhHK.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ PKHeX 所讀取檔案須未經主機唯一密鑰加密,因而請使用儲存

## 螢幕擷取截圖

![主介面](https://i.imgur.com/U5FKBIF.png)
![主介面](https://i.imgur.com/zEGGuJC.png)

## 構建

Expand Down
5 changes: 5 additions & 0 deletions PKHeX.Core/Editing/HiddenPower.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ public static int GetTypeBigEndian(uint u32)
return SixBitType[(int)hp];
}

/// <summary>
/// Count of unique Hidden Power Types
/// </summary>
public const int TypeCount = 16;

private static ReadOnlySpan<byte> SixBitType =>
[
// (low-bit mash) * 15 / 63
Expand Down
9 changes: 7 additions & 2 deletions PKHeX.Core/Editing/Saves/Slots/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,17 @@ private static List<SlotInfoMisc> GetExtraSlots9(SAV9SV sav)
var afterBox = sav.GetBoxOffset(BoxLayout9.BoxCount);
var list = new List<SlotInfoMisc>
{
// Ride Legend
new(sav.BoxInfo.Data.AsMemory(afterBox), 0, true, Mutable: true) { Type = StorageSlotType.Party },
};

var block = sav.Blocks.GetBlock(SaveBlockAccessor9SV.KFusedCalyrex);
var c = new SlotInfoMisc(block.Data, 3, 0, true) { Type = StorageSlotType.Fused };
list.Add(c);
list.Add(new(block.Data, 0, 0, true) { Type = StorageSlotType.Fused });

if (sav.Blocks.TryGetBlock(SaveBlockAccessor9SV.KFusedKyurem, out var kyurem))
list.Add(new(kyurem.Data, 1, 0, true) { Type = StorageSlotType.Fused });
if (sav.Blocks.TryGetBlock(SaveBlockAccessor9SV.KFusedNecrozma, out var necrozma))
list.Add(new(necrozma.Data, 2, 0, true) { Type = StorageSlotType.Fused });
return list;
}
}
19 changes: 15 additions & 4 deletions PKHeX.Core/Editing/Showdown/ShowdownSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,11 @@ private bool ParseTeraType(ReadOnlySpan<char> value)
var types = Strings.types;
var val = StringUtil.FindIndexIgnoreCase(types, value);
if (val < 0)
return false;
{
if (value is not "Stellar")
return false;
val = TeraTypeUtil.Stellar;
}
TeraType = (MoveType)val;
return true;
}
Expand Down Expand Up @@ -369,8 +373,14 @@ public List<string> GetSetLines()
// Secondary Stats
if ((uint)Ability < Strings.Ability.Count)
result.Add($"Ability: {Strings.Ability[Ability]}");
if (Context == EntityContext.Gen9 && TeraType != MoveType.Any && (uint)TeraType < Strings.Types.Count)
result.Add($"Tera Type: {Strings.Types[(int)TeraType]}");
if (Context == EntityContext.Gen9 && TeraType != MoveType.Any)
{
if ((uint)TeraType <= (int)MoveType.Fairy)
result.Add($"Tera Type: {Strings.Types[(int)TeraType]}");
else if ((uint)TeraType == TeraTypeUtil.Stellar)
result.Add($"Tera Type: {Strings.Types[TeraTypeUtil.StellarTypeDisplayStringIndex]}");
}

if (Level != 100)
result.Add($"Level: {Level}");
if (Shiny)
Expand Down Expand Up @@ -703,7 +713,8 @@ private ReadOnlySpan<char> ParseLineMove(ReadOnlySpan<char> line)

// Defined Hidden Power
var type = GetHiddenPowerType(moveString[(hiddenPowerName.Length + 1)..]);
int hpVal = StringUtil.FindIndexIgnoreCase(Strings.types.AsSpan(1, 16), type); // Get HP Type
var types = Strings.types.AsSpan(1, HiddenPower.TypeCount);
int hpVal = StringUtil.FindIndexIgnoreCase(types, type); // Get HP Type
if (hpVal == -1)
return hiddenPowerName;

Expand Down
4 changes: 4 additions & 0 deletions PKHeX.Core/Game/Enums/Ability.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,5 +312,9 @@ public enum Ability : ushort
EmbodyAspect3,
ToxicChain,
SupersweetSyrup,
TeraShift,
TeraShell,
TeraformZero,
PoisonPuppeteer,
MAX_COUNT,
}
15 changes: 15 additions & 0 deletions PKHeX.Core/Game/Enums/Move.cs
Original file line number Diff line number Diff line change
Expand Up @@ -910,5 +910,20 @@ public enum Move : ushort
MatchaGotcha,
SyrupBomb,
IvyCudgel,
ElectroShot,
TeraStarstorm,
FickleBeam,
BurningBulwark,
Thunderclap,
MightyCleave,
TachyonCutter,
HardPress,
DragonCheer,
AlluringVoice,
TemperFlare,
SupercellSlam,
PsychicNoise,
UpperHand,
MalignantChain,
MAX_COUNT,
}
8 changes: 8 additions & 0 deletions PKHeX.Core/Game/Enums/Species.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,5 +1023,13 @@ public enum Species : ushort
Munkidori,
Fezandipiti,
Ogerpon,
Archaludon,
Hydrapple,
GougingFire,
RagingBolt,
IronBoulder,
IronCrown,
Terapagos,
Pecharunt,
MAX_COUNT,
}
3 changes: 3 additions & 0 deletions PKHeX.Core/Game/GameStrings/GameStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,9 @@ private void SanitizeMetGen9(LocationSet6 set)
m[164] += " (1)"; // Kitakami Wilds
m[167] += " (2)"; // Kitakami Wilds

m[196] += " (1)"; // Area Zero Underdepths
m[198] += " (2)"; // Area Zero Underdepths

set.Met3[1] += $" ({NPC})"; // Anything from an NPC
set.Met3[2] += $" ({EggName})"; // Egg From Link Trade
for (int i = 3; i <= 6; i++) // distinguish first set of regions (unused) from second (used)
Expand Down
4 changes: 2 additions & 2 deletions PKHeX.Core/Game/Locations/Locations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public static bool IsEggLocationBred4(int loc, GameVersion ver)
public static bool IsMetLocation7SM(ushort z) => z < 200; // Outer Cape
public static bool IsMetLocation7USUM(ushort z) => z < 234; // Dividing Peak Tunnel
public static bool IsMetLocation7GG(ushort z) => z <= 54; // Pokémon League
public static bool IsMetLocation8SWSH(ushort z) => z <= 246; // at the Crown Tundra Station
public static bool IsMetLocation8SWSH(ushort z) => z <= 246; // Crown Tundra Station
public static bool IsMetLocation8BDSP(ushort z) => z <= 657; // Ramanas Park (Genome Room)
public static bool IsMetLocation8LA(ushort z) => z <= 155; // Training Grounds
public static bool IsMetLocation9SV(ushort z) => z <= 131; // Uva Academy
public static bool IsMetLocation9SV(ushort z) => z <= 200; // Terarium (Entry Tunnel)
}
17 changes: 15 additions & 2 deletions PKHeX.Core/Game/Locations/Locations9.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@ internal static class Locations9
/// <summary>
/// Checks if the location is accessible in Paldea (without DLC).
/// </summary>
public static bool IsAccessiblePreDLC(ushort location) => !IsKitakami(location);
public static bool IsAccessiblePreDLC(ushort location) => location <= 131;

/// <summary>
/// Checks if the location is accessible in Kitakami.
/// </summary>
public static bool IsKitakami(ushort location) => location is (>= 132 and <= 170);

/// <summary>
/// Checks if the location is accessible in Blueberry Academy.
/// </summary>
public static bool IsBlueberry(ushort location) => location is (>= 172 and <= 194);

/// <summary>
/// Checks if the location is accessible in Blueberry Academy.
/// </summary>
public static bool IsPaldeaDLC(ushort location) => location is 196 or 198; // Area Zero Underdepths

public static ReadOnlySpan<byte> Met0 =>
[
002, 004, 006, 008,
Expand All @@ -36,7 +46,10 @@ internal static class Locations9
130, 131, 132, 134, 136, 138,
140, 142, 144, 146, 148, 150,
152, 154, 156, 158, 160, 162,
164, 166, 168, 170,
164, 166, 168, 170, 172, 174,
176, 178, 180, 182, 184, 186,
188, 190, 192, 194, 196, 198,
200,
];

public static ReadOnlySpan<ushort> Met3 =>
Expand Down
2 changes: 1 addition & 1 deletion PKHeX.Core/Items/HeldItemLumpImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static class HeldItemLumpUtil
9 when item is (>= 0328 and <= 0419) // TM01-TM92
or (>= 0618 and <= 0620) // TM093-TM095
or (>= 0690 and <= 0693) // TM096-TM099
or (>= 2160 and <= 2261) /* TM100-TM201 */ => HeldItemLumpImage.TechnicalMachine,
or (>= 2160 and <= 2289) /* TM100-TM229 */ => HeldItemLumpImage.TechnicalMachine,
_ => HeldItemLumpImage.NotLump,
};
}
71 changes: 38 additions & 33 deletions PKHeX.Core/Items/ItemStorage9SV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,29 @@ public sealed class ItemStorage9SV : IItemStorage
0045, 0046, 0047, 0048, 0049, 0050, 0051, 0052, 0053, 0080,
0081, 0082, 0083, 0084, 0085, 0107, 0108, 0109, 0110, 0111,
0112, 0135, 0136, 0213, 0214, 0217, 0218, 0219, 0220, 0221,
0222, 0223, 0224, 0228, 0229, 0230, 0231, 0232, 0233, 0234,
0236, 0237, 0238, 0239, 0240, 0241, 0242, 0243, 0244, 0245,
0246, 0247, 0248, 0249, 0250, 0251, 0253, 0265, 0266, 0267,
0268, 0269, 0270, 0271, 0272, 0273, 0275, 0276, 0277, 0278,
0279, 0280, 0281, 0282, 0283, 0284, 0285, 0286, 0287, 0288,
0289, 0290, 0291, 0292, 0293, 0294, 0295, 0296, 0297, 0298,
0299, 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307, 0308,
0309, 0310, 0311, 0312, 0313, 0325, 0326, 0327, 0485, 0486,
0487, 0488, 0489, 0490, 0491, 0537, 0538, 0539, 0540, 0541,
0542, 0543, 0544, 0545, 0546, 0547, 0564, 0565, 0566, 0567,
0568, 0569, 0570, 0639, 0640, 0644, 0645, 0648, 0649, 0650,
0795, 0796, 0846, 0849, 0853, 0854, 0855, 0856, 0879, 0880,
0881, 0882, 0883, 0884, 1103, 1104, 1116, 1117, 1118, 1119,
1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1231,
1232, 1233, 1234, 1235, 1236, 1237, 1238, 1239, 1240, 1241,
1242, 1243, 1244, 1245, 1246, 1247, 1248, 1249, 1250, 1251,
1253, 1254, 1582, 1592, 1606, 1777, 1778, 1779, 1861, 1862,
1863, 1864, 1865, 1866, 1867, 1868, 1869, 1870, 1871, 1872,
1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1882,
1883, 1884, 1885, 1886, 2344, 2345, 2401, 2402, 2403, 2404,
2406, 2407, 2408, 2411, 2412, 2413, 2414, 2415, 2416, 2479,
0222, 0223, 0224, 0225, 0228, 0229, 0230, 0231, 0232, 0233,
0234, 0235, 0236, 0237, 0238, 0239, 0240, 0241, 0242, 0243,
0244, 0245, 0246, 0247, 0248, 0249, 0250, 0251, 0252, 0253,
0265, 0266, 0267, 0268, 0269, 0270, 0271, 0272, 0273, 0275,
0276, 0277, 0278, 0279, 0280, 0281, 0282, 0283, 0284, 0285,
0286, 0287, 0288, 0289, 0290, 0291, 0292, 0293, 0294, 0295,
0296, 0297, 0298, 0299, 0300, 0301, 0302, 0303, 0304, 0305,
0306, 0307, 0308, 0309, 0310, 0311, 0312, 0313, 0321, 0322,
0323, 0324, 0325, 0326, 0327, 0485, 0486, 0487, 0488, 0489,
0490, 0491, 0537, 0538, 0539, 0540, 0541, 0542, 0543, 0544,
0545, 0546, 0547, 0564, 0565, 0566, 0567, 0568, 0569, 0570,
0639, 0640, 0644, 0645, 0648, 0649, 0650, 0795, 0796, 0846,
0849, 0853, 0854, 0855, 0856, 0879, 0880, 0881, 0882, 0883,
0884, 1103, 1104, 1109, 1110, 1111, 1112, 1113, 1114, 1115,
1116, 1117, 1118, 1119, 1120, 1121, 1122, 1123, 1124, 1125,
1126, 1127, 1128, 1231, 1232, 1233, 1234, 1235, 1236, 1237,
1238, 1239, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1247,
1248, 1249, 1250, 1251, 1253, 1254, 1581, 1582, 1592, 1606,
1777, 1778, 1779, 1861, 1862, 1863, 1864, 1865, 1866, 1867,
1868, 1869, 1870, 1871, 1872, 1873, 1874, 1875, 1876, 1877,
1878, 1879, 1880, 1881, 1882, 1883, 1884, 1885, 1886, 2344,
2345, 2401, 2402, 2403, 2404, 2406, 2407, 2408, 2411, 2412,
2413, 2414, 2415, 2416, 2479, 2482, 2549,
];

private static ReadOnlySpan<ushort> Pouch_TM_SV =>
Expand All @@ -85,7 +87,9 @@ public sealed class ItemStorage9SV : IItemStorage
2230, 2231, 2232, 2233, 2234, 2235, 2236, 2237, 2238, 2239,
2240, 2241, 2242, 2243, 2244, 2245, 2246, 2247, 2248, 2249,
2250, 2251, 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259,
2260, 2261,
2260, 2261, 2262, 2263, 2264, 2265, 2266, 2267, 2268, 2269,
2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, 2278, 2279,
2280, 2281, 2282, 2283, 2284, 2285, 2286, 2287, 2288, 2289,
];

private static ReadOnlySpan<ushort> Pouch_Treasure_SV =>
Expand All @@ -112,14 +116,18 @@ public sealed class ItemStorage9SV : IItemStorage
2389, 2390, 2391, 2392, 2393, 2394, 2395, 2396, 2397, 2398,
2399, 2400, 2417, 2418, 2419, 2420, 2421, 2422, 2423, 2424,
2425, 2426, 2427, 2428, 2429, 2430, 2431, 2432, 2433, 2434,
2435, 2436, 2437,
2435, 2436, 2437, 2548, 2551, 2552,
];

private static ReadOnlySpan<ushort> Pouch_Event_SV =>
[
0078, 0466, 0631, 0632, 0638, 0703, 0765, 1267, 1278, 1587,
1589, 1590, 1591, 1829, 1830, 1831, 1832, 1833, 1834, 1835,
1836, 1857, 1858, 2405, 2409, 2410, 2480, 2481,
0078, 0466, 0628, 0629, 0631, 0632, 0638, 0703, 0765, 0943,
0944, 0945, 0946, 1267, 1278, 1587, 1589, 1590, 1591, 1829,
1830, 1831, 1832, 1833, 1834, 1835, 1836, 1857, 1858, 2405,
2409, 2410, 2480, 2481, 2483, 2522, 2523, 2524, 2525, 2526,
2527, 2528, 2529, 2530, 2531, 2532, 2533, 2534, 2535, 2536,
2537, 2538, 2539, 2540, 2541, 2542, 2543, 2544, 2545, 2546,
2547, 2550, 2553, 2554, 2555, 2556, 2557,
];

private static ReadOnlySpan<ushort> Pouch_Material_SV =>
Expand All @@ -146,7 +154,10 @@ public sealed class ItemStorage9SV : IItemStorage
2447, 2448, 2449, 2450, 2451, 2452, 2453, 2454, 2455, 2456,
2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466,
2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476,
2477, 2478,
2477, 2478, 2484, 2485, 2486, 2487, 2488, 2489, 2490, 2491,
2492, 2493, 2494, 2495, 2496, 2497, 2498, 2499, 2500, 2501,
2502, 2503, 2504, 2505, 2506, 2507, 2508, 2509, 2510, 2511,
2512, 2513, 2514, 2515, 2516, 2517, 2518, 2519, 2520, 2521,
];

internal static ReadOnlySpan<InventoryType> ValidTypes =>
Expand All @@ -166,10 +177,8 @@ public sealed class ItemStorage9SV : IItemStorage
InventoryType.Treasure,
];
// [AUCTION] Porto Marinada specialty auctioneer, locked behind HOME in 2023.
public static ReadOnlySpan<ushort> Unreleased =>
[
0005, // Safari Ball
0016, // Cherish Ball
0111, // Odd Keystone
Expand All @@ -182,16 +191,12 @@ public sealed class ItemStorage9SV : IItemStorage
0490, // White Apricorn
0491, // Black Apricorn
0499, // Sport Ball
0500, // Park Ball
0708, // Lumiose Galette
0709, // Shalour Sable
1230, // TM00 - Mega Punch (Nothing learns, not obtainable even though it is assigned a move.)
1582, // Galarica Cuff
1592, // Galarica Wreath
1785, // Strange Ball
];

Expand Down
1 change: 1 addition & 0 deletions PKHeX.Core/Legality/Breeding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ public static bool CanHatchAsEgg(ushort species, byte form, EntityContext contex
(int)Koraidon or (int)Miraidon => false,
(int)WalkingWake or (int)IronLeaves => false,
(int)Okidogi or (int)Munkidori or (int)Fezandipiti or (int)Ogerpon => false,
(int)GougingFire or (int)RagingBolt or (int)IronBoulder or (int)IronCrown or (int)Terapagos or (int)Pecharunt => false,

_ => true,
};
Expand Down
13 changes: 9 additions & 4 deletions PKHeX.Core/Legality/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ public static class Legal
//internal const int MaxGameID_8b = (int)GameVersion.SP;
internal const int MaxAbilityID_8b = MaxAbilityID_8_R2;

internal const int MaxSpeciesID_9 = MaxSpeciesID_9_T1;
internal const int MaxMoveID_9 = MaxMoveID_9_T1;
internal const int MaxItemID_9 = MaxItemID_9_T1;
internal const int MaxAbilityID_9 = MaxAbilityID_9_T1;
internal const int MaxSpeciesID_9 = MaxSpeciesID_9_T2;
internal const int MaxMoveID_9 = MaxMoveID_9_T2;
internal const int MaxItemID_9 = MaxItemID_9_T2;
internal const int MaxAbilityID_9 = MaxAbilityID_9_T2;

internal const int MaxSpeciesID_9_T0 = (int)Species.IronLeaves;
internal const int MaxMoveID_9_T0 = (int)Move.MagicalTorque;
Expand All @@ -129,6 +129,11 @@ public static class Legal
internal const int MaxItemID_9_T1 = 2481; // Glimmering Charm
internal const int MaxAbilityID_9_T1 = (int)Ability.SupersweetSyrup;

internal const int MaxSpeciesID_9_T2 = (int)Species.Pecharunt;
internal const int MaxMoveID_9_T2 = (int)Move.MalignantChain;
internal const int MaxItemID_9_T2 = 2557; // Briar’s Book
internal const int MaxAbilityID_9_T2 = (int)Ability.PoisonPuppeteer;

internal const int MaxBallID_9 = (int)Ball.LAOrigin;
internal const int MaxGameID_9 = (int)GameVersion.VL;
internal const int MaxGameID_HOME = MaxGameID_9;
Expand Down
Loading

0 comments on commit 01c82e4

Please sign in to comment.