Simplify gen 4 tm and hm

This commit is contained in:
javierhimura
2017-03-20 19:10:50 +01:00
parent 90b93514d1
commit 5d9c0f006a
2 changed files with 20 additions and 15 deletions

View File

@@ -2079,9 +2079,22 @@ private static IEnumerable<int> getMoves(PKM pkm, int species, int lvl, int form
if (Machine)
{
var pi_hgss = PersonalTable.HGSS[index];
r.AddRange(TMHM_HGSS.Where((t, m) => pi_hgss.TMHM[m]));
var pi_dppt = PersonalTable.Pt[index];
r.AddRange(TMHM_DPPt.Where((t, m) => pi_dppt.TMHM[m]));
r.AddRange(TM_4.Where((t, m) => pi_hgss.TMHM[m]));
if (pkm.Format > 4)
{
// The combination of both these moves is illegal, it should be checked that the pokemon only learn one
// except if it can learn any of these moves in gen 5 or later
if (pi_hgss.TMHM[96])
r.Add(250); // Whirlpool
if (pi_dppt.TMHM[96])
r.Add(432); // Defog
}
else
{
r.AddRange(HM_DPPt.Where((t, m) => pi_dppt.TMHM[m + 92]));
r.AddRange(HM_HGSS.Where((t, m) => pi_hgss.TMHM[m + 92]));
}
}
if (moveTutor)
r.AddRange(getTutorMoves(pkm, species, form, specialTutors, Generation));

View File

@@ -106,7 +106,7 @@ public static partial class Legal
internal static readonly ushort[] HeldItems_HGSS = new ushort[1].Concat(Pouch_Items_HGSS).Concat(Pouch_Mail_HGSS).Concat(Pouch_Medicine_HGSS).Concat(Pouch_Berries_HGSS).Concat(Pouch_Ball_Pt).Concat(Pouch_TMHM_HGSS.Take(Pouch_TMHM_HGSS.Length - 8)).ToArray();
#endregion
internal static readonly int[] TMHM_HGSS =
internal static readonly int[] TM_4 =
{
264, 337, 352, 347, 046, 092, 258, 339, 331, 237,
241, 269, 058, 059, 063, 113, 182, 240, 202, 219,
@@ -118,23 +118,15 @@ public static partial class Legal
444, 419, 086, 360, 014, 446, 244, 445, 399, 157,
404, 214, 363, 398, 138, 447, 207, 365, 369, 164,
430, 433,
};
internal static readonly int[] HM_HGSS =
{
015, 019, 057, 070, 250, 249, 127, 431 // Defog(DPPt) & Whirlpool(HGSS)
};
internal static readonly int[] TMHM_DPPt =
internal static readonly int[] HM_DPPt =
{
264, 337, 352, 347, 046, 092, 258, 339, 331, 237,
241, 269, 058, 059, 063, 113, 182, 240, 202, 219,
218, 076, 231, 085, 087, 089, 216, 091, 094, 247,
280, 104, 115, 351, 053, 188, 201, 126, 317, 332,
259, 263, 290, 156, 213, 168, 211, 285, 289, 315,
355, 411, 412, 206, 362, 374, 451, 203, 406, 409,
261, 318, 373, 153, 421, 371, 278, 416, 397, 148,
444, 419, 086, 360, 014, 446, 244, 445, 399, 157,
404, 214, 363, 398, 138, 447, 207, 365, 369, 164,
430, 433,
015, 019, 057, 070, 432, 249, 127, 431 // Defog(DPPt) & Whirlpool(HGSS)
};