public void UpdateStats() { if (UpdatingFields) { return; } UpdatingFields = true; for (int i = 0; i < 6; i++) { if (Util.ToInt32(tb_iv[i].Text) > 31) { tb_iv[i].Text = "31"; } if (Util.ToInt32(tb_ev[i].Text) > 255) { tb_ev[i].Text = "255"; } if (Util.ToInt32(tb_av[i].Text) > 200) { tb_av[i].Text = "200"; } } UpdatingFields = false; var pi = Personal.GetFormeEntry(PKM.Species, PKM.Form); var stats = PKM.GetStats(pi); Stat_HP.Text = stats[0].ToString(); Stat_ATK.Text = stats[1].ToString(); Stat_DEF.Text = stats[2].ToString(); Stat_SPA.Text = stats[4].ToString(); Stat_SPD.Text = stats[5].ToString(); Stat_SPE.Text = stats[3].ToString(); TB_IVTotal.Text = tb_iv.Select(z => Util.ToInt32(z.Text)).Sum().ToString(); TB_EVTotal.Text = tb_ev.Select(z => Util.ToInt32(z.Text)).Sum().ToString(); if (PKM is IAwakened s) { TB_AVTotal.Text = s.AwakeningSum().ToString(); } // Recolor the Stat Labels based on boosted stats. RecolorStatLabels(); UpdatingFields = true; CB_HPType.SelectedIndex = PKM.HiddenPowerType; UpdatingFields = false; }