mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-07-13 02:40:49 -05:00
Fix KChart errors
gen1 & gen2 types aren't laid out contiguously (yay bird type and extra types) fix gen2 type accessors looking at the wrong byte type sprites now load correctly, and 3rd ability no longer throws an error (forced to None).
This commit is contained in:
parent
1aa70a16a4
commit
f55028c1a0
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user