mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-18 14:28:33 +00:00
Evolution check fixes
Evolution info was not checked for non-eggs; for mystery gifts check that the level of the evolution is not less than the level of the matched encounter fix spacing (cosmetic) add temp flagging for magnetpull/static slots (will eventually refactor into something functional that considers a set of slots including swarm/etc)
This commit is contained in:
parent
f674d45854
commit
4e1a520b0a
6 changed files with 68 additions and 9 deletions
|
@ -1158,7 +1158,7 @@ namespace PKHeX.Core
|
|||
}
|
||||
else if (lvl < pkm.Met_Level)
|
||||
AddLine(Severity.Invalid, V85, CheckIdentifier.Level);
|
||||
else if ((pkm.WasEgg || EncounterMatch == null) && !Legal.getEvolutionValid(pkm) && pkm.Species != 350)
|
||||
else if (!verifyEvolution()) // flag if invalid evo
|
||||
AddLine(Severity.Invalid, V86, CheckIdentifier.Level);
|
||||
else if (lvl > pkm.Met_Level && lvl > 1 && lvl != 100 && pkm.EXP == PKX.getEXP(pkm.Stat_Level, pkm.Species))
|
||||
AddLine(Severity.Fishy, V87, CheckIdentifier.Level);
|
||||
|
@ -2595,6 +2595,20 @@ namespace PKHeX.Core
|
|||
}
|
||||
}
|
||||
}
|
||||
private bool verifyEvolution()
|
||||
{
|
||||
if ((pkm.WasEgg || EncounterMatch == null) && !Legal.getEvolutionValid(pkm) && pkm.Species != 350)
|
||||
return false;
|
||||
|
||||
var match = EncounterMatch as IEncounterable;
|
||||
if (match == null)
|
||||
return true;
|
||||
|
||||
var evos = Legal.getValidPreEvolutions(pkm);
|
||||
var matchEvo = evos.FirstOrDefault(z => z.Species == match.Species);
|
||||
bool IsValid = matchEvo == null || matchEvo.Level < match.LevelMin;
|
||||
return IsValid;
|
||||
}
|
||||
private void verifyVersionEvolution()
|
||||
{
|
||||
if (pkm.Format < 7)
|
||||
|
|
|
@ -270,6 +270,34 @@ namespace PKHeX.Core
|
|||
: new EncounterArea {Location = t.First().Location, Slots = t.SelectMany(s => s.Slots).ToArray()})
|
||||
.ToArray();
|
||||
}
|
||||
private static void MarkEncountersStaticMagnetPull(ref EncounterArea[] Areas, PersonalTable t)
|
||||
{
|
||||
const int steel = 8;
|
||||
const int electric = 12;
|
||||
foreach (EncounterArea Area in Areas)
|
||||
{
|
||||
var s = new List<EncounterSlot>(); // Static
|
||||
var m = new List<EncounterSlot>(); // Magnet Pull
|
||||
foreach (EncounterSlot Slot in Area.Slots)
|
||||
{
|
||||
var types = t[Slot.Species].Types;
|
||||
if (types[0] == steel || types[1] == steel)
|
||||
m.Add(Slot);
|
||||
if (types[0] == electric || types[1] == electric)
|
||||
s.Add(Slot);
|
||||
}
|
||||
foreach (var slot in s)
|
||||
{
|
||||
slot.Static = true;
|
||||
slot.StaticCount = s.Count;
|
||||
}
|
||||
foreach (var slot in m)
|
||||
{
|
||||
slot.MagnetPull = true;
|
||||
slot.MagnetPullCount = s.Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
private static void MarkEncountersGeneration(ref EncounterStatic[] Encounters, int Generation)
|
||||
{
|
||||
foreach (EncounterStatic Encounter in Encounters)
|
||||
|
@ -764,6 +792,12 @@ namespace PKHeX.Core
|
|||
MarkG3SlotsSafariZones(ref FR_Slots, 136);
|
||||
MarkG3SlotsSafariZones(ref LG_Slots, 136);
|
||||
|
||||
MarkEncountersStaticMagnetPull(ref R_Slots, PersonalTable.SM);
|
||||
MarkEncountersStaticMagnetPull(ref S_Slots, PersonalTable.SM);
|
||||
MarkEncountersStaticMagnetPull(ref E_Slots, PersonalTable.SM);
|
||||
MarkEncountersStaticMagnetPull(ref FR_Slots, PersonalTable.SM);
|
||||
MarkEncountersStaticMagnetPull(ref LG_Slots, PersonalTable.SM);
|
||||
|
||||
SlotsR = addExtraTableSlots(R_Slots, SlotsRSEAlt);
|
||||
SlotsS = addExtraTableSlots(S_Slots, SlotsRSEAlt);
|
||||
SlotsE = addExtraTableSlots(E_Slots, SlotsRSEAlt);
|
||||
|
@ -796,6 +830,13 @@ namespace PKHeX.Core
|
|||
var Pt_Slots = getEncounterTables(GameVersion.Pt);
|
||||
var HG_Slots = getEncounterTables(GameVersion.HG);
|
||||
var SS_Slots = getEncounterTables(GameVersion.SS);
|
||||
|
||||
MarkEncountersStaticMagnetPull(ref D_Slots, PersonalTable.SM);
|
||||
MarkEncountersStaticMagnetPull(ref P_Slots, PersonalTable.SM);
|
||||
MarkEncountersStaticMagnetPull(ref Pt_Slots, PersonalTable.SM);
|
||||
MarkEncountersStaticMagnetPull(ref HG_Slots, PersonalTable.SM);
|
||||
MarkEncountersStaticMagnetPull(ref SS_Slots, PersonalTable.SM);
|
||||
|
||||
var DP_Trophy = EncounterArea.getTrophyArea(TrophyDP, new[] {16, 18});
|
||||
var Pt_Trophy = EncounterArea.getTrophyArea(TrophyPt, new[] {22, 22});
|
||||
var HG_Headbutt_Slots = EncounterArea.getArray4HGSS_Headbutt(Data.unpackMini(Util.getBinaryResource("encunters_hb_hg.pkl"), "hg"));
|
||||
|
|
|
@ -18,6 +18,11 @@
|
|||
public bool EggEncounter => false;
|
||||
public int Generation { get; set; } = -1;
|
||||
|
||||
public bool Static;
|
||||
public bool MagnetPull;
|
||||
public int StaticCount;
|
||||
public int MagnetPullCount;
|
||||
|
||||
public virtual EncounterSlot Clone()
|
||||
{
|
||||
return new EncounterSlot
|
||||
|
|
|
@ -626,10 +626,9 @@ namespace PKHeX.Core
|
|||
if (evo.Species > maxSpeciesTree)
|
||||
species = pkm.Species - Chain.Count + i;
|
||||
|
||||
dl.Add(evo.GetDexLevel(species, lvl));
|
||||
|
||||
if (evo.RequiresLevelUp)
|
||||
lvl--;
|
||||
dl.Add(evo.GetDexLevel(species, lvl));
|
||||
break;
|
||||
}
|
||||
if (!oneValid)
|
||||
|
|
Loading…
Add table
Reference in a new issue