Use Gen8 toxel gift IVs in ctor

ty anubis
This commit is contained in:
Kurt 2023-09-02 09:30:43 -07:00
parent 93ddee4be4
commit 0f7e623842
3 changed files with 14 additions and 2 deletions

View file

@ -134,6 +134,18 @@ public sealed record EncounterGift1(ushort Species, byte Level, GameVersion Vers
return false;
if (Form != evo.Form && !FormInfo.IsFormChangeable(Species, Form, pk.Form, Context, pk.Context))
return false;
if (IVs.IsSpecified)
{
if (Shiny == Shiny.Always && !pk.IsShiny)
return false;
if (Shiny == Shiny.Never && pk.IsShiny)
return false;
if (pk.Format <= 2)
{
if (!Legal.GetIsFixedIVSequenceValidNoRand(IVs, pk))
return false;
}
}
// EC/PID check doesn't exist for these, so check Shiny state here.
if (!IsShinyValid(pk))

View file

@ -135,7 +135,7 @@ public sealed record EncounterStatic7(GameVersion Version)
criteria.SetRandomIVs(pk, IVs);
else
criteria.SetRandomIVs(pk, FlawlessIVCount);
var ability = criteria.GetAbilityFromNumber(Ability);
pk.Nature = (int)criteria.GetNature(Nature);
pk.Gender = criteria.GetGender(Gender, pi);

View file

@ -124,7 +124,7 @@ public sealed record EncounterStatic8(GameVersion Version = GameVersion.SWSH)
var rand = Util.Rand;
pk.EncryptionConstant = rand.Rand32();
pk.PID = rand.Rand32();
criteria.SetRandomIVs(pk);
criteria.SetRandomIVs(pk, IVs);
return;
}
var shiny = Shiny == Shiny.Random ? Shiny.FixedValue : Shiny;