mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-26 02:44:19 -05:00
Split some methods, handle flow for go enc
This commit is contained in:
@@ -9,7 +9,7 @@ namespace PKHeX.Core
|
||||
internal static class EncountersGO
|
||||
{
|
||||
/// <summary> Clamp for generating encounters; no species allowed above this value except for those in <see cref="ExtraSpecies"/>. </summary>
|
||||
private const int MaxSpeciesID_GO_HOME = Legal.MaxSpeciesID_6;
|
||||
private const int MaxSpeciesID_GO_HOME = Legal.MaxSpeciesID_5;
|
||||
|
||||
/// <summary> When generating encounters, these species will be skipped. </summary>
|
||||
private static readonly HashSet<int> DisallowedSpecies = new HashSet<int>
|
||||
@@ -25,6 +25,7 @@ internal static class EncountersGO
|
||||
|
||||
(int)Obstagoon,
|
||||
(int)Perrserker,
|
||||
(int)Sirfetchd,
|
||||
(int)Runerigus,
|
||||
};
|
||||
|
||||
|
||||
@@ -119,34 +119,48 @@ public void VerifyTransferLegalityG8(LegalityAnalysis data)
|
||||
{
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
}
|
||||
else if (data.EncounterMatch.Version == GameVersion.GO)
|
||||
{
|
||||
VerifyHOMETracker(data, pkm);
|
||||
}
|
||||
else if (data.Info.Generation < 8 && pkm.Format >= 8)
|
||||
{
|
||||
if (!pkm.GG && pkm is IScaledSize s)
|
||||
if (data.EncounterMatch is EncounterStatic7 s && FormConverter.IsTotemForm(s.Species, s.Form, 7))
|
||||
{
|
||||
if (s.HeightScalar != 0)
|
||||
if (Legal.Totem_NoTransfer.Contains(s.Species))
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
if (s.WeightScalar != 0)
|
||||
if (pkm.AltForm != FormConverter.GetTotemBaseForm(s.Species, s.Form))
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
|
||||
var enc = data.EncounterMatch;
|
||||
if (data.Info.Generation == 7 && FormConverter.IsTotemForm(enc.Species, enc.Form, 7))
|
||||
{
|
||||
if (Legal.Totem_NoTransfer.Contains(data.EncounterMatch.Species))
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
if (pkm.AltForm != FormConverter.GetTotemBaseForm(enc.Species, enc.Form))
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
}
|
||||
}
|
||||
|
||||
// Tracker value is set via Transfer across HOME.
|
||||
// Can't validate the actual values (we aren't the server), so we can only check against zero.
|
||||
if (pkm is IHomeTrack home && home.Tracker == 0)
|
||||
{
|
||||
data.AddLine(Get(LTransferTrackerMissing, ParseSettings.Gen8TransferTrackerNotPresent));
|
||||
// To the reader: It seems like the best course of action for setting a tracker is:
|
||||
// - Transfer a 0-Tracker pkm to HOME to get assigned a valid Tracker
|
||||
// - Don't make one up.
|
||||
}
|
||||
VerifyHOMETransfer(data, pkm);
|
||||
VerifyHOMETracker(data, pkm);
|
||||
}
|
||||
}
|
||||
|
||||
private void VerifyHOMETransfer(LegalityAnalysis data, PKM pkm)
|
||||
{
|
||||
if (!(pkm is IScaledSize s))
|
||||
return;
|
||||
|
||||
if (pkm.LGPE || pkm.GO)
|
||||
return; // can have any size value
|
||||
if (s.HeightScalar != 0)
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
if (s.WeightScalar != 0)
|
||||
data.AddLine(GetInvalid(LTransferBad));
|
||||
}
|
||||
|
||||
private void VerifyHOMETracker(LegalityAnalysis data, PKM pkm)
|
||||
{
|
||||
// Tracker value is set via Transfer across HOME.
|
||||
// Can't validate the actual values (we aren't the server), so we can only check against zero.
|
||||
if (pkm is IHomeTrack home && home.Tracker == 0)
|
||||
{
|
||||
data.AddLine(Get(LTransferTrackerMissing, ParseSettings.Gen8TransferTrackerNotPresent));
|
||||
// To the reader: It seems like the best course of action for setting a tracker is:
|
||||
// - Transfer a 0-Tracker pkm to HOME to get assigned a valid Tracker
|
||||
// - Don't make one up.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -298,9 +298,11 @@ private void SetID7(int sid7, int tid7)
|
||||
public bool SWSH => Version == (int)GameVersion.SW || Version == (int)GameVersion.SH;
|
||||
|
||||
protected bool PtHGSS => Pt || HGSS;
|
||||
public bool GO_LGPE => GO && Met_Location == 50;
|
||||
public bool GO_HOME => GO && Met_Location == Locations.GO8;
|
||||
public bool VC => VC1 || VC2;
|
||||
public bool GG => LGPE || GO;
|
||||
public bool Gen8 => Version >= 44 && Version <= 45;
|
||||
public bool GG => LGPE || GO_LGPE;
|
||||
public bool Gen8 => (Version >= 44 && Version <= 45) || GO_HOME;
|
||||
public bool Gen7 => (Version >= 30 && Version <= 33) || GG;
|
||||
public bool Gen6 => Version >= 24 && Version <= 29;
|
||||
public bool Gen5 => Version >= 20 && Version <= 23;
|
||||
|
||||
Reference in New Issue
Block a user