Allow HM moves in gen2-4 eggs

Yay silly inheritance
ty atrius
This commit is contained in:
Kurt 2021-08-28 13:54:58 -07:00
parent 7434af48bf
commit c65fda5e7d
6 changed files with 23 additions and 5 deletions

View file

@ -167,6 +167,10 @@ namespace PKHeX.Core
if (tmIndex != -1 && tm[tmIndex])
possible[i] |= 1 << (int)FatherTM;
var hmIndex = Array.IndexOf(Legal.TMHM_GSC, move, 50);
if (hmIndex != -1 && tm[hmIndex + 50])
possible[i] |= 1 << (int)FatherTM;
if (version is GameVersion.C)
{
var tutorIndex = Array.IndexOf(Legal.Tutors_GSC, move);

View file

@ -145,7 +145,7 @@ namespace PKHeX.Core
var baseEgg = value.Learnset.GetBaseEggMoves(value.Level);
var tm = info.TMHM;
var tmlist = Legal.TM_3.AsSpan(0, 50);
var hmlist = Legal.HM_3.AsSpan();
var moves = value.Moves;
for (int i = 0; i < count; i++)
{
@ -163,6 +163,10 @@ namespace PKHeX.Core
var tmIndex = tmlist.IndexOf(move);
if (tmIndex != -1 && tm[tmIndex])
possible[i] |= 1 << (int)FatherTM;
var hmIndex = hmlist.IndexOf(move);
if (hmIndex != -1 && tm[hmIndex + 50])
possible[i] |= 1 << (int)FatherTM;
}
}
}

View file

@ -42,7 +42,7 @@ namespace PKHeX.Core
else
{
bool inherit = Breeding.GetCanInheritMoves(species);
MarkMovesForOrigin(value, egg, count, inherit, pi);
MarkMovesForOrigin(value, egg, count, inherit, pi, version);
valid = RecurseMovesForOrigin(value, count - 1);
}
@ -139,13 +139,14 @@ namespace PKHeX.Core
return true;
}
private static void MarkMovesForOrigin(in BreedInfo<EggSource34> value, ICollection<int> eggMoves, int count, bool inheritLevelUp, PersonalInfo info)
private static void MarkMovesForOrigin(in BreedInfo<EggSource34> value, ICollection<int> eggMoves, int count, bool inheritLevelUp, PersonalInfo info, GameVersion gameVersion)
{
var possible = value.Possible;
var learn = value.Learnset;
var baseEgg = value.Learnset.GetBaseEggMoves(value.Level);
var tm = info.TMHM;
var tmlist = Legal.TM_4.AsSpan(0, 92);
var hmlist = (gameVersion is HG or SS ? Legal.HM_HGSS : Legal.HM_DPPt).AsSpan();
var moves = value.Moves;
for (int i = 0; i < count; i++)
@ -164,6 +165,10 @@ namespace PKHeX.Core
var tmIndex = tmlist.IndexOf(move);
if (tmIndex != -1 && tm[tmIndex])
possible[i] |= 1 << (int)FatherTM;
var hmIndex = hmlist.IndexOf(move);
if (hmIndex != -1 && tm[hmIndex + 92])
possible[i] |= 1 << (int)FatherTM;
}
}
}

View file

@ -106,7 +106,7 @@ namespace PKHeX.Core
259, 263, 290, 156, 213, 168, 211, 285, 289, 315,
};
internal static readonly HashSet<int> HM_3 = new() { 15, 19, 57, 70, 148, 249, 127, 291};
internal static readonly int[] HM_3 = {15, 19, 57, 70, 148, 249, 127, 291};
internal static readonly int[] Tutor_3Mew =
{

View file

@ -319,7 +319,8 @@ namespace PKHeX.Core
int[] newMoves = pk4.Moves;
for (int i = 0; i < 4; i++)
{
if (Legal.HM_3.Contains(newMoves[i]))
var move = newMoves[i];
if (Array.IndexOf(Legal.HM_3, move) != -1)
newMoves[i] = 0;
}

View file

@ -169,6 +169,10 @@ namespace PKHeX.Core
var entry = table[i];
entry.AddTMHM(machine[i]);
entry.AddTypeTutors(tutors[i]);
// Copy to other tables
RS.Table[i].TMHM = FR.Table[i].TMHM = LG.Table[i].TMHM = entry.TMHM;
RS.Table[i].TypeTutors = FR.Table[i].TypeTutors = LG.Table[i].TypeTutors = entry.TypeTutors;
}
}