Rename EggEncounter to IsEgg

This commit is contained in:
Kurt 2024-03-25 00:39:30 -05:00
parent 024bd85cc3
commit 2b4ecee899
85 changed files with 133 additions and 136 deletions

View file

@ -11,7 +11,7 @@ public sealed class QRPK7(Memory<byte> Raw) : IEncounterInfo
public const int SIZE = 0x30;
private Span<byte> Data => Raw.Span;
public bool EggEncounter => false;
public bool IsEgg => false;
public byte LevelMin => Level;
public byte LevelMax => Level;
public byte Generation => Version.GetGeneration();

View file

@ -21,7 +21,7 @@ public sealed class DuplicateGiftChecker : IBulkAnalyzer
var dupes = combined.Where(z =>
z.Analysis.Info.Generation >= 3
&& z.Analysis.EncounterMatch is MysteryGift { EggEncounter: true } && !z.Slot.Entity.WasTradedEgg)
&& z.Analysis.EncounterMatch is MysteryGift { IsEgg: true } && !z.Slot.Entity.WasTradedEgg)
.GroupBy(z => ((MysteryGift)z.Analysis.EncounterMatch).CardTitle);
foreach (var dupe in dupes)

View file

@ -93,9 +93,9 @@ public sealed class DuplicateTrainerChecker : IBulkAnalyzer
// Gen3/4 traded eggs do not have an Egg Location, and do not update the Version upon hatch.
// These eggs can obtain another trainer's TID16/SID16/OT and be valid with a different version ID.
if (pa.EncounterMatch.EggEncounter && IsTradedEggVersionNoUpdate(pp, pa))
if (pa.EncounterMatch.IsEgg && IsTradedEggVersionNoUpdate(pp, pa))
return false; // version doesn't update on trade
if (ca.EncounterMatch.EggEncounter && IsTradedEggVersionNoUpdate(cp, ca))
if (ca.EncounterMatch.IsEgg && IsTradedEggVersionNoUpdate(cp, ca))
return false; // version doesn't update on trade
static bool IsTradedEggVersionNoUpdate(PKM pk, LegalityAnalysis la) => la.Info.Generation switch

View file

@ -21,7 +21,7 @@ internal static class Encounters2
new(155, 05, GSC) { Location = 001 }, // Cyndaquil @ New Bark Town
new(158, 05, GSC) { Location = 001 }, // Totodile @ New Bark Town
new(175, 05, GSC) { Location = 000, EggEncounter = true }, // Togepi
new(175, 05, GSC) { Location = 000, IsEgg = true }, // Togepi
new(131, 20, GSC) { Location = 010 }, // Lapras @ Union Cave
new(133, 20, GSC) { Location = 016 }, // Eevee @ Goldenrod City
@ -95,13 +95,13 @@ internal static class Encounters2
public static readonly EncounterStatic2[] StaticOddEggC =
[
new(172, 05, C) { EggEncounter = true, Moves = new((int)Move.ThunderShock,(int)Move.Charm, (int)Move.DizzyPunch)}, // Pichu
new(173, 05, C) { EggEncounter = true, Moves = new((int)Move.Pound, (int)Move.Charm, (int)Move.DizzyPunch)}, // Cleffa
new(174, 05, C) { EggEncounter = true, Moves = new((int)Move.Sing, (int)Move.Charm, (int)Move.DizzyPunch)}, // Igglybuff
new(236, 05, C) { EggEncounter = true, Moves = new((int)Move.Tackle, (int)Move.DizzyPunch)}, // Tyrogue
new(238, 05, C) { EggEncounter = true, Moves = new((int)Move.Pound, (int)Move.Lick, (int)Move.DizzyPunch)}, // Smoochum
new(239, 05, C) { EggEncounter = true, Moves = new((int)Move.QuickAttack, (int)Move.Leer, (int)Move.DizzyPunch)}, // Elekid
new(240, 05, C) { EggEncounter = true, Moves = new((int)Move.Ember, (int)Move.DizzyPunch)}, // Magby
new(172, 05, C) { IsEgg = true, Moves = new((int)Move.ThunderShock,(int)Move.Charm, (int)Move.DizzyPunch)}, // Pichu
new(173, 05, C) { IsEgg = true, Moves = new((int)Move.Pound, (int)Move.Charm, (int)Move.DizzyPunch)}, // Cleffa
new(174, 05, C) { IsEgg = true, Moves = new((int)Move.Sing, (int)Move.Charm, (int)Move.DizzyPunch)}, // Igglybuff
new(236, 05, C) { IsEgg = true, Moves = new((int)Move.Tackle, (int)Move.DizzyPunch)}, // Tyrogue
new(238, 05, C) { IsEgg = true, Moves = new((int)Move.Pound, (int)Move.Lick, (int)Move.DizzyPunch)}, // Smoochum
new(239, 05, C) { IsEgg = true, Moves = new((int)Move.QuickAttack, (int)Move.Leer, (int)Move.DizzyPunch)}, // Elekid
new(240, 05, C) { IsEgg = true, Moves = new((int)Move.Ember, (int)Move.DizzyPunch)}, // Magby
];
internal static readonly EncounterStatic2 CelebiVC = new(251, 30, C) { Location = 014 }; // Celebi @ Ilex Forest (VC)

View file

@ -42,7 +42,7 @@ internal static class Encounters3FRLG
new(129, 05, FRLG) { FixedBall = Ball.Poke, Location = 099 }, // Magikarp @ Route 4
new(131, 25, FRLG) { FixedBall = Ball.Poke, Location = 134 }, // Lapras @ Silph Co.
new(133, 25, FRLG) { FixedBall = Ball.Poke, Location = 094 }, // Eevee @ Celadon City
new(175, 05, FRLG) { FixedBall = Ball.Poke, Location = 253, EggEncounter = true, Moves = new(045,204,118) }, // Togepi Egg
new(175, 05, FRLG) { FixedBall = Ball.Poke, Location = 253, IsEgg = true, Moves = new(045,204,118) }, // Togepi Egg
// Stationary
new(143, 30, FRLG) { Location = 112 }, // Snorlax @ Route 12

View file

@ -56,7 +56,7 @@ internal static class Encounters3RSE
// Gift
new(351, 25, RSE) { FixedBall = Ball.Poke, Location = 034 }, // Castform @ Weather Institute
new(374, 05, RSE) { FixedBall = Ball.Poke, Location = 013 }, // Beldum @ Mossdeep City
new(360, 05, RSE) { FixedBall = Ball.Poke, Location = 253, EggEncounter = true }, // Wynaut Egg
new(360, 05, RSE) { FixedBall = Ball.Poke, Location = 253, IsEgg = true }, // Wynaut Egg
// Stationary
new(352, 30, RSE) { Location = 034 }, // Kecleon @ Route 119

