Yield specific static encounters for rby/gsc for moveset gen

This commit is contained in:
Kurt
2021-02-02 20:25:59 -08:00
parent fa09c6bc25
commit cd286d6923
2 changed files with 11 additions and 4 deletions

View File

@@ -206,7 +206,7 @@ private static IEnumerable<IEncounterable> GetPossibleOfType(PKM pk, IReadOnlyLi
{
EncounterOrder.Egg => GetEggs(pk, needs, chain, version),
EncounterOrder.Mystery => GetGifts(pk, needs, chain),
EncounterOrder.Static => GetStatic(pk, needs, chain),
EncounterOrder.Static => GetStatic(pk, needs, chain, version),
EncounterOrder.Trade => GetTrades(pk, needs, chain, version),
EncounterOrder.Slot => GetSlots(pk, needs, chain, version),
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
@@ -281,10 +281,11 @@ private static IEnumerable<MysteryGift> GetGifts(PKM pk, IReadOnlyCollection<int
/// <param name="pk">Rough Pokémon data which contains the requested species, gender, and form.</param>
/// <param name="needs">Moves which cannot be taught by the player.</param>
/// <param name="chain">Origin possible evolution chain</param>
/// <param name="version">Specific version to iterate for.</param>
/// <returns>A consumable <see cref="IEncounterable"/> list of possible encounters.</returns>
private static IEnumerable<EncounterStatic> GetStatic(PKM pk, IReadOnlyCollection<int> needs, IReadOnlyList<EvoCriteria> chain)
private static IEnumerable<EncounterStatic> GetStatic(PKM pk, IReadOnlyCollection<int> needs, IReadOnlyList<EvoCriteria> chain, GameVersion version)
{
var encounters = EncounterStaticGenerator.GetPossible(pk, chain);
var encounters = EncounterStaticGenerator.GetPossible(pk, chain, version);
int gen = pk.Generation;
if ((uint)gen <= 2)
encounters = encounters.Concat(EncounterStaticGenerator.GetPossibleGBGifts(pk, chain, gen == 2 ? GameVersion.C : GameVersion.RBY));

View File

@@ -25,7 +25,13 @@ public static IEnumerable<EncounterStatic> GetPossible(PKM pkm, IReadOnlyList<De
if (gameSource == Any)
gameSource = (GameVersion)pkm.Version;
var table = GetEncounterStaticTable(pkm, gameSource);
var table = gameSource switch
{
RD or GN or BU or YW => StaticRBY.Where(z => z.Version.Contains(gameSource)),
GD or SV => StaticGS.Where(z => z.Version.Contains(gameSource)),
C => StaticC,
_ => GetEncounterStaticTable(pkm, gameSource),
};
return table.Where(e => chain.Any(d => d.Species == e.Species));
}