mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Add gen1-4 EV check for untrained pkm
Rework some checks for eggs, closes #1248 GetEggHatchLevel uses Format instead of Generation; should only be used on IsEgg=true pkm
This commit is contained in:
parent
caa46455a8
commit
82c8bc01bd
6 changed files with 29 additions and 16 deletions
|
@ -343,9 +343,16 @@ namespace PKHeX.Core
|
||||||
if (evs.Any(ev => ev > 100)) // EVs can only be increased by vitamins to a max of 100.
|
if (evs.Any(ev => ev > 100)) // EVs can only be increased by vitamins to a max of 100.
|
||||||
AddLine(Severity.Invalid, V367, CheckIdentifier.EVs);
|
AddLine(Severity.Invalid, V367, CheckIdentifier.EVs);
|
||||||
}
|
}
|
||||||
|
else if (pkm.Format < 6)
|
||||||
|
{
|
||||||
|
var maxEV = pkm.Format <= 2 ? 25600 : 100; // Vitamin Max
|
||||||
|
// Cannot EV train above 100 without increasing EXP
|
||||||
|
if (PKX.GetEXP(EncounterMatch.LevelMin, pkm.Species) == pkm.EXP && evs.Any(ev => ev > maxEV))
|
||||||
|
AddLine(Severity.Invalid, string.Format(V418, maxEV), CheckIdentifier.EVs);
|
||||||
|
}
|
||||||
|
|
||||||
// Only one of the following can be true: 0, 508, and x%6!=0
|
// Only one of the following can be true: 0, 508, and x%6!=0
|
||||||
if (sum == 0 && pkm.CurrentLevel - Math.Max(1, pkm.Met_Level) > 0)
|
if (sum == 0 && pkm.CurrentLevel != EncounterMatch.LevelMin)
|
||||||
AddLine(Severity.Fishy, V23, CheckIdentifier.EVs);
|
AddLine(Severity.Fishy, V23, CheckIdentifier.EVs);
|
||||||
else if (sum == 508)
|
else if (sum == 508)
|
||||||
AddLine(Severity.Fishy, V24, CheckIdentifier.EVs);
|
AddLine(Severity.Fishy, V24, CheckIdentifier.EVs);
|
||||||
|
@ -600,31 +607,33 @@ namespace PKHeX.Core
|
||||||
#endregion
|
#endregion
|
||||||
private void VerifyLevel()
|
private void VerifyLevel()
|
||||||
{
|
{
|
||||||
MysteryGift MatchedGift = EncounterMatch as MysteryGift;
|
if (EncounterMatch is MysteryGift gift)
|
||||||
if (MatchedGift != null && MatchedGift.Level != pkm.Met_Level)
|
|
||||||
{
|
{
|
||||||
if (pkm.HasOriginalMetLocation && (!(MatchedGift is WC7) || ((WC7) MatchedGift).MetLevel != pkm.Met_Level))
|
if (gift.Level != pkm.Met_Level)
|
||||||
|
if (pkm.HasOriginalMetLocation && (!(gift is WC7 wc7) || wc7.MetLevel != pkm.Met_Level))
|
||||||
{
|
{
|
||||||
AddLine(new CheckResult(Severity.Invalid, V83, CheckIdentifier.Level));
|
AddLine(new CheckResult(Severity.Invalid, V83, CheckIdentifier.Level));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (gift.Level > pkm.CurrentLevel)
|
||||||
|
{
|
||||||
|
AddLine(new CheckResult(Severity.Invalid, V84, CheckIdentifier.Level));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (MatchedGift != null && MatchedGift.Level > pkm.CurrentLevel)
|
|
||||||
|
if (pkm.IsEgg)
|
||||||
{
|
{
|
||||||
AddLine(new CheckResult(Severity.Invalid, V84, CheckIdentifier.Level));
|
int elvl = Legal.GetEggHatchLevel(pkm);
|
||||||
|
if (elvl != pkm.CurrentLevel)
|
||||||
|
AddLine(Severity.Invalid, string.Format(V52, elvl), CheckIdentifier.Level);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lvl = pkm.CurrentLevel;
|
int lvl = pkm.CurrentLevel;
|
||||||
if (pkm.IsEgg)
|
if (lvl < pkm.Met_Level)
|
||||||
{
|
|
||||||
int elvl = pkm.Format <= 3 ? 5 : 1;
|
|
||||||
if (elvl != lvl)
|
|
||||||
AddLine(Severity.Invalid, string.Format(V52, elvl), CheckIdentifier.Level);
|
|
||||||
}
|
|
||||||
else if (lvl < pkm.Met_Level)
|
|
||||||
AddLine(Severity.Invalid, V85, CheckIdentifier.Level);
|
AddLine(Severity.Invalid, V85, CheckIdentifier.Level);
|
||||||
else if (lvl > pkm.Met_Level && lvl > 1 && lvl != 100 && pkm.EXP == PKX.GetEXP(pkm.Stat_Level, pkm.Species))
|
else if (EncounterMatch.LevelMin != lvl && lvl != 100 && pkm.EXP == PKX.GetEXP(lvl, pkm.Species))
|
||||||
AddLine(Severity.Fishy, V87, CheckIdentifier.Level);
|
AddLine(Severity.Fishy, V87, CheckIdentifier.Level);
|
||||||
else
|
else
|
||||||
AddLine(Severity.Valid, V88, CheckIdentifier.Level);
|
AddLine(Severity.Valid, V88, CheckIdentifier.Level);
|
||||||
|
|
|
@ -1831,7 +1831,7 @@ namespace PKHeX.Core
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
internal static int GetEggHatchLevel(PKM pkm) => pkm.Format <= 3 ? 5 : 1;
|
||||||
internal static int[] GetSplitBreedGeneration(PKM pkm)
|
internal static int[] GetSplitBreedGeneration(PKM pkm)
|
||||||
{
|
{
|
||||||
return GetSplitBreedGeneration(pkm.GenNumber);
|
return GetSplitBreedGeneration(pkm.GenNumber);
|
||||||
|
|
|
@ -411,6 +411,7 @@ namespace PKHeX.Core
|
||||||
public static string V415 {get; set;} = "Eggs cannot have Pokéathlon stats."; // Invalid
|
public static string V415 {get; set;} = "Eggs cannot have Pokéathlon stats."; // Invalid
|
||||||
public static string V416 {get; set;} = "Mystery Gift cannot be received by this version."; // Invalid
|
public static string V416 {get; set;} = "Mystery Gift cannot be received by this version."; // Invalid
|
||||||
public static string V417 {get; set;} = "Suspicious Original Trainer details.";
|
public static string V417 {get; set;} = "Suspicious Original Trainer details.";
|
||||||
|
public static string V418 {get; set;} = "Individual EV without changing EXP cannot be greater than {0}.";
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ V360 = Unable to match an event Egg encounter from origin game.
|
||||||
V363 = Incompatible moves. Learned at the same level in Red/Blue and Yellow.
|
V363 = Incompatible moves. Learned at the same level in Red/Blue and Yellow.
|
||||||
V365 = Incompatible evolution moves. {0} Move learned at a lower level than other {1} moves.
|
V365 = Incompatible evolution moves. {0} Move learned at a lower level than other {1} moves.
|
||||||
V366 = Incompatible evolution moves. {1} Move learned at a higher level than other {0} moves.
|
V366 = Incompatible evolution moves. {1} Move learned at a higher level than other {0} moves.
|
||||||
V367 = Individual EV for a level 100 encounter in Generation 4 cannot be greater than 100.public static string
|
V367 = Individual EV for a level 100 encounter in Generation 4 cannot be greater than 100.
|
||||||
V368 = Eggs can not be infected with Pokérus.
|
V368 = Eggs can not be infected with Pokérus.
|
||||||
V369 = Invalid E-Reader Berry.
|
V369 = Invalid E-Reader Berry.
|
||||||
V370 = Japanese E-Reader Berry in international savegame.
|
V370 = Japanese E-Reader Berry in international savegame.
|
||||||
|
@ -348,3 +348,4 @@ V414 = Eggs cannot have Shiny Leaf/Crown.
|
||||||
V415 = Eggs cannot have Pokéathlon stats.
|
V415 = Eggs cannot have Pokéathlon stats.
|
||||||
V416 = Mystery Gift cannot be received by this version.
|
V416 = Mystery Gift cannot be received by this version.
|
||||||
V417 = Suspicious Original Trainer details.
|
V417 = Suspicious Original Trainer details.
|
||||||
|
V418 = Individual EV without changing EXP cannot be greater than {0}.
|
||||||
|
|
|
@ -348,3 +348,4 @@ V414 = Eggs cannot have Shiny Leaf/Crown.
|
||||||
V415 = Eggs cannot have Pokéathlon stats.
|
V415 = Eggs cannot have Pokéathlon stats.
|
||||||
V416 = Mystery Gift cannot be received by this version.
|
V416 = Mystery Gift cannot be received by this version.
|
||||||
V417 = Suspicious Original Trainer details.
|
V417 = Suspicious Original Trainer details.
|
||||||
|
V418 = Individual EV without changing EXP cannot be greater than {0}.
|
||||||
|
|
|
@ -348,3 +348,4 @@ V414 = Eggs cannot have Shiny Leaf/Crown.
|
||||||
V415 = Eggs cannot have Pokéathlon stats.
|
V415 = Eggs cannot have Pokéathlon stats.
|
||||||
V416 = Mystery Gift cannot be received by this version.
|
V416 = Mystery Gift cannot be received by this version.
|
||||||
V417 = Suspicious Original Trainer details.
|
V417 = Suspicious Original Trainer details.
|
||||||
|
V418 = Individual EV without changing EXP cannot be greater than {0}.
|
||||||
|
|
Loading…
Reference in a new issue