View file

@ -196,7 +196,7 @@ public static class EncounterMovesetGenerator
private readonly record struct NeededEncounter(EntityContext Context, byte Generation, GameVersion Version)
: IEncounterTemplate
{
public bool EggEncounter => false;
public bool IsEgg => false;
public byte LevelMin => 0;
public byte LevelMax => 0;

View file

@ -12,7 +12,7 @@ public sealed record EncounterSlot7GO(int StartDate, int EndDate, ushort Species
public byte Generation => 7;
public EntityContext Context => EntityContext.Gen7b;
public Ball FixedBall => Ball.None; // GO Park can override the ball; obey capture rules for LGP/E
public bool EggEncounter => false;
public bool IsEgg => false;
public AbilityPermission Ability => AbilityPermission.Any12;
public bool IsShiny => Shiny.IsShiny();
public ushort EggLocation => 0;

View file

@ -14,7 +14,7 @@ public sealed record EncounterSlot8GO(int StartDate, int EndDate, ushort Species
public bool IsDateRestricted => true;
public bool IsShiny => Shiny.IsShiny();
public Ball FixedBall => Type.GetValidBall();
public bool EggEncounter => false;
public bool IsEgg => false;
public AbilityPermission Ability => AbilityPermission.Any12;
public ushort EggLocation => 0;
public GameVersion Version => GameVersion.GO;

View file

@ -14,7 +14,7 @@ public sealed record EncounterGift1 : IEncounterable, IEncounterMatch, IEncounte
public byte Generation => 1;
public EntityContext Context => EntityContext.Gen1;
public bool EggEncounter => false;
public bool IsEgg => false;
public ushort EggLocation => 0;
public Ball FixedBall => Ball.Poke;
public AbilityPermission Ability => AbilityPermission.OnlyHidden;

View file

@ -8,7 +8,7 @@ public sealed record EncounterSlot1(EncounterArea1 Parent, ushort Species, byte
{
public byte Generation => 1;
public EntityContext Context => EntityContext.Gen1;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public AbilityPermission Ability => TransporterLogic.IsHiddenDisallowedVC1(Species) ? AbilityPermission.OnlyFirst : AbilityPermission.OnlyHidden;
public Shiny Shiny => Shiny.Random;

View file

@ -8,7 +8,7 @@ public sealed record EncounterStatic1(ushort Species, byte Level, GameVersion Ve
{
public byte Generation => 1;
public EntityContext Context => EntityContext.Gen1;
public bool EggEncounter => false;
public bool IsEgg => false;
public ushort EggLocation => 0;
public Ball FixedBall => Ball.Poke;
public AbilityPermission Ability => AbilityPermission.OnlyHidden;

View file

@ -13,7 +13,7 @@ public sealed record EncounterTrade1 : IEncounterable, IEncounterMatch, IFixedTr
{
public byte Generation => 1;
public EntityContext Context => EntityContext.Gen1;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public AbilityPermission Ability => Species == (ushort)Core.Species.Haunter ? AbilityPermission.OnlyFirst : AbilityPermission.OnlyHidden;
public Shiny Shiny => Shiny.Random;

View file

@ -20,7 +20,7 @@ public sealed record EncounterGift2
public ushort EggLocation => 0;
public bool IsShiny => Shiny == Shiny.Always;
public AbilityPermission Ability => AbilityPermission.OnlyHidden;
public bool EggEncounter => EggCycles != 0;
public bool IsEgg => EggCycles != 0;
public Moveset Moves { get; }
public IndividualValueSet IVs => default; // future?
@ -127,7 +127,7 @@ public sealed record EncounterGift2
},
};
if (EggEncounter)
if (IsEgg)
{
// Fake as hatched on G/S.
}
@ -206,7 +206,7 @@ public sealed record EncounterGift2
if (!IsShinyValid(pk))
return false;
if (EggEncounter && !pk.IsEgg)
if (IsEgg && !pk.IsEgg)
return true;
// Check OT Details
@ -260,7 +260,7 @@ public sealed record EncounterGift2
if (pk.IsEgg)
{
if (!EggEncounter)
if (!IsEgg)
return false;
if (c2.MetLocation != 0 && c2.MetLevel != 0)
return false;
@ -287,7 +287,7 @@ public sealed record EncounterGift2
private bool IsMatchLocation(PKM pk)
{
if (EggEncounter)
if (IsEgg)
return true;
if (pk is not ICaughtData2 c2)
return true;
@ -314,7 +314,7 @@ public sealed record EncounterGift2
if (evo.LevelMax < Level)
return false;
if (pk is ICaughtData2 { CaughtData: not 0 })
return pk.MetLevel == (EggEncounter ? 1 : Level);
return pk.MetLevel == (IsEgg ? 1 : Level);
return true;
}

View file

@ -14,7 +14,7 @@ public sealed record EncounterSlot2(EncounterArea2 Parent, ushort Species, byte
{
public byte Generation => 2;
public EntityContext Context => EntityContext.Gen2;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public AbilityPermission Ability => TransporterLogic.IsHiddenDisallowedVC2(Species) ? AbilityPermission.OnlyFirst : AbilityPermission.OnlyHidden;
public Shiny Shiny => Shiny.Random;

View file

@ -10,7 +10,7 @@ public sealed record EncounterStatic2(ushort Species, byte Level, GameVersion Ve
public EntityContext Context => EntityContext.Gen2;
public byte Form => 0;
public byte EggCycles => DizzyPunchEgg ? (byte)20 : (byte)0;
public bool DizzyPunchEgg => EggEncounter && Moves.HasMoves;
public bool DizzyPunchEgg => IsEgg && Moves.HasMoves;
public Ball FixedBall => Ball.Poke;
ushort ILocation.Location => Location;
@ -24,7 +24,7 @@ public sealed record EncounterStatic2(ushort Species, byte Level, GameVersion Ve
public byte Gender { get; init; } = FixedGenderUtil.GenderRandom;
public IndividualValueSet IVs { get; init; }
public Moveset Moves { get; init; }
public bool EggEncounter { get; init; }
public bool IsEgg { get; init; }
public string Name => "Static Encounter";
public string LongName => Name;
@ -55,7 +55,7 @@ public sealed record EncounterStatic2(ushort Species, byte Level, GameVersion Ve
Nickname = SpeciesName.GetSpeciesNameGeneration(Species, lang, Generation),
};
if (EggEncounter)
if (IsEgg)
{
if (DizzyPunchEgg) // Fixed EXP value instead of exactly Level 5
pk.EXP = 125;
@ -92,7 +92,7 @@ public sealed record EncounterStatic2(ushort Species, byte Level, GameVersion Ve
{
if (Shiny == Shiny.Always && !pk.IsShiny)
return false;
if (EggEncounter && Moves.HasMoves) // Odd Egg
if (IsEgg && Moves.HasMoves) // Odd Egg
{
if (pk.Format > 2)
return false; // Can't be transferred to Gen7+
@ -150,7 +150,7 @@ public sealed record EncounterStatic2(ushort Species, byte Level, GameVersion Ve
if (pk.IsEgg)
{
if (!EggEncounter)
if (!IsEgg)
return false;
if (c2.MetLocation != 0 && c2.MetLevel != 0)
return false;
@ -178,7 +178,7 @@ public sealed record EncounterStatic2(ushort Species, byte Level, GameVersion Ve
if (evo.LevelMax < Level)
return false;
if (pk is ICaughtData2 { CaughtData: not 0 })
return pk.MetLevel == (EggEncounter ? 1 : Level);
return pk.MetLevel == (IsEgg ? 1 : Level);
return true;
}
@ -189,7 +189,7 @@ public sealed record EncounterStatic2(ushort Species, byte Level, GameVersion Ve
private bool IsMatchLocation(PKM pk)
{
if (EggEncounter)
if (IsEgg)
return true;
if (pk is not ICaughtData2 c2)
return true;

View file

@ -12,7 +12,7 @@ public sealed record EncounterTrade2 : IEncounterable, IEncounterMatch, IFixedTr
public EntityContext Context => EntityContext.Gen2;
public ushort Location => Locations.LinkTrade2NPC;
public GameVersion Version => GameVersion.GSC;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public AbilityPermission Ability => AbilityPermission.OnlyHidden;
public Shiny Shiny => Shiny.Random;

View file

@ -15,7 +15,7 @@ public sealed record EncounterGift3Colo : IEncounterable, IEncounterMatch, IEnco
public bool IsShiny => false;
public Shiny Shiny => Shiny.Never;
public byte Form => 0;
public bool EggEncounter => false;
public bool IsEgg => false;
public AbilityPermission Ability => AbilityPermission.Any12;
public Ball FixedBall => Ball.Poke;
public bool IsFixedTrainer => true;

View file

@ -19,7 +19,7 @@ public sealed record EncounterShadow3Colo(byte ID, short Gauge, ReadOnlyMemory<T
ushort ILocation.EggLocation => 0;
ushort ILocation.Location => Location;
public bool IsShiny => false;
public bool EggEncounter => false;
public bool IsEgg => false;
public Shiny Shiny => Shiny.Random;
public AbilityPermission Ability => AbilityPermission.Any12;
public Ball FixedBall => Ball.None;

View file

@ -14,7 +14,7 @@ public sealed record EncounterStatic3Colo(ushort Species, byte Level)
public bool IsShiny => false;
public Shiny Shiny => Shiny.Never;
public byte Form => 0;
public bool EggEncounter => false;
public bool IsEgg => false;
public AbilityPermission Ability => AbilityPermission.Any12;

View file

@ -12,7 +12,7 @@ public record EncounterSlot3(EncounterArea3 Parent, ushort Species, byte Form, b
public byte Generation => 3;
ushort ILocation.Location => Location;
public EntityContext Context => EntityContext.Gen3;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => GetRequiredBall();
public byte AreaRate => Parent.Rate;

View file

@ -22,7 +22,7 @@ public sealed record EncounterStatic3(ushort Species, byte Level, GameVersion Ve
public required byte Location { get; init; }
public byte Form { get; init; }
public bool EggEncounter { get; init; }
public bool IsEgg { get; init; }
public Moveset Moves { get; init; }
public string Name => "Static Encounter";
@ -59,7 +59,7 @@ public sealed record EncounterStatic3(ushort Species, byte Level, GameVersion Ve
Nickname = SpeciesName.GetSpeciesNameGeneration(Species, lang, Generation),
};
if (EggEncounter)
if (IsEgg)
{
// Fake as hatched.
pk.MetLevel = EggStateLegality.EggMetLevel34;
@ -140,7 +140,7 @@ public sealed record EncounterStatic3(ushort Species, byte Level, GameVersion Ve
{
if (pk.Format != 3) // Met Level lost on PK3=>PK4
return evo.LevelMax >= Level;
if (!EggEncounter)
if (!IsEgg)
return pk.MetLevel == Level;
return pk is { MetLevel: EggStateLegality.EggMetLevel34, CurrentLevel: >= 5 }; // met level 0, origin level 5
}
@ -150,7 +150,7 @@ public sealed record EncounterStatic3(ushort Species, byte Level, GameVersion Ve
if (pk.Format != 3)
return true; // transfer location verified later
if (EggEncounter)
if (IsEgg)
return !pk.IsEgg || pk.MetLocation == Location;
var met = pk.MetLocation;

View file

@ -11,7 +11,7 @@ public sealed record EncounterTrade3 : IEncounterable, IEncounterMatch, IFixedTr
public EntityContext Context => EntityContext.Gen3;
public ushort Location => Locations.LinkTrade3NPC;
public Shiny Shiny => Shiny.FixedValue;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public bool IsShiny => false;
public ushort EggLocation => 0;

View file

@ -19,7 +19,7 @@ public sealed record EncounterShadow3XD(byte ID, short Gauge, ReadOnlyMemory<Tea
ushort ILocation.EggLocation => 0;
ushort ILocation.Location => Location;
public bool IsShiny => false;
public bool EggEncounter => false;
public bool IsEgg => false;
public Shiny Shiny => Shiny.Never; // Different from Colosseum!
public AbilityPermission Ability => AbilityPermission.Any12;
public bool FatefulEncounter => true;

View file

@ -9,7 +9,7 @@ public sealed record EncounterSlot3XD(EncounterArea3XD Parent, ushort Species, b
public byte Generation => 3;
public EntityContext Context => EntityContext.Gen3;
public bool FatefulEncounter => true;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.None;
public AbilityPermission Ability => AbilityPermission.Any12;
public Shiny Shiny => Shiny.Random;

View file

@ -21,7 +21,7 @@ public sealed record EncounterStatic3XD(ushort Species, byte Level)
public required byte Location { get; init; }
public byte Form => 0;
public bool EggEncounter => false;
public bool IsEgg => false;
public Moveset Moves { get; init; }
public string Name => "Static Encounter";

View file

@ -27,7 +27,7 @@ public sealed record EncounterTrade3XD : IEncounterable, IEncounterMatch, IEncou
public required byte Location { get; init; }
public byte Form => 0;
public bool EggEncounter => false;
public bool IsEgg => false;
public required Moveset Moves { get; init; }
public required ushort TID16 { get; init; }
// SID: Based on player ID

View file

@ -11,7 +11,7 @@ public sealed record EncounterSlot4(EncounterArea4 Parent, ushort Species, byte
public byte Generation => 4;
ushort ILocation.Location => Location;
public EntityContext Context => EntityContext.Gen4;
public bool EggEncounter => false;
public bool IsEgg => false;
public AbilityPermission Ability => AbilityPermission.Any12;
public Ball FixedBall => GetRequiredBallValue();
public Shiny Shiny => Shiny.Random;

View file

@ -14,7 +14,7 @@ public sealed record EncounterStatic4(GameVersion Version)
ushort ILocation.Location => Location;
ushort ILocation.EggLocation => EggLocation;
public bool IsShiny => false;
public bool EggEncounter => EggLocation != 0;
public bool IsEgg => EggLocation != 0;
private bool Gift => FixedBall == Ball.Poke;
public Ball FixedBall { get; init; }
@ -76,7 +76,7 @@ public sealed record EncounterStatic4(GameVersion Version)
Nickname = SpeciesName.GetSpeciesNameGeneration(Species, lang, Generation),
};
if (EggEncounter)
if (IsEgg)
{
// Fake as hatched.
pk.MetLocation = version is GameVersion.HG or GameVersion.SS ? Locations.HatchLocationHGSS : Locations.HatchLocationDPPt;
@ -176,7 +176,7 @@ public sealed record EncounterStatic4(GameVersion Version)
return true;
var met = pk4.MetLocation;
if (EggEncounter)
if (IsEgg)
return true;
if (!Roaming)
return met == Location;
@ -191,7 +191,7 @@ public sealed record EncounterStatic4(GameVersion Version)
private bool IsMatchEggLocation(PKM pk)
{
if (!EggEncounter)
if (!IsEgg)
{
var expect = pk is PB8 ? Locations.Default8bNone : EggLocation;
return pk.EggLocation == expect;
@ -239,7 +239,7 @@ public sealed record EncounterStatic4(GameVersion Version)
if (pk.Format != 4) // Met Level lost on PK4=>PK5
return Level <= evo.LevelMax;
return pk.MetLevel == (EggEncounter ? 0 : Level);
return pk.MetLevel == (IsEgg ? 0 : Level);
}
private bool IsMatchPartial(PKM pk) => Gift && pk.Ball != (byte)FixedBall;

View file

@ -15,7 +15,7 @@ public sealed record EncounterStatic4Pokewalker(PokewalkerCourse4 Course)
public ushort Location => Locations.PokeWalker4;
public bool IsShiny => false;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public AbilityPermission Ability => AbilityPermission.Any12;
public Shiny Shiny => Shiny.Never;

View file

@ -13,7 +13,7 @@ public sealed record EncounterTrade4PID
public Shiny Shiny => Shiny.FixedValue;
public bool IsFixedNickname => true;
public GameVersion Version { get; }
public bool EggEncounter => false;
public bool IsEgg => false;
public ushort EggLocation => 0;
public Ball FixedBall => Ball.Poke;
public bool IsShiny => false;

View file

@ -21,7 +21,7 @@ public sealed record EncounterTrade4RanchGift
public ushort Location { get; init; }
public Shiny Shiny => FatefulEncounter ? Shiny.Never : Shiny.FixedValue;
public GameVersion Version { get; }
public bool EggEncounter => false;
public bool IsEgg => false;
public ushort EggLocation { get; init; }
public Ball FixedBall { get; init; } = Ball.Poke;

View file

@ -8,7 +8,7 @@ public sealed record EncounterSlot5(EncounterArea5 Parent, ushort Species, byte
{
public byte Generation => 5;
public EntityContext Context => EntityContext.Gen5;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.None;
public Shiny Shiny => IsHiddenGrotto ? Shiny.Never : Shiny.Random;
public bool IsShiny => false;

View file

@ -12,7 +12,7 @@ public sealed record EncounterStatic5(GameVersion Version)
ushort ILocation.Location => Location;
ushort ILocation.EggLocation => EggLocation;
public bool IsShiny => false;
public bool EggEncounter => EggLocation != 0;
public bool IsEgg => EggLocation != 0;
private bool Gift => FixedBall == Ball.Poke;
public Ball FixedBall { get; init; }
@ -64,7 +64,7 @@ public sealed record EncounterStatic5(GameVersion Version)
Nickname = SpeciesName.GetSpeciesNameGeneration(Species, lang, Generation),
};
if (EggEncounter)
if (IsEgg)
{
// Fake as hatched.
pk.MetLocation = Locations.HatchLocation5;
@ -161,7 +161,7 @@ public sealed record EncounterStatic5(GameVersion Version)
private bool IsMatchLocation(PKM pk)
{
var met = pk.MetLocation;
if (EggEncounter)
if (IsEgg)
return true;
if (!Roaming)
return met == Location;
@ -170,7 +170,7 @@ public sealed record EncounterStatic5(GameVersion Version)
private bool IsMatchEggLocation(PKM pk)
{
if (!EggEncounter)
if (!IsEgg)
{
var expect = pk is PB8 ? Locations.Default8bNone : EggLocation;
return pk.EggLocation == expect;

View file

@ -11,7 +11,7 @@ public sealed record EncounterStatic5Entree(GameVersion Version, ushort Species,
public Ball FixedBall => Ball.None;
public Shiny Shiny => Shiny.Never;
public bool IsShiny => false;
public bool EggEncounter => false;
public bool IsEgg => false;
public ushort EggLocation => 0;
public ushort Location => 075;
public string Name => $"Entree Forest Encounter ({Version})";

View file

@ -20,7 +20,7 @@ public sealed record EncounterStatic5N(uint PID)
ushort ILocation.Location => Location;
public bool IsShiny => false;
public Shiny Shiny => Shiny.FixedValue;
public bool EggEncounter => false;
public bool IsEgg => false;
public ushort EggLocation => 0;
public Ball FixedBall => Species == (int)Core.Species.Zorua ? Ball.Poke : Ball.None; // Zorua can't be captured; others can.

View file

@ -13,7 +13,7 @@ public sealed record EncounterStatic5Radar(ushort Species, byte Form, AbilityPer
public Ball FixedBall => Ball.Dream;
public bool IsShiny => false;
public Shiny Shiny => Shiny.Never;
public bool EggEncounter => false;
public bool IsEgg => false;
public ushort EggLocation => 0;
public byte LevelMin => 5;
public byte LevelMax => 40;

View file

@ -14,7 +14,7 @@ public sealed record EncounterTrade5B2W2 : IEncounterable, IEncounterMatch, IFix
public bool IsFixedNickname { get; init; }
public GameVersion Version { get; }
public Shiny Shiny => Shiny.Never;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public bool IsShiny => false;
public ushort EggLocation => 0;

View file

@ -11,7 +11,7 @@ public sealed record EncounterTrade5BW : IEncounterable, IEncounterMatch, IFixed
public bool IsFixedNickname => true;
public GameVersion Version { get; }
public Shiny Shiny => Shiny.Never;
public bool EggEncounter => false;
public bool IsEgg => false;
public ushort EggLocation => 0;
public Ball FixedBall => Ball.Poke;
public bool IsShiny => false;

View file

@ -11,7 +11,7 @@ public sealed record EncounterSlot6AO(EncounterArea6AO Parent, ushort Species, b
{
public byte Generation => 6;
public EntityContext Context => EntityContext.Gen6;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.None;
public Shiny Shiny => Shiny.Random;
public bool IsShiny => false;

View file

@ -8,7 +8,7 @@ public sealed record EncounterSlot6XY(EncounterArea6XY Parent, ushort Species, b
{
public byte Generation => 6;
public EntityContext Context => EntityContext.Gen6;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.None;
public Shiny Shiny => Shiny.Random;
public bool IsShiny => false;

View file

@ -11,7 +11,7 @@ public sealed record EncounterStatic6(GameVersion Version)
ushort ILocation.Location => Location;
ushort ILocation.EggLocation => EggLocation;
public bool IsShiny => false;
public bool EggEncounter => EggLocation != 0;
public bool IsEgg => EggLocation != 0;
public Ball FixedBall { get; init; }
public bool FatefulEncounter { get; init; }
@ -77,7 +77,7 @@ public sealed record EncounterStatic6(GameVersion Version)
Nickname = SpeciesName.GetSpeciesNameGeneration(Species, lang, Generation),
};
if (EggEncounter)
if (IsEgg)
{
// Fake as hatched.
pk.MetLocation = version is GameVersion.X or GameVersion.Y ? Locations.HatchLocation6XY : Locations.HatchLocation6AO;
@ -169,7 +169,7 @@ public sealed record EncounterStatic6(GameVersion Version)
private bool IsMatchLocation(PKM pk)
{
if (EggEncounter)
if (IsEgg)
return true;
var met = pk.MetLocation;
if (met == Location)
@ -184,7 +184,7 @@ public sealed record EncounterStatic6(GameVersion Version)
private bool IsMatchEggLocation(PKM pk)
{
if (!EggEncounter)
if (!IsEgg)
{
var expect = pk is PB8 ? Locations.Default8bNone : EggLocation;
return pk.EggLocation == expect;

View file

@ -11,7 +11,7 @@ public sealed record EncounterTrade6 : IEncounterable, IEncounterMatch, IFixedTr
public EntityContext Context => EntityContext.Gen6;
public ushort Location => Locations.LinkTrade6NPC;
public Shiny Shiny => Shiny.Never;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public bool IsShiny => false;
public ushort EggLocation => 0;

View file

@ -8,7 +8,7 @@ public sealed record EncounterSlot7(EncounterArea7 Parent, ushort Species, byte
{
public byte Generation => 7;
public EntityContext Context => EntityContext.Gen7;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Location == Locations.Pelago7 ? Ball.Poke : Ball.None;
public Shiny Shiny => Shiny.Random;
public bool IsShiny => false;

View file

@ -12,7 +12,7 @@ public sealed record EncounterStatic7(GameVersion Version)
ushort ILocation.EggLocation => EggLocation;
public bool RibbonWishing => Species == (int)Core.Species.Magearna;
public bool EggEncounter => EggLocation != 0;
public bool IsEgg => EggLocation != 0;
public bool IsShiny => false;
public Moveset Relearn { get; init; }
@ -85,7 +85,7 @@ public sealed record EncounterStatic7(GameVersion Version)
else
pk.SetDefaultRegionOrigins(lang);
if (EggEncounter)
if (IsEgg)
{
// Fake as hatched.
pk.MetLocation = Locations.HatchLocation7;
@ -184,7 +184,7 @@ public sealed record EncounterStatic7(GameVersion Version)
private bool IsMatchLocation(PKM pk)
{
if (EggEncounter)
if (IsEgg)
return true;
return pk.MetLocation == Location;
@ -192,7 +192,7 @@ public sealed record EncounterStatic7(GameVersion Version)
private bool IsMatchEggLocation(PKM pk)
{
if (!EggEncounter)
if (!IsEgg)
{
var expect = pk is PB8 ? Locations.Default8bNone : EggLocation;
return pk.EggLocation == expect;

View file

@ -15,7 +15,7 @@ public sealed record EncounterTrade7 : IEncounterable, IEncounterMatch, IFixedTr
public byte OriginalTrainerMemoryFeeling => 5;
public ushort OriginalTrainerMemoryVariable => 40;
public Shiny Shiny => Shiny.Never;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public bool IsShiny => false;
public ushort EggLocation => 0;

View file

@ -13,7 +13,7 @@ public sealed record EncounterTransfer7(GameVersion Version, ushort Species, byt
public byte Generation => 7;
public EntityContext Context => EntityContext.Gen7;
public Ball FixedBall => Ball.Poke;
public bool EggEncounter => false;
public bool IsEgg => false;
public ushort EggLocation => 0;
public byte Form => 0;

View file

@ -8,7 +8,7 @@ public sealed record EncounterSlot7b(EncounterArea7b Parent, ushort Species, byt
{
public byte Generation => 7;
public EntityContext Context => EntityContext.Gen7b;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.None;
public Shiny Shiny => Shiny.Random;
public AbilityPermission Ability => AbilityPermission.Any12;

View file

@ -11,7 +11,7 @@ public sealed record EncounterStatic7b(GameVersion Version)
ushort ILocation.Location => Location;
public ushort EggLocation => 0;
public bool IsShiny => false;
public bool EggEncounter => false;
public bool IsEgg => false;
public required ushort Species { get; init; }
public required byte Level { get; init; }

View file

@ -11,7 +11,7 @@ public sealed record EncounterTrade7b(GameVersion Version) : IEncounterable, IEn
public EntityContext Context => EntityContext.Gen7b;
public ushort Location => Locations.LinkTrade6NPC;
public Shiny Shiny => Shiny.Random;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public bool IsShiny => false;
public ushort EggLocation => 0;

View file

@ -10,7 +10,7 @@ public sealed record EncounterSlot8(EncounterArea8 Parent, ushort Species, byte
{
public byte Generation => 8;
public EntityContext Context => EntityContext.Gen8;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.None;
public AbilityPermission Ability => AbilityPermission.Any12;
public Shiny Shiny => Shiny.Random;

View file

@ -14,7 +14,7 @@ public sealed record EncounterStatic8(GameVersion Version = GameVersion.SWSH)
ushort ILocation.Location => Location;
public bool Gift => FixedBall != Ball.None;
public bool IsShiny => Shiny == Shiny.Always;
public bool EggEncounter => false;
public bool IsEgg => false;
ushort ILocation.EggLocation => 0;
public required ushort Location { get; init; }

View file

@ -18,7 +18,7 @@ public abstract record EncounterStatic8Nest<T>(GameVersion Version)
private const ushort Location = SharedNest;
public bool IsShiny => Shiny == Shiny.Always;
public bool EggEncounter => false;
public bool IsEgg => false;
ushort ILocation.EggLocation => 0;
public Ball FixedBall => Ball.None;

View file

@ -21,7 +21,7 @@ public sealed record EncounterTrade8 : IEncounterable, IEncounterMatch, IFixedTr
public byte FlawlessIVCount { get; init; }
public Shiny Shiny { get; }
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public bool IsShiny => false;
public ushort EggLocation => 0;

View file

@ -12,7 +12,7 @@ public sealed record EncounterSlot8a(EncounterArea8a Parent, ushort Species, byt
{
public byte Generation => 8;
public EntityContext Context => EntityContext.Gen8a;
public bool EggEncounter => false;
public bool IsEgg => false;
public AbilityPermission Ability => AbilityPermission.Any12;
public Ball FixedBall => Ball.None;
public Shiny Shiny => Shiny.Random;

View file

@ -16,7 +16,7 @@ public sealed record EncounterStatic8a
public ushort EggLocation => 0;
ushort ILocation.Location => Location;
public bool IsShiny => Shiny == Shiny.Always;
public bool EggEncounter => false;
public bool IsEgg => false;
public AbilityPermission Ability => AbilityPermission.Any12;
public ushort Species { get; }

View file

@ -11,7 +11,7 @@ public sealed record EncounterSlot8b(EncounterArea8b Parent, ushort Species, byt
{
public byte Generation => 8;
public EntityContext Context => EntityContext.Gen8b;
public bool EggEncounter => false;
public bool IsEgg => false;
public Shiny Shiny => Shiny.Random;
public bool IsShiny => false;
public ushort EggLocation => 0;

View file

@ -13,7 +13,7 @@ public sealed record EncounterStatic8b(GameVersion Version)
public EntityContext Context => EntityContext.Gen8b;
ushort ILocation.EggLocation => EggLocation;
ushort ILocation.Location => Location;
public bool EggEncounter => EggLocation != None;
public bool IsEgg => EggLocation != None;
private const ushort None = Locations.Default8bNone;
public byte Form => 0;
public bool IsShiny => Shiny == Shiny.Always;
@ -84,7 +84,7 @@ public sealed record EncounterStatic8b(GameVersion Version)
Nickname = SpeciesName.GetSpeciesNameGeneration(Species, lang, Generation),
};
if (EggEncounter)
if (IsEgg)
{
// Fake as hatched.
pk.MetLocation = Locations.HatchLocation8b;
@ -149,7 +149,7 @@ public sealed record EncounterStatic8b(GameVersion Version)
private bool IsMatchLocationExact(PKM pk)
{
if (EggEncounter)
if (IsEgg)
return !pk.IsEgg || pk.MetLocation == Location || pk.MetLocation == Locations.LinkTrade6NPC;
if (!Roaming)
return pk.MetLocation == Location;
@ -159,7 +159,7 @@ public sealed record EncounterStatic8b(GameVersion Version)
private bool IsMatchEggLocationExact(PKM pk)
{
var eggLoc = pk.EggLocation;
if (!EggEncounter)
if (!IsEgg)
return eggLoc == EggLocation;
if (!pk.IsEgg) // hatched
@ -195,7 +195,7 @@ public sealed record EncounterStatic8b(GameVersion Version)
private bool IsMatchEggLocationRemapped(PKM pk)
{
if (!EggEncounter)
if (!IsEgg)
return pk.EggLocation == 0;
return LocationsHOME.IsLocationSWSHEgg(pk.Version, pk.MetLocation, pk.EggLocation, EggLocation);
}

View file

@ -11,7 +11,7 @@ public sealed record EncounterTrade8b : IEncounterable, IEncounterMatch, IFixedT
public EntityContext Context => EntityContext.Gen8b;
public ushort Location => Locations.LinkTrade6NPC;
public Shiny Shiny => Shiny.Never;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.Poke;
public bool IsShiny => false;
public ushort EggLocation => Locations.Default8bNone;

View file

@ -15,7 +15,7 @@ public sealed record EncounterDist9
public GameVersion Version => GameVersion.SV;
public bool IsDistribution => Index != 0;
public Ball FixedBall => Ball.None;
public bool EggEncounter => false;
public bool IsEgg => false;
public bool IsShiny => Shiny == Shiny.Always;
public ushort EggLocation => 0;

View file

@ -16,7 +16,7 @@ public sealed record EncounterFixed9
public EntityContext Context => EntityContext.Gen9;
public GameVersion Version => GameVersion.SV;
public Shiny Shiny => Shiny.Random;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.None;
public bool IsShiny => false;
public ushort EggLocation => 0;

View file

@ -13,7 +13,7 @@ public sealed record EncounterMight9
public GameVersion Version => GameVersion.SV;
public bool IsDistribution => Index != 0;
public Ball FixedBall => Ball.None;
public bool EggEncounter => false;
public bool IsEgg => false;
public bool IsShiny => Shiny == Shiny.Always;
public ushort EggLocation => 0;

View file

@ -15,7 +15,7 @@ public sealed record EncounterOutbreak9
public EntityContext Context => EntityContext.Gen9;
public GameVersion Version => GameVersion.SV;
public Shiny Shiny => IsShiny ? Shiny.Always : Shiny.Random;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall => Ball.None;
public ushort EggLocation => 0;
public AbilityPermission Ability => AbilityPermission.Any12;

View file

@ -10,7 +10,7 @@ public sealed record EncounterSlot9(EncounterArea9 Parent, ushort Species, byte
{
public byte Generation => 9;
public EntityContext Context => EntityContext.Gen9;
public bool EggEncounter => false;
public bool IsEgg => false;
public AbilityPermission Ability => AbilityPermission.Any12;
public Ball FixedBall => Ball.None;
public Shiny Shiny => Shiny.Random;

View file

@ -11,7 +11,7 @@ public sealed record EncounterStatic9(GameVersion Version)
public byte Generation => 9;
public EntityContext Context => EntityContext.Gen9;
public bool IsShiny => Shiny == Shiny.Always;
public bool EggEncounter => EggLocation != 0;
public bool IsEgg => EggLocation != 0;
ushort ILocation.Location => Location;
ushort ILocation.EggLocation => EggLocation;
@ -90,7 +90,7 @@ public sealed record EncounterStatic9(GameVersion Version)
ID32 = tr.ID32,
};
if (EggEncounter)
if (IsEgg)
{
// Fake as hatched.
pk.MetLocation = Locations.HatchLocation9;
@ -192,7 +192,7 @@ public sealed record EncounterStatic9(GameVersion Version)
private bool IsMatchEggLocation(PKM pk)
{
var eggLoc = pk.EggLocation;
if (!EggEncounter)
if (!IsEgg)
{
var expect = pk is PB8 ? Locations.Default8bNone : EggLocation;
return eggLoc == expect;
@ -228,7 +228,7 @@ public sealed record EncounterStatic9(GameVersion Version)
private bool IsMatchLocationExact(PKM pk)
{
if (EggEncounter)
if (IsEgg)
return true;
return pk.MetLocation == Location;
}

View file

@ -17,7 +17,7 @@ public sealed record EncounterTera9
public const ushort Location = Locations.TeraCavern9;
public bool IsDistribution => Index != 0;
public Ball FixedBall => Ball.None;
public bool EggEncounter => false;
public bool IsEgg => false;
public bool IsShiny => Shiny == Shiny.Always;
public ushort EggLocation => 0;

View file

@ -12,7 +12,7 @@ public sealed record EncounterTrade9
public EntityContext Context => EntityContext.Gen9;
public ushort Location => Locations.LinkTrade6NPC;
public Shiny Shiny { get; init; } = Shiny.Never;
public bool EggEncounter => false;
public bool IsEgg => false;
public Ball FixedBall { get; init; }
public bool IsShiny => false;
public ushort EggLocation => 0;

View file

@ -13,7 +13,7 @@ public interface IEncounterTemplate : ISpeciesForm, IVersion, IGeneration, IShin
/// <summary>
/// Indicates if the encounter originated as an egg.
/// </summary>
bool EggEncounter { get; }
bool IsEgg { get; }
}
public static partial class Extensions
@ -23,7 +23,7 @@ public static partial class Extensions
var level = pk.CurrentLevel;
if (!pk.HasOriginalMetLocation)
return encounter.IsLevelWithinRange(level);
if (encounter.EggEncounter)
if (encounter.IsEgg)
return level == encounter.LevelMin;
if (encounter is MysteryGift g)
return level == g.Level;

View file

@ -10,7 +10,7 @@ public sealed record EncounterEgg(ushort Species, byte Form, byte Level, byte Ge
public string Name => "Egg";
public string LongName => "Egg";
public bool EggEncounter => true;
public bool IsEgg => true;
public byte LevelMin => Level;
public byte LevelMax => Level;
public bool IsShiny => false;

View file

@ -13,7 +13,7 @@ public sealed record EncounterInvalid : IEncounterable
public byte Form { get; }
public byte LevelMin { get; }
public byte LevelMax { get; }
public bool EggEncounter { get; }
public bool IsEgg { get; }
public byte Generation { get; }
public EntityContext Context { get; }
public GameVersion Version { get; }
@ -35,7 +35,7 @@ public sealed record EncounterInvalid : IEncounterable
Form = pk.Form;
LevelMin = pk.MetLevel;
LevelMax = pk.CurrentLevel;
EggEncounter = pk.WasEgg;
IsEgg = pk.WasEgg;
Generation = pk.Generation;
Version = pk.Version;
Context = pk.Context;

View file

@ -27,14 +27,14 @@ public static class EncounterVerifier
EncounterStatic3 { Species: (int)Species.Deoxys, Location: 200 } when pk.Language == (int)LanguageID.Japanese => GetInvalid(LEncUnreleased),
EncounterStatic4 { Roaming: true } when pk is G4PKM { MetLocation: 193, GroundTile: GroundTileType.Water } => GetInvalid(LG4InvalidTileR45Surf),
MysteryGift g => VerifyEncounterEvent(pk, g),
{ EggEncounter: true } when !pk.IsEgg => VerifyEncounterEgg(pk, enc.Generation),
{ IsEgg: true } when !pk.IsEgg => VerifyEncounterEgg(pk, enc.Generation),
EncounterInvalid => GetInvalid(LEncInvalid),
_ => GetValid(string.Empty), // todo: refactor
};
private static CheckResult VerifyEncounterG12(PKM pk, IEncounterTemplate enc)
{
if (enc.EggEncounter)
if (enc.IsEgg)
return VerifyEncounterEgg(pk, 2);
return enc switch

View file

@ -132,7 +132,7 @@ public static class MoveListSuggest
{
if (enc is IRelearn { Relearn: { HasMoves: true } r })
r.CopyTo(moves);
else if (enc is EncounterEgg or EncounterInvalid { EggEncounter: true })
else if (enc is EncounterEgg or EncounterInvalid { IsEgg: true })
GetSuggestedRelearnEgg(enc, pk, moves);
}
@ -157,7 +157,7 @@ public static class MoveListSuggest
if (LearnVerifierRelearn.ShouldNotHaveRelearnMoves(enc, pk))
return;
if (enc is EncounterEgg or EncounterInvalid {EggEncounter: true})
if (enc is EncounterEgg or EncounterInvalid {IsEgg: true})
enc.GetSuggestedRelearnEgg(info.Moves, pk, moves);
else
enc.GetSuggestedRelearnInternal(pk, moves);

View file

@ -97,7 +97,7 @@ public sealed partial class MemoryContext8 : MemoryContext
switch (memory)
{
case 1 when !IsWildEncounter(pk, enc):
case 2 when !enc.EggEncounter:
case 2 when !enc.IsEgg:
case 3 when !IsWildEncounterMeet(pk, enc):
return true;
}

View file

@ -38,7 +38,7 @@ public static class MemoryRules
if (pk.IsUntraded)
{
// Traded eggs in SW/SH set HT memory but not HT Name.
if (enc is { Context: EntityContext.Gen8, EggEncounter: true } && pk.Context is EntityContext.Gen8)
if (enc is { Context: EntityContext.Gen8, IsEgg: true } && pk.Context is EntityContext.Gen8)
{
var loc = pk.IsEgg ? pk.MetLocation : pk.EggLocation;
if (loc == Locations.LinkTrade6)

View file

@ -344,7 +344,7 @@ public sealed class MemoryVerifier : Verifier
return;
// {0} hatched from an Egg and saw {1} for the first time at... {2}. {4} that {3}.
case 2 when !enc.EggEncounter:
case 2 when !enc.IsEgg:
data.AddLine(GetInvalid(string.Format(LMemoryArgBadHatch, L_XOT)));
break;

View file

@ -321,7 +321,7 @@ public sealed class MiscVerifier : Verifier
var time = t.MetTimeOfDay;
bool valid = data.EncounterOriginal switch
{
EncounterGift2 g2 when (!g2.EggEncounter || pk.IsEgg) => time == 0,
EncounterGift2 g2 when (!g2.IsEgg || pk.IsEgg) => time == 0,
EncounterTrade2 => time == 0,
_ => time is 1 or 2 or 3,
};

View file

@ -219,7 +219,7 @@ public sealed class NicknameVerifier : Verifier
System.Diagnostics.Debug.Assert(match is not WC8 {IsHOMEGift:true});
int length = 0;
if (origin is (4 or 5 or 6 or 7) && match.EggEncounter && pk.WasTradedEgg)
if (origin is (4 or 5 or 6 or 7) && match.IsEgg && pk.WasTradedEgg)
length = Legal.GetMaxLengthNickname(origin, English);
if (pk.FatefulEncounter)

View file

@ -67,7 +67,7 @@ public sealed class TrainerNameVerifier : Verifier
public static bool IsEdgeCaseLength(PKM pk, IEncounterTemplate e, ReadOnlySpan<char> ot)
{
if (e.EggEncounter)
if (e.IsEgg)
{
if (e is WC3 wc3 && pk.IsEgg && ot.SequenceEqual(wc3.OriginalTrainerName))
return true; // Fixed OT Mystery Gift Egg
@ -94,7 +94,7 @@ public sealed class TrainerNameVerifier : Verifier
{
// Transferring from RBY->Gen7 won't have OT Gender in PK1, nor will PK1 originated encounters.
// GSC Trades already checked for OT Gender matching.
if (pk is { Format: > 2, VC1: true } || enc is { Generation: 1 } or EncounterGift2 { EggEncounter: false })
if (pk is { Format: > 2, VC1: true } || enc is { Generation: 1 } or EncounterGift2 { IsEgg: false })
data.AddLine(GetInvalid(LG1OTGender));
}

View file

@ -164,12 +164,11 @@ public abstract class MysteryGift : IEncounterable, IMoveset, ITrainerID32, IFat
public byte LevelMin => Level;
public byte LevelMax => Level;
public abstract byte Ball { get; set; }
public virtual bool EggEncounter => IsEgg;
public abstract ushort EggLocation { get; set; }
protected virtual bool IsMatchEggLocation(PKM pk)
{
var expect = EggEncounter ? EggLocation : pk is PB8 ? Locations.Default8bNone : 0;
var expect = IsEgg ? EggLocation : pk is PB8 ? Locations.Default8bNone : 0;
return pk.EggLocation == expect;
}

View file

@ -91,7 +91,6 @@ public sealed class PGT(byte[] Data) : DataMysteryGift(Data), IRibbonSetEvent3,
public bool IsHatched => GiftType == Pokémon;
public override bool IsEgg { get => GiftType == PokémonEgg || IsManaphyEgg; set { if (value) { GiftType = PokémonEgg; PK.IsEgg = true; } } }
public bool IsManaphyEgg { get => GiftType == ManaphyEgg; set { if (value) GiftType = ManaphyEgg; } }
public override bool EggEncounter => IsEgg;
public override bool IsItem { get => GiftType == Item; set { if (value) GiftType = Item; } }
public override bool IsEntity { get => GiftType is Pokémon or PokémonEgg or ManaphyEgg; set { } }
@ -145,7 +144,7 @@ public sealed class PGT(byte[] Data) : DataMysteryGift(Data), IRibbonSetEvent3,
private void SetMetData(PK4 pk4, ITrainerInfo trainer)
{
if (!EggEncounter)
if (!IsEgg)
{
pk4.MetLocation = (ushort)(pk4.EggLocation + 3000);
pk4.EggLocation = 0;

View file

@ -205,7 +205,6 @@ public sealed class LinkEntity6(Memory<byte> Raw) : IRibbonSetEvent3, IRibbonSet
public byte Generation => 6;
public bool IsShiny => false;
public bool EggEncounter => false;
public GameVersion Version => GameVersion.Gen6;
public EntityContext Context => EntityContext.Gen6;
public AbilityPermission Ability => (AbilityPermission)AbilityType;

View file

@ -131,7 +131,7 @@ public sealed class LegalityRejuvenator : IEntityRejuvenator
if (enc is EncounterInvalid)
return;
if (enc is { EggEncounter: true })
if (enc is { IsEgg: true })
{
result.MetLocation = Locations.HatchLocation8b;
result.EggLocation = Locations.LinkTrade6NPC;
@ -154,7 +154,7 @@ public sealed class LegalityRejuvenator : IEntityRejuvenator
if (enc is EncounterInvalid)
return;
if (enc is { EggEncounter: true })
if (enc is { IsEgg: true })
{
result.MetLocation = Locations.HatchLocation9;
result.EggLocation = Locations.LinkTrade6NPC;

View file

@ -15,7 +15,7 @@ public sealed class GP1(Memory<byte> Raw)
public Span<byte> Data => Raw.Span;
public GameVersion Version => GameVersion.GO;
public bool EggEncounter => false;
public bool IsEgg => false;
public byte LevelMin => Level;
public byte LevelMax => Level;
public byte Generation => 7;

View file

@ -204,7 +204,7 @@ public static class SpriteUtil
if (pct is not 0)
return ImageUtil.WritePixels(img, Color.DodgerBlue, start, start + (int)(SpriteWidth * pct * bpp));
var encLevel = enc is { EggEncounter: true } ? enc.LevelMin : pk.MetLevel;
var encLevel = enc is { IsEgg: true } ? enc.LevelMin : pk.MetLevel;
var color = level != encLevel && pk.HasOriginalMetLocation ? Color.DarkOrange : Color.Yellow;
return ImageUtil.WritePixels(img, color, start, start + (SpriteWidth * bpp));
}
@ -258,7 +258,7 @@ public static class SpriteUtil
return GetMysteryGiftPreviewPoke(g);
var gender = GetDisplayGender(enc);
var shiny = enc.IsShiny ? Shiny.Always : Shiny.Never;
var img = GetSprite(enc.Species, enc.Form, gender, 0, 0, enc.EggEncounter, shiny, enc.Context);
var img = GetSprite(enc.Species, enc.Form, gender, 0, 0, enc.IsEgg, shiny, enc.Context);
if (SpriteBuilder.ShowEncounterBall && enc is {FixedBall: not Ball.None})
{
var ballSprite = GetBallSprite((byte)enc.FixedBall);

View file

@ -253,7 +253,7 @@ public partial class SAV_Encounters : Form
var species = settings.Species == 0 ? GetFullRange(SAV.MaxSpeciesID) : [settings.Species];
var results = GetAllSpeciesFormEncounters(species, SAV.Personal, versions, moves, pk, token);
if (settings.SearchEgg != null)
results = results.Where(z => z.EggEncounter == settings.SearchEgg);
results = results.Where(z => z.IsEgg == settings.SearchEgg);
if (settings.SearchShiny != null)
results = results.Where(z => z.IsShiny == settings.SearchShiny);