mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 14:00:21 +00:00
Set form when appropriate
This commit is contained in:
parent
392dfbbb4e
commit
c4b8cab9cd
12 changed files with 17 additions and 6 deletions
|
@ -46,6 +46,7 @@ public sealed record EncounterSlot7GO(int StartDate, int EndDate, ushort Species
|
|||
PID = Util.Rand32(),
|
||||
EncryptionConstant = Util.Rand32(),
|
||||
Species = Species,
|
||||
Form = Form,
|
||||
CurrentLevel = LevelMin,
|
||||
OT_Friendship = PersonalTable.GG[Species].BaseFriendship,
|
||||
Met_Location = Location,
|
||||
|
|
|
@ -27,7 +27,7 @@ public static class EncounterUtil1
|
|||
{
|
||||
Span<ushort> moves = stackalloc ushort[4];
|
||||
var source = GameData.GetLearnSource(version);
|
||||
source.SetEncounterMoves(pk.Species, 0, level, moves);
|
||||
source.SetEncounterMoves(pk.Species, pk.Form, level, moves);
|
||||
pk.SetMoves(moves);
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ public sealed record EncounterStatic5(GameVersion Version)
|
|||
var pk = new PK5
|
||||
{
|
||||
Species = Species,
|
||||
Form = Form,
|
||||
CurrentLevel = LevelMin,
|
||||
Met_Location = Location,
|
||||
Met_Level = LevelMin,
|
||||
|
|
|
@ -37,6 +37,7 @@ public sealed record EncounterStatic5Entree(GameVersion Version, ushort Species,
|
|||
var pk = new PK5
|
||||
{
|
||||
Species = Species,
|
||||
Form = Form,
|
||||
CurrentLevel = Level,
|
||||
Met_Location = Location,
|
||||
Met_Level = Level,
|
||||
|
|
|
@ -33,6 +33,7 @@ public sealed record EncounterStatic5Radar(ushort Species, byte Form, AbilityPer
|
|||
var pk = new PK5
|
||||
{
|
||||
Species = Species,
|
||||
Form = Form,
|
||||
CurrentLevel = LevelMin,
|
||||
Met_Location = Location,
|
||||
Met_Level = LevelMin,
|
||||
|
|
|
@ -71,6 +71,7 @@ public sealed record EncounterTrade5B2W2 : IEncounterable, IEncounterMatch, IFix
|
|||
{
|
||||
PID = Util.Rand32(),
|
||||
Species = Species,
|
||||
Form = Form,
|
||||
CurrentLevel = Level,
|
||||
Met_Location = Location,
|
||||
Met_Level = Level,
|
||||
|
|
|
@ -72,6 +72,7 @@ public sealed record EncounterTrade5BW : IEncounterable, IEncounterMatch, IFixed
|
|||
{
|
||||
PID = PID,
|
||||
Species = Species,
|
||||
Form = Form,
|
||||
CurrentLevel = Level,
|
||||
Met_Location = Location,
|
||||
Met_Level = Level,
|
||||
|
|
|
@ -56,6 +56,7 @@ public sealed record EncounterStatic6(GameVersion Version)
|
|||
{
|
||||
EncryptionConstant = Util.Rand32(),
|
||||
Species = Species,
|
||||
Form = Form,
|
||||
CurrentLevel = LevelMin,
|
||||
Met_Location = Location,
|
||||
Met_Level = LevelMin,
|
||||
|
|
|
@ -39,6 +39,7 @@ public sealed record EncounterStatic7b(GameVersion Version)
|
|||
var pk = new PB7
|
||||
{
|
||||
Species = Species,
|
||||
Form = Form,
|
||||
CurrentLevel = LevelMin,
|
||||
OT_Friendship = PersonalTable.GG[Species, Form].BaseFriendship,
|
||||
Met_Location = Location,
|
||||
|
|
|
@ -77,6 +77,7 @@ public sealed record EncounterStatic8(GameVersion Version = GameVersion.SWSH)
|
|||
var pk = new PK8
|
||||
{
|
||||
Species = Species,
|
||||
Form = Form,
|
||||
CurrentLevel = Level,
|
||||
Met_Location = Location,
|
||||
Met_Level = Level,
|
||||
|
@ -112,22 +113,22 @@ public sealed record EncounterStatic8(GameVersion Version = GameVersion.SWSH)
|
|||
if (Weather is AreaWeather8.Heavy_Fog && EncounterArea8.IsBoostedArea60Fog(Location))
|
||||
pk.CurrentLevel = pk.Met_Level = EncounterArea8.BoostLevel;
|
||||
|
||||
var pi = PersonalTable.SWSH[Species, Form];
|
||||
pk.RefreshAbility(criteria.GetAbilityFromNumber(Ability));
|
||||
pk.Nature = pk.StatNature = (int)criteria.GetNature(Nature.Random);
|
||||
pk.Gender = criteria.GetGender(-1, pi);
|
||||
|
||||
var req = GetRequirement(pk);
|
||||
if (req != MustHave)
|
||||
{
|
||||
var pi = PersonalTable.SWSH[Species, Form];
|
||||
var rand = Util.Rand;
|
||||
pk.EncryptionConstant = rand.Rand32();
|
||||
pk.PID = rand.Rand32();
|
||||
criteria.SetRandomIVs(pk);
|
||||
pk.Gender = criteria.GetGender(-1, pi);
|
||||
pk.Nature = pk.StatNature = (int)criteria.GetNature(Nature.Random);
|
||||
pk.RefreshAbility(criteria.GetAbilityFromNumber(Ability));
|
||||
return;
|
||||
}
|
||||
var shiny = Shiny == Shiny.Random ? Shiny.FixedValue : Shiny;
|
||||
Overworld8RNG.ApplyDetails(pk, criteria, shiny, FlawlessIVCount);
|
||||
pk.RefreshAbility(criteria.GetAbilityFromNumber(Ability));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -53,6 +53,7 @@ public abstract record EncounterStatic8Nest<T>(GameVersion Version)
|
|||
var pk = new PK8
|
||||
{
|
||||
Species = Species,
|
||||
Form = Form,
|
||||
CurrentLevel = Level,
|
||||
Met_Location = GetLocation(),
|
||||
Met_Level = Level,
|
||||
|
|
|
@ -66,6 +66,7 @@ public sealed record EncounterTrade9
|
|||
var pk = new PK9
|
||||
{
|
||||
Species = Species,
|
||||
Form = Form,
|
||||
CurrentLevel = Level,
|
||||
Met_Location = Location,
|
||||
Met_Level = Level,
|
||||
|
|
Loading…
Reference in a new issue