mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-09 04:24:36 -05: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
|
|
@ -208,7 +208,6 @@ static Encounters6()
|
|||
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 @@ protected virtual void SetPINGA(PKM pk, EncounterCriteria criteria)
|
|||
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 @@ protected override void SetFormatSpecificData(PKM pk)
|
|||
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 @@ public PKM ConvertToPKM(ITrainerInfo sav, EncounterCriteria criteria)
|
|||
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 @@ protected override bool IsMatchEggLocation(PKM pkm)
|
|||
|
||||
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 @@ internal sealed class EncounterStatic5N : EncounterStatic5
|
|||
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 @@ protected override bool IsMatchLocation(PKM pkm)
|
|||
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 @@ public int TID7
|
|||
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 @@ protected virtual void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria
|
|||
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 @@ protected virtual void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria
|
|||
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 @@ private static bool IsDeferred(this EncounterSlot slot, int currentSpecies, PKM
|
|||
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 @@ public static void SetValuesFromSeed(PKM pk, PIDType type, uint seed)
|
|||
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 @@ private static void VerifyReceivability(LegalityAnalysis data, MysteryGift g)
|
|||
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 @@ private static void SetDefaultManaphyEggDetails(PK4 pk4)
|
|||
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 @@ public void RefreshAbility(int n)
|
|||
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 @@ public int GetFlawlessIVCount()
|
|||
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 New Issue
Block a user