From 785dfca0a66ae1256f05cf10e49ade2cb1524e9c Mon Sep 17 00:00:00 2001 From: Greg Edwards Date: Tue, 31 Dec 2019 02:38:17 -0500 Subject: [PATCH] Attempted fix of #72 by using byte 0x41 for nature instead of PV. --- library/Structures/Pokemon5.cs | 11 ++++++++++- library/Structures/PokemonBase.cs | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/library/Structures/Pokemon5.cs b/library/Structures/Pokemon5.cs index ff332c9f..33a43490 100644 --- a/library/Structures/Pokemon5.cs +++ b/library/Structures/Pokemon5.cs @@ -105,7 +105,7 @@ namespace PkmnFoundations.Structures m_genderless = (forme & 0x04) != 0; FormID = (byte)(forme >> 3); - byte nature = block[25]; // todo: which nature is real? Do they both need to match? + m_nature = block[25]; // todo: which nature is real? Do they both need to match? m_bw_flags = BitConverter.ToUInt16(block, 26); HiddenAbility = (m_bw_flags & 0x01) != 0; N = (m_bw_flags & 0x02) != 0; @@ -184,6 +184,15 @@ namespace PkmnFoundations.Structures get { return Generations.Generation5; } } + private byte m_nature; + public override Natures Nature + { + get + { + return (Natures)(m_nature % 25u); + } + } + private ushort m_bw_flags; public bool HiddenAbility { get; set; } public bool N { get; set; } diff --git a/library/Structures/PokemonBase.cs b/library/Structures/PokemonBase.cs index d315965f..42834da4 100644 --- a/library/Structures/PokemonBase.cs +++ b/library/Structures/PokemonBase.cs @@ -123,7 +123,7 @@ namespace PkmnFoundations.Structures public IList Moves { get { return m_moves; } } public uint TrainerID { get; set; } public uint Personality { get; set; } - public Natures Nature { get { return (Natures)(Personality % 25u); } } + public virtual Natures Nature { get { return (Natures)(Personality % 25u); } } public byte Happiness { get; set; } public Languages Language { get; set; } public IvStatValues IVs { get; set; }