Handle incorrect bred stunfisk local form value

The game uses 0x5E if 0x5A+everstone, otherwise it uses 0x58
For determining the seed species-form, we want to use everstone breeds as that resolves to the correct species-form values.

Co-Authored-By: Lusamine <30205550+Lusamine@users.noreply.github.com>
Co-Authored-By: Marty-D <1645989+Marty-D@users.noreply.github.com>
This commit is contained in:
Kurt 2020-10-08 13:12:25 -07:00
parent 482dbf0b17
commit 0de76b57b1
3 changed files with 13 additions and 13 deletions

View file

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
namespace PKHeX.Core
{

View file

@ -112,13 +112,8 @@ namespace PKHeX.Core
return false;
var table = PersonalTable.SWSH;
var entry = (PersonalInfoSWSH)table.GetFormeEntry(pkm.Species, pkm.AltForm);
var baseSpecies = entry.BaseSpecies;
var baseForm = entry.FormIndex;
// since we aren't storing entry->seed_poke_index, there's oddballs we can't handle with just personal data (?)
if (pkm.Species == (int)Species.Indeedee)
baseForm = pkm.AltForm;
var baseSpecies = entry.HatchSpecies;
var baseForm = entry.HatchFormIndexEverstone;
var egg = GetEggMoves(8, baseSpecies, baseForm, GameVersion.SW);
return Array.Exists(egg, z => z == move);
}

View file

@ -117,12 +117,18 @@ namespace PKHeX.Core
public int Species { get => BitConverter.ToUInt16(Data, 0x4C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x4C); }
public int BaseSpecies { get => BitConverter.ToUInt16(Data, 0x56); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x56); }
public int BaseSpeciesForm { get => BitConverter.ToUInt16(Data, 0x58); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x58); } // local region base form
public int Flags { get => BitConverter.ToUInt16(Data, 0x5A); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5A); } // not sure
public int HatchSpecies { get => BitConverter.ToUInt16(Data, 0x56); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x56); }
public int LocalFormIndex { get => BitConverter.ToUInt16(Data, 0x58); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x58); } // local region base form
public ushort RegionalFlags { get => BitConverter.ToUInt16(Data, 0x5A); set => BitConverter.GetBytes(value).CopyTo(Data, 0x5A); }
public bool IsRegionalForm { get => (RegionalFlags & 1) == 1; set => BitConverter.GetBytes((ushort)((RegionalFlags & 0xFFFE) | (value ? 1 : 0))).CopyTo(Data, 0x5A); }
public int PokeDexIndex { get => BitConverter.ToUInt16(Data, 0x5C); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5C); }
public int FormIndex { get => BitConverter.ToUInt16(Data, 0x5E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5E); } // form index of this entry
public int RegionalFormIndex { get => BitConverter.ToUInt16(Data, 0x5E); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0x5E); } // form index of this entry
public int ArmorDexIndex { get => BitConverter.ToUInt16(Data, 0xAC); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xAC); }
public int CrownDexIndex { get => BitConverter.ToUInt16(Data, 0xAE); set => BitConverter.GetBytes((ushort)value).CopyTo(Data, 0xAE); }
/// <summary>
/// Gets the Forme that any offspring will hatch with, assuming it is holding an Everstone.
/// </summary>
public int HatchFormIndexEverstone => IsRegionalForm ? RegionalFormIndex : LocalFormIndex;
}
}
}