Skip to content

Commit

Permalink
Update gen2 egg generator
Browse files Browse the repository at this point in the history
Level = Level is equivalent to Level = 0

update EggInfoSource to use Level instead of LevelMin (LevelMin returns
Level, just be clear on usage)
update VerifyCurrentMoves so that only gen1/2 do the gen1/2 move update
methods. Recently extended all encounters to have a generation property;
we only care about gen1/2 here.

https://projectpokemon.org/home/forums/topic/43655-pokemon-crystal-egg-mark-as-not-legit/
  • Loading branch information
kwsch committed Jan 31, 2018
1 parent 84a0381 commit 999427f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions PKHeX.Core/Legality/Encounters/VerifyCurrentMoves.cs
Expand Up @@ -39,7 +39,7 @@ private static CheckMoveResult[] ParseMovesForEncounters(PKM pkm, LegalInfo info
var defaultG1LevelMoves = info.EncounterMoves.LevelUpMoves[1];
var defaultG2LevelMoves = pkm.InhabitedGeneration(2) ? info.EncounterMoves.LevelUpMoves[2] : null;
var defaultTradeback = pkm.TradebackStatus;
if (EncounterMatchGen != null)
if (EncounterMatchGen?.Generation <= 2)
{
// Generation 1 can have different minimum level in different encounter of the same species; update valid level moves
UptateGen1LevelUpMoves(pkm, info.EncounterMoves, info.EncounterMoves.MinimumLevelGen1, EncounterMatchGen.Generation, info);
Expand All @@ -57,7 +57,7 @@ private static CheckMoveResult[] ParseMovesForEncounters(PKM pkm, LegalInfo info
return res;

// not valid
if (EncounterMatchGen?.Generation == 1 || EncounterMatchGen?.Generation == 2) // restore generation 1 and 2 moves
if (EncounterMatchGen?.Generation <= 2) // restore generation 1 and 2 moves
{
info.EncounterMoves.LevelUpMoves[1] = defaultG1LevelMoves;
if (pkm.InhabitedGeneration(2))
Expand Down
2 changes: 1 addition & 1 deletion PKHeX.Core/Legality/Moves/EggInfoSource.cs
Expand Up @@ -14,7 +14,7 @@ public EggInfoSource(PKM pkm, IEnumerable<int> specialMoves, EncounterEgg e)

// Level up moves can only be inherited if ditto is not the mother.
bool AllowLevelUp = Legal.GetCanInheritMoves(pkm, e);
Base = Legal.GetBaseEggMoves(pkm, e.Species, e.Game, e.LevelMin).ToList();
Base = Legal.GetBaseEggMoves(pkm, e.Species, e.Game, e.Level).ToList();

Egg = Legal.GetEggMoves(pkm, e.Species, pkm.AltForm, e.Game).ToList();
LevelUp = AllowLevelUp
Expand Down
2 changes: 1 addition & 1 deletion PKHeX.Core/Legality/Structures/GBEncounterData.cs
Expand Up @@ -31,7 +31,7 @@ public GBEncounterData(int species, GameVersion game)
{
Generation = 2;
Game = game;
Encounter = new EncounterEgg { Species = species, Game = game, Level = Level };
Encounter = new EncounterEgg { Species = species, Game = game, Level = 5 };
Type = GBEncounterType.EggEncounter;
}

Expand Down

0 comments on commit 999427f

Please sign in to comment.