PKHeX/PKHeX.Core/Saves/Substructures/Gen9/ZA/TechnicalMachine9a.cs
Kurt 6609dd210b Misc legality fixes for Z-A alterations
- Evolving knowing move: relearnable additions in the evolved stage was bypassing the requirement (Sylveon can relearn Charm at any level, but Eevee cannot). Prune tree to only check if pre-evolutions could have learned move.
- FormArgument requiring a minimum level to actually use the move (Primeape). Probably isn't a "complete" check, since it's implemented differently compared to Qwilfish's logic. Might be worth revising in the future to be consistent (using the same as Primeape logic? if in game, and can learn, can increase from 0).
- Flag Hangry Morpeko if cannot learn Aura Wheel yet
- Flag mega evo mismatches for Tatsugiri/Magearna/Meowstic
- Permit mega meowstic gender in party

- Remap DLC TMs (I forgot this remapping was needed; pkNX dumped it but I didn't update the table until now...)
2025-12-20 14:44:08 -06:00

83 lines
5.0 KiB
C#

namespace PKHeX.Core;
public static class TechnicalMachine9a
{
public static readonly (string FieldItem, ushort ItemID, (float X, float Y, float Z) Point)[] TechnicalMachines =
[
("itb_a0102_134", 328, (-668.78064f, 0.003661115f,-786.5982f)), // TM001 t1
("itb_a0402_98", 329, (-598.0553f, 13.174822f,-287.42545f)), // TM002 t1
("itb_a0401_97", 332, (-387.8171f, 20.788715f,-299.42838f)), // TM005 t1
("itb_a0402_93", 333, (-548.05615f, 17.956745f,-309.41443f)), // TM007 t1
("itb_a0102_106", 400, (-628.5779f, 0.17770624f,-877.47003f)), // TM008 t1
("itb_a0301_104", 336, (-203.56674f, 19.54758f,-578.75195f)), // TM009 t1
("itb_a0302_107", 358, (-242.89536f, 2.5021734f,-288.7877f)), // TM010 t1
("itb_a0201_04", 371, (-413.6917f, -0.63286465f,-812.2086f)), // TM013 t1
("itb_a0301_72", 692, (-126.87326f, 21.763037f,-591.8911f)), // TM018 t1
("itb_a0102_132", 348, (-589.59576f, 14.404035f,-846.56836f)), // TM019 t1
("itb_a0403_01", 367, (-474.7154f, 26.323023f,-262.3075f)), // TM022 t1
("itd_d02_09", 354, (-0.22722217f, -0.14778668f,-227.65642f)),// TM025 t3
("itb_a0201_84", 380, (-390.05823f, 14.896092f,-893.6906f)), // TM026 t1
("itb_a0103_02", 397, (-645.02545f, -0.04693967f,-687.2036f)), // TM027 t1
("itb_a0102_125", 362, (-553.793f, 9.140966f,-765.46625f)), // TM033 t1
("itb_a0202_79", 386, (-139.0708f, 23.921827f,-676.4186f)), // TM034 t1
("itb_a0501_106", 2166,(-727.915f, 25.065262f,-354.03f)), // TM035 t1
("itb_a0503_01", 366, (-725.98834f, 11.949879f,-418.04816f)), // TM036 t1
("itb_a0301_103", 2160,(-78.887596f, 26.310556f,-494.585f)), // TM037 t1
("itb_a0301_19", 369, (-66.5289f, 0.1400345f,-478.4983f)), // TM039 t1
("itb_a0202_07", 370, (-404.98746f, 13.583943f,-656.57623f)), // TM040 t1
("itb_a0502_11", 390, (-905.83636f, 22.09935f,-593.2861f)), // TM041 t1
("itb_a0501_105", 342, (-745.1518f, 7.9030557f,-251.46582f)), // TM044 t1
("itb_a0102_133", 381, (-564.167f, 15.68258f,-634.10364f)), // TM049 t1
("itb_a0501_11", 383, (-805.57544f, 21.37394f,-166.47404f)), // TM052 t1
("itb_a0601_11", 385, (-476.4867f, 0.42864984f,-481.21725f)), // TM054 t1
("itb_a0201_82", 387, (-478.0298f, 18.44303f,-743.7157f)), // TM056 t1
("itb_a0201_83", 372, (-442.49258f, 17.34272f,-925.71234f)), // TM058 t1
("itb_a0101_21", 389, (-785.04614f, 19.495068f,-787.48315f)), // TM062 t1
("itb_a0502_80", 356, (-853.27094f, -0.5143876f,-569.87335f)), // TM063 t1
("itb_a0302_13", 398, (-215.81284f, 8.283916f,-191.6045f)), // TM065 t1
("itb_a0401_94", 404, (-475.05746f, 19.873632f,-47.76264f)), // TM071 t1
("itb_a0402_14", 405, (-567.85974f, 0.10609335f,-157.4825f)), // TM072 t1
("itb_a0101_108", 357, (-786.8892f, 17.097988f,-751.10626f)), // TM074 t1
("itb_a0202_105", 374, (-316.60748f, 24.58596f,-616.53375f)), // TM075 t1
("itb_a0203_03", 410, (-377.62292f, 0.18011375f,-659.8689f)), // TM076 t1
("itb_a0501_02", 384, (-820.16254f, 5.383784f,-266.6281f)), // TM079 t1
("itb_a0101_109", 414, (-848.59955f, 13.002884f,-790.4249f)), // TM080 t1
("itb_a0401_61", 396, (-388.79446f, 0.14138407f,-52.917423f)), // TM081 t1
("itb_a0502_99", 618, (-704.1312f, 21.50592f,-522.5093f)), // TM086 t1
("itb_a0402_94", 690, (-574.86664f, 22.051146f,-181.31502f)), // TM089 t1
("itd_d01_01_16", 691, (-67.99764f, 0.005415537f,52.998158f)), // TM090 t2
("itb_a0303_03", 693, (-279.5345f, 0.29320198f,-428.36847f)), // TM092 t1
("itd_d02_02_05", 2163,(-83.20368f, 3.0284998f,-90.00267f)), // TM095 t3_2
("itd_d02_13", 368, (-104.26371f, -0.1468494f,-129.4581f)), // TM098 t3
("itb_a0102_116", 415, (-592.1722f, 22.07336f,-927.0465f)), // TM103 t1
];
/// <summary>
/// Utility function to set all overworld Technical Machines to collected or uncollected state.
/// </summary>
public static int SetAllTechnicalMachines(SAV9ZA sav, bool collected = false)
{
int ctr = 0;
var field = sav.Blocks.FieldItems;
var inv = sav.Items;
var finalQuantity = collected ? 1 : 0;
foreach (var item in TechnicalMachines)
{
var hash = FnvHash.HashFnv1a_64(item.FieldItem);
var index = field.GetIndex(hash);
if (index == -1)
continue; // Shouldn't happen. All TMs should be populated in a save file, except if it's a DLC TM (not applicable).
ctr++;
if (field.GetValue(index) != collected)
field.SetValue(index, collected);
else
ctr--;
if (inv.GetItemQuantity(item.ItemID) != finalQuantity)
inv.SetItemQuantity(item.ItemID, finalQuantity);
}
return ctr;
}
}