mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Allow HM moves in gen2-4 eggs
Yay silly inheritance ty atrius
This commit is contained in:
parent
7434af48bf
commit
c65fda5e7d
6 changed files with 23 additions and 5 deletions
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 =
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue