Refactoring fixes

Fix misc refactoring errors

Don't early abort gen4->5+ encounter generation (need to check ingame
trades for abra/gengar). Can avoid by PID dictionary to check for trades
first, but unimplemented.

Closes #1377 , not fixing Pokewalker PID mismatch as algorithm needs to
be ironed out separately.
This commit is contained in:
Kurt 2017-08-01 14:55:10 -07:00
parent 8e4d236c98
commit 2a4aa0b79d
4 changed files with 9 additions and 4 deletions

View File

@ -1989,7 +1989,11 @@ private void VerifyForm()
return;
if (pkm.Format < 4)
return;
return; // no forms exist
int count = pkm.PersonalInfo.FormeCount;
if (count == 1 && pkm.AltForm == 0)
return; // no forms to check
if (pkm.AltForm > pkm.PersonalInfo.FormeCount)
{

View File

@ -1237,7 +1237,7 @@ private static void MarkHGSSEncounterTypeSlots(ref EncounterArea[] Areas)
new EncounterSlot { Species = 406, LevelMin = 40, LevelMax = 40, Type = SlotType.Grass_Safari }, // Budew
new EncounterSlot { Species = 443, LevelMin = 44, LevelMax = 44, Type = SlotType.Grass_Safari }, // Gible
};
private static EncounterSlot[] SAFARIZONE_WASTELAND =
private static readonly EncounterSlot[] SAFARIZONE_WASTELAND =
{
new EncounterSlot { Species = 022, LevelMin = 15, LevelMax = 17, Type = SlotType.Grass_Safari }, // Fearow
new EncounterSlot { Species = 055, LevelMin = 45, LevelMax = 45, Type = SlotType.Grass_Safari }, // Golduck
@ -1339,6 +1339,7 @@ private static void MarkHGSSEncounterTypeSlots(ref EncounterArea[] Areas)
};
private static readonly EncounterArea[] SlotsHGSSAlt =
{
SlotsHGSS_BCC,
new EncounterArea {
Location = 209, // Ruins of Alph
Slots = new int[25].Select((s, i) => new EncounterSlot { Species = 201, LevelMin = 5, LevelMax = 5, Type = SlotType.Grass, Form = i+1 }).ToArray() // B->?, Unown A is loaded from encounters raw file

View File

@ -243,7 +243,7 @@ private static IEnumerable<IEncounterable> GenerateRawEncounters4(PKM pkm)
// if (ctr != 0) yield break;
foreach (var z in GetValidWildEncounters(pkm))
{ yield return z; ++ctr; }
if (ctr != 0) yield break;
if (ctr != 0 && pkm.HasOriginalMetLocation) yield break; // EncounterTrade abra/gengar will match wild slots
foreach (var z in GetValidEncounterTrades(pkm))
{ yield return z; ++ctr; }
if (ctr != 0) yield break;

View File

@ -90,7 +90,7 @@ private static CheckResult[] VerifyRelearnEggBase(PKM pkm, LegalInfo info, Encou
// Obtain level1 moves
var baseMoves = Legal.GetBaseEggMoves(pkm, e.Species, e.Game, 1);
int baseCt = Math.Max(4, baseMoves.Length);
int baseCt = Math.Min(4, baseMoves.Length);
// Obtain Inherited moves
var inheritMoves = Legal.GetValidRelearn(pkm, e.Species, inheritLvlMoves).ToList();