Bias rby encounter selection due to lack of info

Previously, if encounterstatic was valid it'd treat it as the actual
encounter.
Now, select the lowest species possible.

Only really affects moon stone evolution families, which are available
in the wild at lower levels than their coin counterpart (so we prefer
them).
Kinda flawed as DV spread can be checked (invalid=>use static) but this
should be good enough for now.
This commit is contained in:
Kurt 2017-02-12 21:02:24 -08:00
parent ff0a179c42
commit b89c1d7b6c
3 changed files with 69 additions and 45 deletions

View file

@ -519,6 +519,38 @@ namespace PKHeX.Core
}
return null;
}
private CheckResult verifyEncounterG1()
{
// Since encounter matching is super weak due to limited stored data in the structure
// Calculate all 3 at the same time and pick the best result (by species).
var s = Legal.getValidStaticEncounter(pkm);
var e = Legal.getValidWildEncounters(pkm);
var t = Legal.getValidIngameTrade(pkm);
const byte invalid = 255;
var sm = s?.Species ?? invalid;
var em = e?.Min(slot => slot.Species) ?? invalid;
var tm = t?.Species ?? invalid;
if (sm + em + tm == 3*invalid)
return new CheckResult(Severity.Invalid, "Unknown encounter.", CheckIdentifier.Encounter);
if (em <= sm && em <= tm)
{
EncounterMatch = e;
return verifyEncounterWild();
}
if (sm <= em && sm <= tm)
{
EncounterMatch = s;
return verifyEncounterStatic();
}
// else is trade
return new CheckResult(Severity.Valid, "Valid ingame trade.", CheckIdentifier.Encounter);
}
private CheckResult verifyEncounter()
{
if (pkm.VC || pkm.Format < 3)
@ -531,16 +563,12 @@ namespace PKHeX.Core
if (pkm.Format > 2) // transported to 7+
Parse.Add(verifyVCEncounter(baseSpecies));
}
else if (pkm.GenNumber == 4)
{
return verifyEncounterG1();
}
else
{
if (pkm.WasLink)
return verifyEncounterLink();
}
if (pkm.WasLink)
return verifyEncounterLink();
if (pkm.WasEvent || pkm.WasEventEgg)
{

View file

@ -1045,7 +1045,7 @@ namespace PKHeX.Core
PersonalInfo pi = PersonalTable.RBY[species];
if (LVL)
{
r.AddRange(((PersonalInfoG1)PersonalTable.RBY[species]).Moves);
r.AddRange(((PersonalInfoG1)pi).Moves);
r.AddRange(LevelUpRB[species].getMoves(lvl));
}
if (Machine) r.AddRange(TMHM_RBY.Where((t, m) => pi.TMHM[m]));

View file

@ -50,37 +50,33 @@ namespace PKHeX.Core
new EncounterStatic { Species = 007, Level = 05 }, // Squirtle
new EncounterStatic { Species = 025, Level = 05 }, // Pikachu
// Red Game Corner
new EncounterStatic { Species = 063, Level = 09 }, // Abra
new EncounterStatic { Species = 025, Level = 08 }, // Clefairy
new EncounterStatic { Species = 025, Level = 17 }, // Nidorina
new EncounterStatic { Species = 147, Level = 18 }, // Dratini
new EncounterStatic { Species = 123, Level = 25 }, // Scyther
new EncounterStatic { Species = 137, Level = 26 }, // Porygon
// Blue(EN) / Green(JP) Game Corner
new EncounterStatic { Species = 063, Level = 06 }, // Abra
new EncounterStatic { Species = 035, Level = 12 }, // Clefairy
new EncounterStatic { Species = 030, Level = 17 }, // Nidorina
new EncounterStatic { Species = 127, Level = 20 }, // Pinsir
new EncounterStatic { Species = 147, Level = 24 }, // Dratini
new EncounterStatic { Species = 137, Level = 18 }, // Porygon
// Blue(JP) Game Corner
new EncounterStatic { Species = 063, Level = 08 }, // Abra
new EncounterStatic { Species = 025, Level = 12 }, // Pikachu
new EncounterStatic { Species = 116, Level = 18 }, // Horsea
new EncounterStatic { Species = 036, Level = 24 }, // Clefable
new EncounterStatic { Species = 148, Level = 30 }, // Dragonair
new EncounterStatic { Species = 137, Level = 22 }, // Porygon
// Yellow Game Corner
new EncounterStatic { Species = 063, Level = 15 }, // Abra
new EncounterStatic { Species = 025, Level = 18 }, // Vulpix
new EncounterStatic { Species = 025, Level = 22 }, // Wigglytuff
new EncounterStatic { Species = 123, Level = 30 }, // Scyther
new EncounterStatic { Species = 127, Level = 30 }, // Pinsir
new EncounterStatic { Species = 137, Level = 26 }, // Porygon
// Game Corner
new EncounterStatic { Species = 030, Level = 17 }, // Nidorina (Red Game Corner)
new EncounterStatic { Species = 033, Level = 17 }, // Nidorino (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 035, Level = 08 }, // Clefairy (Red Game Corner)
new EncounterStatic { Species = 036, Level = 24 }, // Clefable (Blue[JP] Game Corner)
new EncounterStatic { Species = 037, Level = 18 }, // Vulpix (Yellow Game Corner)
new EncounterStatic { Species = 040, Level = 22 }, // Wigglytuff (Yellow Game Corner)
new EncounterStatic { Species = 063, Level = 06 }, // Abra (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 116, Level = 18 }, // Horsea (Blue[JP] Game Corner)
new EncounterStatic { Species = 123, Level = 25 }, // Scyther (Red Game Corner)
new EncounterStatic { Species = 127, Level = 20 }, // Pinsir (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 137, Level = 18 }, // Porygon (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 147, Level = 18 }, // Dratini (Red Game Corner)
new EncounterStatic { Species = 148, Level = 30 }, // Dragonair (Blue[JP] Game Corner)
// Lower level less ideal matches; best match is from above.
// new EncounterStatic { Species = 025, Level = 12 }, // Pikachu (Blue[JP] Game Corner)
// new EncounterStatic { Species = 035, Level = 12 }, // Clefairy (Blue[EN] / Green[JP] Game Corner)
// new EncounterStatic { Species = 063, Level = 09 }, // Abra (Red Game Corner)
// new EncounterStatic { Species = 063, Level = 08 }, // Abra (Blue[JP] Game Corner)
// new EncounterStatic { Species = 063, Level = 15 }, // Abra (Yellow Game Corner)
// new EncounterStatic { Species = 123, Level = 30 }, // Scyther (Yellow Game Corner)
// new EncounterStatic { Species = 127, Level = 30 }, // Pinsir (Yellow Game Corner)
// new EncounterStatic { Species = 137, Level = 22 }, // Porygon (Blue[JP] Game Corner)
// new EncounterStatic { Species = 137, Level = 26 }, // Porygon (Red Game Corner)
// new EncounterStatic { Species = 137, Level = 26 }, // Porygon (Yellow Game Corner)
// new EncounterStatic { Species = 147, Level = 24 }, // Dratini (Blue[EN] / Green[JP] Game Corner)
new EncounterStatic { Species = 129, Level = 05 }, // Magikarp
new EncounterStatic { Species = 143, Level = 30 }, // Snorlax
@ -101,11 +97,11 @@ namespace PKHeX.Core
new EncounterStatic { Species = 133, Level = 25 }, // Eevee
// Yellow Only
new EncounterStatic { Species = 133, Level = 25 }, // Eevee (Celadon City)
new EncounterStatic { Species = 001, Level = 10 }, // Bulbasaur (Cerulean City)
new EncounterStatic { Species = 004, Level = 10 }, // Charmander (Route 24)
new EncounterStatic { Species = 007, Level = 10 }, // Squirtle (Vermillion City)
// Yellow Only -- duplicate encounters with a higher level
// new EncounterStatic { Species = 133, Level = 25 }, // Eevee (Celadon City)
// new EncounterStatic { Species = 001, Level = 10 }, // Bulbasaur (Cerulean City)
// new EncounterStatic { Species = 004, Level = 10 }, // Charmander (Route 24)
// new EncounterStatic { Species = 007, Level = 10 }, // Squirtle (Vermillion City)
};
internal static readonly EncounterTrade[] TradeGift_RBY =
{