mirror of
https://github.com/kwsch/PKHeX
synced 2024-09-20 22:32:00 +00:00
Misc iencounterable->pkm generator fixes
Still some pending stuff like bad mystery gifts gen2 static encounters on g/s applying met level and not location gen6 ralts trade (no nickname) being flagged as nicknamed when it shouldn't gen4 manaphy egg not having a hatch location (worked fine if you transferred it up) gen3 antishiny gifts not setting their PIDs (jirachi WC3) gen5 N's pkm gifts setting the wrong nature gen3 unown not being generated correctly, cosplay pikachu being allowed form0, non-BugCatchingContest no longer require Sport ball, oras dexnav marill now uses the azurill eggmove table
This commit is contained in:
parent
c2ec4d55e4
commit
6b472ffd62
13 changed files with 46 additions and 24 deletions
|
@ -208,7 +208,6 @@ namespace PKHeX.Core
|
|||
new EncounterStatic6 { Species = 425, Level = 45, Location = 348 }, // Drifloon
|
||||
new EncounterStatic6 { Species = 628, Level = 45, Location = 348 }, // Braviary
|
||||
|
||||
CosplayPikachu,
|
||||
PermuteCosplay(1),
|
||||
PermuteCosplay(2),
|
||||
PermuteCosplay(3),
|
||||
|
|
|
@ -131,7 +131,19 @@ namespace PKHeX.Core
|
|||
if (Area!.Type == SlotType.HiddenGrotto) // don't force hidden for DexNav
|
||||
ability = 2;
|
||||
|
||||
PIDGenerator.SetRandomWildPID(pk, pk.Format, nature, ability, gender);
|
||||
if (Generation == 3 && Species == (int) Core.Species.Unown)
|
||||
{
|
||||
do
|
||||
{
|
||||
PIDGenerator.SetRandomWildPID(pk, pk.Format, nature, ability, gender);
|
||||
ability ^= 1; // some nature-forms cannot have a certain PID-ability set, so just flip it as Unown doesn't have dual abilities.
|
||||
} while (pk.AltForm != Form);
|
||||
}
|
||||
else
|
||||
{
|
||||
PIDGenerator.SetRandomWildPID(pk, pk.Format, nature, ability, gender);
|
||||
}
|
||||
|
||||
pk.Gender = gender;
|
||||
pk.StatNature = nature;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,8 @@ namespace PKHeX.Core
|
|||
var pk6 = (PK6)pk;
|
||||
if (CanDexNav)
|
||||
{
|
||||
var eggMoves = MoveEgg.GetEggMoves(pk, Species, Form, Version);
|
||||
var baseSpec = EvoBase.GetBaseSpecies(pk);
|
||||
var eggMoves = MoveEgg.GetEggMoves(pk, baseSpec.Species, baseSpec.Form, Version);
|
||||
if (eggMoves.Length > 0)
|
||||
pk6.RelearnMove1 = eggMoves[Util.Rand.Next(eggMoves.Length)];
|
||||
}
|
||||
|
|
|
@ -82,9 +82,6 @@ namespace PKHeX.Core
|
|||
case PK3 pk3 when this is EncounterStaticShadow:
|
||||
pk3.RibbonNational = true;
|
||||
break;
|
||||
case PK4 pk4 when this is EncounterStaticTyped t:
|
||||
pk4.EncounterType = t.TypeEncounter.GetIndex();
|
||||
break;
|
||||
case PK6 pk6:
|
||||
pk6.SetRandomMemory6();
|
||||
break;
|
||||
|
|
|
@ -46,10 +46,12 @@ namespace PKHeX.Core
|
|||
|
||||
protected override void SetMetData(PKM pk, int level, DateTime today)
|
||||
{
|
||||
pk.Met_Location = Location;
|
||||
pk.Met_Level = level;
|
||||
if (Version == GameVersion.C && pk is PK2 pk2)
|
||||
pk2.Met_TimeOfDay = EncounterTime.Any.RandomValidTime();
|
||||
if (Version != GameVersion.C)
|
||||
return;
|
||||
var pk2 = (PK2)pk;
|
||||
pk2.Met_Location = Location;
|
||||
pk2.Met_Level = level;
|
||||
pk2.Met_TimeOfDay = EncounterTime.Any.RandomValidTime();
|
||||
}
|
||||
|
||||
protected override bool IsMatchLevel(PKM pkm, DexLevel evo)
|
||||
|
|
|
@ -11,15 +11,14 @@
|
|||
protected override void SetPINGA(PKM pk, EncounterCriteria criteria)
|
||||
{
|
||||
int gender = criteria.GetGender(PKX.GetGenderFromPID(Species, PID), pk.PersonalInfo);
|
||||
int nature = (int)(PID % 25);
|
||||
int nature = (int)Nature;
|
||||
int ability = Ability;
|
||||
|
||||
pk.PID = PID;
|
||||
pk.Gender = gender;
|
||||
SetIVs(pk);
|
||||
|
||||
if (Generation >= 5)
|
||||
pk.Nature = nature;
|
||||
pk.Nature = nature;
|
||||
pk.RefreshAbility(ability >> 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,15 @@ namespace PKHeX.Core
|
|||
return locs.Contains(pkm.Met_Location);
|
||||
}
|
||||
|
||||
protected override void SetMetData(PKM pk, int level, DateTime today)
|
||||
{
|
||||
var pk4 = (PK4)pk;
|
||||
var type = pk4.EncounterType = TypeEncounter.GetIndex();
|
||||
pk.Met_Location = Roaming ? GetRoamLocations(Species, type)[0] : Location;
|
||||
pk.Met_Level = level;
|
||||
pk.MetDate = today;
|
||||
}
|
||||
|
||||
private int[] GetRoamLocations(int species, int type)
|
||||
{
|
||||
switch (species)
|
||||
|
|
|
@ -59,7 +59,7 @@ namespace PKHeX.Core
|
|||
public IReadOnlyList<string> TrainerNames { get; internal set; } = Array.Empty<string>();
|
||||
public string GetNickname(int language) => (uint)language < Nicknames.Count ? Nicknames[language] : string.Empty;
|
||||
public string GetOT(int language) => (uint)language < TrainerNames.Count ? TrainerNames[language] : string.Empty;
|
||||
public bool HasNickname => Nicknames.Count != 0;
|
||||
public bool HasNickname => Nicknames.Count != 0 && IsNicknamed;
|
||||
public bool HasTrainerName => TrainerNames.Count != 0;
|
||||
|
||||
private static readonly int[] DefaultMetLocation =
|
||||
|
@ -103,7 +103,7 @@ namespace PKHeX.Core
|
|||
pk.Language = lang;
|
||||
pk.OT_Name = pk.Format == 1 ? StringConverter12.G1TradeOTStr : HasTrainerName ? GetOT(lang) : sav.OT;
|
||||
pk.OT_Gender = HasTrainerName ? Math.Max(0, OTGender) : sav.Gender;
|
||||
pk.SetNickname(GetNickname(lang));
|
||||
pk.SetNickname(HasNickname ? GetNickname(lang) : string.Empty);
|
||||
|
||||
pk.CurrentLevel = level;
|
||||
pk.Version = (int) version;
|
||||
|
@ -121,6 +121,10 @@ namespace PKHeX.Core
|
|||
var location = Location > 0 ? Location : DefaultMetLocation[Generation - 1];
|
||||
SetMetData(pk, level, location, time);
|
||||
}
|
||||
else
|
||||
{
|
||||
pk.OT_Gender = 0;
|
||||
}
|
||||
|
||||
if (EggLocation != 0)
|
||||
SetEggMetData(pk, time);
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace PKHeX.Core
|
|||
private static bool IsDeferredWurmple(this IEncounterable slot, int currentSpecies, PKM pkm) => slot.Species == (int)Species.Wurmple && currentSpecies != (int)Species.Wurmple && !WurmpleUtil.IsWurmpleEvoValid(pkm);
|
||||
private static bool IsDeferredSafari3(this ILocation slot, bool IsSafariBall) => IsSafariBall != Locations.IsSafariZoneLocation3(slot.Location);
|
||||
private static bool IsDeferredSafari4(this ILocation slot, bool IsSafariBall) => IsSafariBall != Locations.IsSafariZoneLocation4(slot.Location);
|
||||
private static bool IsDeferredSport(this ILocation slot, bool IsSportBall) => IsSportBall != (slot.Location == Locations.BugCatchingContest4);
|
||||
private static bool IsDeferredSport(this EncounterSlot slot, bool IsSportBall) => IsSportBall != (slot.Area.Type == SlotType.BugContest);
|
||||
private static bool IsDeferredHiddenAbility(this EncounterSlot slot, bool IsHidden) => IsHidden && !slot.IsHiddenAbilitySlot();
|
||||
|
||||
public static IEnumerable<EncounterArea> GetEncounterSlots(PKM pkm, GameVersion gameSource = GameVersion.Any)
|
||||
|
|
|
@ -157,10 +157,12 @@ namespace PKHeX.Core
|
|||
case PIDType.BACD_R:
|
||||
case PIDType.BACD_R_A:
|
||||
case PIDType.BACD_R_S:
|
||||
case PIDType.BACD_R_AX:
|
||||
return (pk, seed) => SetValuesFromSeedBACD(pk, t, seed & 0xFFFF);
|
||||
case PIDType.BACD_U:
|
||||
case PIDType.BACD_U_A:
|
||||
case PIDType.BACD_U_S:
|
||||
case PIDType.BACD_U_AX:
|
||||
return (pk, seed) => SetValuesFromSeedBACD(pk, t, seed);
|
||||
|
||||
case PIDType.PokeSpot:
|
||||
|
|
|
@ -267,10 +267,10 @@ namespace PKHeX.Core
|
|||
case WC8 wc8 when !wc8.CanBeReceivedByVersion(pkm.Version) && !pkm.WasTradedEgg:
|
||||
data.AddLine(GetInvalid(LEncGiftVersionNotDistributed, GameOrigin));
|
||||
return;
|
||||
case WC6 wc6 when wc6.RestrictLanguage != 0 && wc6.Language != wc6.RestrictLanguage:
|
||||
case WC6 wc6 when wc6.RestrictLanguage != 0 && pkm.Language != wc6.RestrictLanguage:
|
||||
data.AddLine(GetInvalid(string.Format(LOTLanguage, wc6.RestrictLanguage, pkm.Language), CheckIdentifier.Language));
|
||||
return;
|
||||
case WC7 wc7 when wc7.RestrictLanguage != 0 && wc7.Language != wc7.RestrictLanguage:
|
||||
case WC7 wc7 when wc7.RestrictLanguage != 0 && pkm.Language != wc7.RestrictLanguage:
|
||||
data.AddLine(GetInvalid(string.Format(LOTLanguage, wc7.RestrictLanguage, pkm.Language), CheckIdentifier.Language));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -181,6 +181,7 @@ namespace PKHeX.Core
|
|||
pk4.Version = 10; // Diamond
|
||||
pk4.Language = (int)LanguageID.English; // English
|
||||
pk4.Nickname = "MANAPHY";
|
||||
pk4.Met_Location = Locations.HatchLocationDPPt;
|
||||
pk4.Egg_Location = 1; // Ranger (will be +3000 later)
|
||||
pk4.Move1_PP = pk4.GetMovePP(pk4.Move1, 0);
|
||||
pk4.Move2_PP = pk4.GetMovePP(pk4.Move2, 0);
|
||||
|
|
|
@ -736,11 +736,7 @@ namespace PKHeX.Core
|
|||
AbilityNumber = 1 << n;
|
||||
int[] abilities = PersonalInfo.Abilities;
|
||||
if ((uint)n < abilities.Length)
|
||||
{
|
||||
if (abilities[n] == abilities[0])
|
||||
n = 0;
|
||||
Ability = abilities[n];
|
||||
}
|
||||
if (this is PK5 pk5)
|
||||
pk5.HiddenAbility = n == 2;
|
||||
}
|
||||
|
@ -1049,10 +1045,10 @@ namespace PKHeX.Core
|
|||
return 3;
|
||||
if (XY)
|
||||
{
|
||||
if (Met_Location == 148 && Met_Level == 30) // Friend Safari
|
||||
return 2;
|
||||
if (PersonalInfo.EggGroup1 == 15) // Undiscovered
|
||||
return 3;
|
||||
if (Met_Location == 148 && Met_Level == 30) // Friend Safari
|
||||
return 2;
|
||||
}
|
||||
if (VC)
|
||||
return Species == (int)Core.Species.Mew || Species == (int)Core.Species.Celebi ? 5 : 3;
|
||||
|
|
Loading…
Reference in a new issue