mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 12:33:06 +00:00
Merge pull request #1 from kwsch/master
Update from upstream repo kwsch/PKHeX
This commit is contained in:
commit
2e64df7b6e
6 changed files with 25 additions and 10 deletions
|
@ -122,6 +122,7 @@ namespace PKHeX.Core
|
|||
if (!pkm.IsOriginValid)
|
||||
{ AddLine(Severity.Invalid, V187, CheckIdentifier.None); return; }
|
||||
|
||||
verifyPreRelearn();
|
||||
updateEncounterChain();
|
||||
updateMoveLegality();
|
||||
updateEncounterInfo();
|
||||
|
@ -134,6 +135,7 @@ namespace PKHeX.Core
|
|||
if (!pkm.IsOriginValid)
|
||||
{ AddLine(Severity.Invalid, V187, CheckIdentifier.None); return; }
|
||||
|
||||
verifyPreRelearn();
|
||||
updateEncounterChain();
|
||||
updateMoveLegality();
|
||||
updateEncounterInfo();
|
||||
|
|
|
@ -241,7 +241,7 @@ namespace PKHeX.Core
|
|||
{
|
||||
// Can't have another language name if it hasn't evolved or wasn't a language-traded egg.
|
||||
bool match = PKX.getSpeciesNameGeneration(pkm.Species, pkm.Language, pkm.Format) == nickname;
|
||||
match |= (pkm.WasTradedEgg || Legal.getHasEvolved(pkm)) && PKX.getIsNicknamedAnyLanguage(pkm.Species, nickname, pkm.Format);
|
||||
match |= (pkm.WasTradedEgg || Legal.getHasEvolved(pkm)) && !PKX.getIsNicknamedAnyLanguage(pkm.Species, nickname, pkm.Format);
|
||||
|
||||
if (!match)
|
||||
{
|
||||
|
@ -1107,7 +1107,7 @@ namespace PKHeX.Core
|
|||
|
||||
if (3 <= pkm.Format && pkm.Format <= 5) // 3-5
|
||||
{
|
||||
if (pkm.Version != (int) GameVersion.CXD && abilities[0] != abilities[1] && pkm.PIDAbility != abilval)
|
||||
if (pkm.Version != (int) GameVersion.CXD && abilities[0] != abilities[1] && pkm.AbilityNumber != 1 << abilval)
|
||||
{
|
||||
AddLine(Severity.Invalid, V113, CheckIdentifier.Ability);
|
||||
return;
|
||||
|
@ -2149,6 +2149,16 @@ namespace PKHeX.Core
|
|||
return res;
|
||||
}
|
||||
|
||||
private void verifyPreRelearn()
|
||||
{
|
||||
// For origins prior to relearn moves, need to try to match a mystery gift if applicable.
|
||||
|
||||
if (pkm.WasEvent || pkm.WasEventEgg)
|
||||
{
|
||||
EventGiftMatch = new List<MysteryGift>(Legal.getValidGifts(pkm));
|
||||
EncounterMatch = EventGiftMatch.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
private CheckResult[] verifyRelearn()
|
||||
{
|
||||
RelearnBase = null;
|
||||
|
|
|
@ -1071,13 +1071,13 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (pkm.Egg_Location == 0) // Not Egg
|
||||
{
|
||||
if (wc.CardID != pkm.SID) continue;
|
||||
if (wc.SID != pkm.SID) continue;
|
||||
if (wc.TID != pkm.TID) continue;
|
||||
if (wc.OT != pkm.OT_Name) continue;
|
||||
if (wc.OTGender != pkm.OT_Gender) continue;
|
||||
if (wc.PIDType == 0 && pkm.PID != wc.PID) continue;
|
||||
if (wc.PID != 0 && pkm.PID != wc.PID) continue;
|
||||
if (wc.PIDType == 0 && pkm.IsShiny) continue;
|
||||
if (wc.PIDType == 2 && !pkm.IsShiny) continue;
|
||||
if (wc.PIDType == 3 && pkm.IsShiny) continue;
|
||||
if (wc.OriginGame != 0 && wc.OriginGame != pkm.Version) continue;
|
||||
if (wc.Language != 0 && wc.Language != pkm.Language) continue;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace PKHeX.Core
|
|||
public override int Nature { get { return (int)(PID%25); } set { } }
|
||||
public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } }
|
||||
public override int CurrentHandler { get { return 0; } set { } }
|
||||
public override int AbilityNumber { get { return 1 << PIDAbility; } set { } }
|
||||
|
||||
// Structure
|
||||
public override uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace PKHeX.Core
|
|||
public override uint EncryptionConstant { get { return PID; } set { } }
|
||||
public override int CurrentFriendship { get { return OT_Friendship; } set { OT_Friendship = value; } }
|
||||
public override int CurrentHandler { get { return 0; } set { } }
|
||||
public override int AbilityNumber { get { return HiddenAbility ? 4 : 1 << PIDAbility; } set { } }
|
||||
|
||||
// Structure
|
||||
public override uint PID { get { return BitConverter.ToUInt32(Data, 0x00); } set { BitConverter.GetBytes(value).CopyTo(Data, 0x00); } }
|
||||
|
|
|
@ -360,9 +360,10 @@ namespace PKHeX.Core
|
|||
{
|
||||
if (GenNumber > 5 || Format > 5)
|
||||
return -1;
|
||||
if (GenNumber == 5)
|
||||
return (int)((PID >> 16) & 1);
|
||||
return (int)(PID & 1);
|
||||
|
||||
if (Version == (int) GameVersion.CXD)
|
||||
return Array.IndexOf(PersonalInfo.Abilities, Ability);
|
||||
return (int)((GenNumber == 5 ? PID >> 16 : PID) & 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue