mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-08-25 00:35:46 -05:00
Use Generation property when available
This commit is contained in:
@@ -15,16 +15,16 @@ public override void Verify(LegalityAnalysis data)
|
||||
int originalGeneration = data.Info.Generation;
|
||||
int currentLanguage = pkm.Language;
|
||||
int maxLanguageID = Legal.GetMaxLanguageID(originalGeneration);
|
||||
|
||||
if (!IsValidLanguageID(currentLanguage, maxLanguageID, pkm, data.EncounterMatch))
|
||||
var enc = data.EncounterMatch;
|
||||
if (!IsValidLanguageID(currentLanguage, maxLanguageID, pkm, enc))
|
||||
{
|
||||
data.AddLine(GetInvalid(string.Format(LOTLanguage, $"<={(LanguageID)maxLanguageID}", (LanguageID)currentLanguage)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Korean Gen4 games can not trade with other Gen4 languages, but can use Pal Park with any Gen3 game/language.
|
||||
if (pkm.Format == 4 && pkm.Gen4 && !IsValidG4Korean(currentLanguage)
|
||||
&& !(data.EncounterMatch is EncounterTrade4 {Species: (int)Species.Pikachu or (int)Species.Magikarp}) // ger magikarp / eng pikachu
|
||||
if (pkm.Format == 4 && enc.Generation == 4 && !IsValidG4Korean(currentLanguage)
|
||||
&& enc is not EncounterTrade4PID {Species: (int)Species.Pikachu or (int)Species.Magikarp} // ger magikarp / eng pikachu
|
||||
)
|
||||
{
|
||||
bool kor = currentLanguage == (int)LanguageID.Korean;
|
||||
|
||||
@@ -84,13 +84,15 @@ private CheckResult VerifyCommonMemory(PKM pkm, int handler, int gen, LegalInfo
|
||||
|
||||
if (gen == 6 && !Memories.CanHaveIntensity(memory.MemoryID, memory.Intensity))
|
||||
{
|
||||
if (pkm.Gen6 || (pkm.Gen7 && memory.MemoryID != 0)) // todo: memory intensity checks for gen8
|
||||
var encGen = info.EncounterMatch.Generation;
|
||||
if (encGen == 6 || (encGen == 7 && memory.MemoryID != 0)) // todo: memory intensity checks for gen8
|
||||
return GetInvalid(string.Format(LMemoryIndexIntensityMin, memory.Handler, Memories.GetMinimumIntensity(memory.MemoryID)));
|
||||
}
|
||||
|
||||
if (gen == 6 && memory.MemoryID != 4 && !Memories.CanHaveFeeling(memory.MemoryID, memory.Feeling))
|
||||
{
|
||||
if (pkm.Gen6 || (pkm.Gen7 && memory.MemoryID != 0)) // todo: memory feeling checks for gen8
|
||||
var encGen = info.EncounterMatch.Generation;
|
||||
if (encGen == 6 || (encGen == 7 && memory.MemoryID != 0)) // todo: memory feeling checks for gen8
|
||||
return GetInvalid(string.Format(LMemoryFeelInvalid, memory.Handler));
|
||||
}
|
||||
|
||||
@@ -191,7 +193,7 @@ private void VerifyOTMemory(LegalityAnalysis data)
|
||||
break;
|
||||
|
||||
// {0} became {1}’s friend when it arrived via Link Trade at... {2}. {4} that {3}.
|
||||
case 4 when pkm.Gen6:
|
||||
case 4 when Info.Generation == 6: // gen8 applies this memory erroneously
|
||||
data.AddLine(GetInvalid(string.Format(LMemoryArgBadOTEgg, L_XOT)));
|
||||
return;
|
||||
|
||||
|
||||
@@ -354,8 +354,7 @@ private static IEnumerable<RibbonResult> GetInvalidRibbons7Any(PKM pkm, IRibbonS
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<RibbonResult> GetInvalidRibbons8Any(PKM pkm, IRibbonSetCommon8 s8,
|
||||
IEncounterTemplate enc)
|
||||
private static IEnumerable<RibbonResult> GetInvalidRibbons8Any(PKM pkm, IRibbonSetCommon8 s8, IEncounterTemplate enc)
|
||||
{
|
||||
if (!pkm.InhabitedGeneration(8) || !((PersonalInfoSWSH)PersonalTable.SWSH[pkm.Species]).IsPresentInGame)
|
||||
{
|
||||
@@ -371,7 +370,7 @@ private static IEnumerable<RibbonResult> GetInvalidRibbons7Any(PKM pkm, IRibbonS
|
||||
const int memChampion = 27;
|
||||
{
|
||||
bool hasChampMemory = (pkm.Format == 8 && pkm is IMemoryHT {HT_Memory: memChampion}) ||
|
||||
(pkm.Gen8 && pkm is IMemoryOT {OT_Memory: memChampion});
|
||||
(enc.Generation == 8 && pkm is IMemoryOT {OT_Memory: memChampion});
|
||||
if (hasChampMemory && !s8.RibbonChampionGalar)
|
||||
yield return new RibbonResult(nameof(s8.RibbonChampionGalar));
|
||||
}
|
||||
@@ -393,7 +392,7 @@ private static IEnumerable<RibbonResult> GetInvalidRibbons7Any(PKM pkm, IRibbonS
|
||||
const int strongest = 30;
|
||||
if (pkm is IMemoryOT {OT_Memory: strongest} || pkm is IMemoryHT {HT_Memory: strongest})
|
||||
{
|
||||
if (pkm.Gen8 || !IsAllowedBattleFrontier(pkm.Species) || pkm is IRibbonSetCommon6 {RibbonBattlerSkillful: false})
|
||||
if (enc.Generation == 8 || !IsAllowedBattleFrontier(pkm.Species) || pkm is IRibbonSetCommon6 {RibbonBattlerSkillful: false})
|
||||
yield return new RibbonResult(nameof(s8.RibbonTowerMaster));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user