Update xd fateful flag leniency

not enough documentation to know what every single flag does; just be
lenient

I assume that flags being present XK3->PK3 will set fateful, so we could
remove that logic...
Exposing bitflags for editing isn't fun for the editor, so just ignore
it behind the fateful bool get/set.

fateful required for all xk3 origin

#2289
This commit is contained in:
Kurt 2019-05-14 20:14:15 -07:00
parent 555e81205d
commit 1d44136e54
2 changed files with 12 additions and 12 deletions

View file

@ -244,15 +244,6 @@ namespace PKHeX.Core
private static void VerifyFatefulIngameActive(LegalityAnalysis data)
{
var pkm = data.pkm;
if (pkm.Version == 15 && pkm is XK3 xk3 && data.Info.WasXD)
{
// can't have fateful until traded away, which clears ShadowID
if (xk3.FatefulEncounter && xk3.ShadowID != 0 && data.EncounterMatch is EncounterStaticShadow)
data.AddLine(GetInvalid(LFatefulInvalid, Fateful));
return; // fateful is set when transferred away
}
var result = pkm.FatefulEncounter
? GetValid(LFateful, Fateful)
: GetInvalid(LFatefulMissing, Fateful);

View file

@ -69,14 +69,23 @@ namespace PKHeX.Core
public override uint PID { get => BigEndian.ToUInt32(Data, 0x28); set => BigEndian.GetBytes(value).CopyTo(Data, 0x28); }
// 0x2A-0x2B Unknown
// 0x2C-0x2F Battle Related
// public bool Obedient { get => Data[0x30] == 1; set => Data[0x30] = (byte)(value ? 1 : 0); }
public bool Obedient { get => Data[0x30] == 1; set => Data[0x30] = (byte)(value ? 1 : 0); }
// 0x31-0x32 Unknown
public int EncounterInfo { get => Data[0x33]; set => Data[0x33] = (byte)value; }
public override bool FatefulEncounter
{
get => (EncounterInfo & 1) == 1;
set => EncounterInfo = (byte)((EncounterInfo & ~(1 << 0)) | (value ? 1 << 0 : 0));
get => EncounterInfo != 0 || Obedient;
set
{
if (EncounterInfo != 0)
{
if (!value)
EncounterInfo = 0;
return;
}
EncounterInfo = (byte) ((EncounterInfo & ~(1 << 0)) | (value ? 1 << 0 : 0));
}
}
public override int Version { get => GetGBAVersionID(Data[0x34]); set => Data[0x34] = GetGCVersionID(value); }