diff --git a/PKHeX.Core/Legality/Structures/MoveType.cs b/PKHeX.Core/Legality/Structures/MoveType.cs index e574d5e3d..bc2bfe463 100644 --- a/PKHeX.Core/Legality/Structures/MoveType.cs +++ b/PKHeX.Core/Legality/Structures/MoveType.cs @@ -22,4 +22,24 @@ public enum MoveType Dark, Fairy, } + + public static partial class Extensions + { + public static MoveType GetMoveTypeGeneration(this MoveType type, int generation) + { + if (generation <= 2) + return GetMoveTypeFromG12(type); + return type; + } + private static MoveType GetMoveTypeFromG12(this MoveType type) + { + if (type <= MoveType.Rock) + return type; + type -= 1; // Bird + if (type <= MoveType.Steel) + return type; + type -= 10; // 10 Normal duplicates + return type; + } + } } diff --git a/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs b/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs index 60ce44ee2..7ffc7a762 100644 --- a/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs +++ b/PKHeX.Core/PersonalInfo/PersonalInfoG2.cs @@ -28,8 +28,8 @@ public override byte[] Write() public override int SPE { get => Data[0x04]; set => Data[0x04] = (byte)value; } public override int SPA { get => Data[0x05]; set => Data[0x05] = (byte)value; } public override int SPD { get => Data[0x06]; set => Data[0x06] = (byte)value; } - public override int Type1 { get => Data[0x06]; set => Data[0x06] = (byte)value; } - public override int Type2 { get => Data[0x07]; set => Data[0x07] = (byte)value; } + public override int Type1 { get => Data[0x07]; set => Data[0x07] = (byte)value; } + public override int Type2 { get => Data[0x08]; set => Data[0x08] = (byte)value; } public override int CatchRate { get => Data[0x09]; set => Data[0x09] = (byte)value; } public override int BaseEXP { get => Data[0x0A]; set => Data[0x0A] = (byte)value; } public int Item1 { get => Data[0xB]; set => Data[0xB] = (byte)value; } diff --git a/PKHeX.WinForms/Subforms/KChart.cs b/PKHeX.WinForms/Subforms/KChart.cs index 8b11f6770..95e907be6 100644 --- a/PKHeX.WinForms/Subforms/KChart.cs +++ b/PKHeX.WinForms/Subforms/KChart.cs @@ -53,10 +53,10 @@ private void PopEntry(int index) row.Cells[r++].Value = PKMUtil.GetSprite(s, f, 0, 0, false, false, SAV.Generation); row.Cells[r++].Value = species[index]; row.Cells[r++].Value = s > 721 || Legal.PastGenAlolanNatives.Contains(s); - row.Cells[r].Style.BackColor = MapColor((int)((p.BST - 175) / 3f)); + row.Cells[r].Style.BackColor = MapColor((int)((Math.Max(p.BST - 175, 0)) / 3f)); row.Cells[r++].Value = p.BST.ToString("000"); - row.Cells[r++].Value = PKMUtil.GetTypeSprite(p.Types[0]); - row.Cells[r++].Value = p.Types[0] == p.Types[1] ? Resources.slotTrans : PKMUtil.GetTypeSprite(p.Types[1]); + row.Cells[r++].Value = PKMUtil.GetTypeSprite((int)((MoveType)p.Types[0]).GetMoveTypeGeneration(SAV.Generation)); + row.Cells[r++].Value = p.Types[0] == p.Types[1] ? Resources.slotTrans : PKMUtil.GetTypeSprite((int)((MoveType)p.Types[1]).GetMoveTypeGeneration(SAV.Generation)); row.Cells[r].Style.BackColor = MapColor(p.HP); row.Cells[r++].Value = p.HP.ToString("000"); row.Cells[r].Style.BackColor = MapColor(p.ATK); @@ -71,7 +71,7 @@ private void PopEntry(int index) row.Cells[r++].Value = p.SPE.ToString("000"); row.Cells[r++].Value = abilities[p.Abilities[0]]; row.Cells[r++].Value = abilities[p.Abilities[1]]; - row.Cells[r].Value = abilities[p.Abilities[2]]; + row.Cells[r].Value = abilities[p.Abilities.Length <= 2 ? 0 : p.Abilities[2]]; DGV.Rows.Add(row); } private static Color MapColor(int v)