mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-12 23:37:07 +00:00
Handle downleveled cases correctly
Downleveled shared nest can't go below 20 Downleveled self nest can only happen for 1 or 3 badges and certain star counts, and the result can't be shiny
This commit is contained in:
parent
64428539bd
commit
4a5a913142
1 changed files with 10 additions and 5 deletions
|
@ -44,20 +44,25 @@ namespace PKHeX.Core
|
|||
|
||||
protected override bool IsMatchLevel(PKM pkm, int lvl)
|
||||
{
|
||||
var metLevel = pkm.Met_Level - 15;
|
||||
var met = pkm.Met_Level;
|
||||
var metLevel = met - 15;
|
||||
var rank = ((uint)metLevel) / 10;
|
||||
if (rank > 4)
|
||||
return false;
|
||||
if (rank > MaxRank)
|
||||
return false;
|
||||
if (rank < MinRank) // downleveled
|
||||
if (rank < MinRank) // down-leveled
|
||||
{
|
||||
if (metLevel % 5 != 0)
|
||||
return false;
|
||||
|
||||
// shared nests can be downleveled to any; native downlevels: only allow 1 rank down (?)
|
||||
if (pkm.Met_Location != SharedNest && MinRank - rank > 1)
|
||||
return false;
|
||||
// shared nests can be down-leveled to any
|
||||
if (pkm.Met_Location == SharedNest)
|
||||
return met >= 20;
|
||||
|
||||
// native down-levels: only allow 1 rank down (1 badge 2star -> 25), (3badge 3star -> 35)
|
||||
return ((MinRank <= 1 && 1 <= MaxRank && met == 25)
|
||||
|| (MinRank <= 2 && 2 <= MaxRank && met == 35)) && !pkm.IsShiny;
|
||||
}
|
||||
|
||||
return metLevel % 10 <= 5;
|
||||
|
|
Loading…
Reference in a new issue