mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-25 22:45:07 -05:00
Hide Generation/Game setters behind mutation method
This commit is contained in:
@@ -17,8 +17,7 @@ internal static IEnumerable<IEncounterable> GetEncounters12(PKM pkm, LegalInfo i
|
||||
{
|
||||
foreach (var z in GenerateFilteredEncounters12(pkm))
|
||||
{
|
||||
info.Generation = z.Generation;
|
||||
info.Game = z.Version;
|
||||
info.StoreMetadata(z.Version, z.Generation);
|
||||
yield return z;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,10 +11,10 @@ public sealed class LegalInfo : IGeneration
|
||||
private readonly PKM pkm;
|
||||
|
||||
/// <summary>The generation of games the <see cref="PKM"/> originated from.</summary>
|
||||
public int Generation { get; internal set; }
|
||||
public int Generation { get; private set; }
|
||||
|
||||
/// <summary>The Game the <see cref="PKM"/> originated from.</summary>
|
||||
public GameVersion Game { get; internal set; }
|
||||
public GameVersion Game { get; private set; }
|
||||
|
||||
/// <summary>The matched Encounter details for the <see cref="PKM"/>. </summary>
|
||||
public IEncounterable EncounterMatch
|
||||
@@ -78,10 +78,15 @@ public LegalInfo(PKM pk, List<CheckResult> parse)
|
||||
{
|
||||
pkm = pk;
|
||||
Parse = parse;
|
||||
StoreMetadata((GameVersion)pk.Version, pkm.Generation);
|
||||
}
|
||||
|
||||
// Store repeatedly accessed values
|
||||
Game = (GameVersion)pkm.Version;
|
||||
Generation = pkm.Generation;
|
||||
internal void StoreMetadata(GameVersion game, int gen)
|
||||
{
|
||||
// We can call this method at the start for any Gen3+ encounter iteration.
|
||||
// We need to call this for each Gen1/2 encounter as Version is not stored for those origins.
|
||||
Game = game;
|
||||
Generation = gen;
|
||||
}
|
||||
|
||||
/// <summary>List of all near-matches that were rejected for a given reason.</summary>
|
||||
|
||||
Reference in New Issue
Block a user