From 38aa6bcf425c63399d5978324e0446d600fbecfb Mon Sep 17 00:00:00 2001 From: Eric Fredricksen Date: Mon, 12 Jul 2010 13:47:27 -0700 Subject: [PATCH] Dont use UI in WinStat --- main.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/main.js b/main.js index cd38724..bd82f43 100644 --- a/main.js +++ b/main.js @@ -601,21 +601,21 @@ function Square(x) { return x * x; } function WinStat() { var i; if (Odds(1,2)) { - i = Stats.rows().eq(Random(Stats.length())); + i = Pick(K.Stats); } else { // Favor the best stat so it will tend to clump var t = 0; - Stats.rows().each(function (index,elt) { - t += Square(StrToInt(Value(this))); + $.each(K.Stats, function (index, key) { + t += Square(GetI(Stats, key)); }); t = Random(t); - Stats.rows().each(function (index,elt) { - i = this; - t -= Square(StrToInt(Value(this))); - return t < 0; + $.each(K.Stats, function (index, key) { + i = key; + t -= Square(GetI(Stats, key)); + if (t < 0) return false; }); } - Add(Stats, Key(i), 1); + Add(Stats, i, 1); } function SpecialItem() {