mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-07 23:08:47 -05:00
Allow US/UM new moves in Relearn for S/M
This commit is contained in:
@@ -14,6 +14,7 @@ public FilteredGameDataSource(SaveFile sav, GameDataSource source, bool HaX = fa
|
||||
Source = source;
|
||||
Species = GetFilteredSpecies(sav, source, HaX).ToList();
|
||||
Moves = GetFilteredMoves(sav, source, HaX).ToList();
|
||||
Relearn = GetFilteredMoves(sav.BlankPKM, source, HaX).ToList(); // allow for US/UM relearn move limits on S/M
|
||||
if (sav.Generation > 1)
|
||||
{
|
||||
var items = Source.GetItemDataSource(sav.Version, sav.Context, sav.HeldItems, HaX);
|
||||
@@ -74,22 +75,23 @@ static IEnumerable<ComboItem> FilterAbove(IReadOnlyList<ComboItem> species, int
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<ComboItem> GetFilteredMoves(IGameValueLimit sav, GameDataSource source, bool HaX = false)
|
||||
private static IEnumerable<ComboItem> GetFilteredMoves(IGameValueLimit limit, GameDataSource source, bool HaX = false)
|
||||
{
|
||||
if (HaX)
|
||||
return source.HaXMoveDataSource.Where(m => m.Value <= sav.MaxMoveID);
|
||||
return source.HaXMoveDataSource.Where(m => m.Value <= limit.MaxMoveID);
|
||||
|
||||
var legal = source.LegalMoveDataSource;
|
||||
return sav switch
|
||||
return limit switch
|
||||
{
|
||||
SAV7b => legal.Where(s => MoveInfo7b.IsAllowedMoveGG((ushort)s.Value)), // LGPE: Not all moves are available
|
||||
_ => legal.Where(m => m.Value <= sav.MaxMoveID),
|
||||
SAV7b or PB7 => legal.Where(s => MoveInfo7b.IsAllowedMoveGG((ushort)s.Value)), // LGPE: Not all moves are available
|
||||
_ => legal.Where(m => m.Value <= limit.MaxMoveID),
|
||||
};
|
||||
}
|
||||
|
||||
public readonly GameDataSource Source;
|
||||
|
||||
public readonly IReadOnlyList<ComboItem> Moves;
|
||||
public readonly IReadOnlyList<ComboItem> Relearn;
|
||||
public readonly IReadOnlyList<ComboItem> Balls;
|
||||
public readonly IReadOnlyList<ComboItem> Games;
|
||||
public readonly IReadOnlyList<ComboItem> Items;
|
||||
|
||||
@@ -2193,7 +2193,7 @@ private void PopulateFilteredDataSources(ITrainerInfo sav, bool force = false)
|
||||
// Set the Move ComboBoxes too..
|
||||
LegalMoveSource.ChangeMoveSource(source.Moves);
|
||||
foreach (var cb in Relearn)
|
||||
SetIfDifferentCount(source.Moves, cb, force);
|
||||
SetIfDifferentCount(source.Relearn, cb, force);
|
||||
foreach (var cb in Moves)
|
||||
SetIfDifferentCount(source.Moves, cb.CB_Move, force);
|
||||
if (sav is SAV8LA)
|
||||
|
||||
Reference in New Issue
Block a user