From 6f2a705479733af3edc90832f43da1ed5c7e0fce Mon Sep 17 00:00:00 2001 From: Gary Krige Date: Wed, 28 Jan 2015 21:58:36 +0200 Subject: [PATCH] Update scoring.js Fix verbose code --- script/scoring.js | 33 ++++++++------------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/script/scoring.js b/script/scoring.js index f6c527c..e9f957d 100644 --- a/script/scoring.js +++ b/script/scoring.js @@ -11,30 +11,13 @@ var Score = { calculateScore : function() { var scoreUnadded = Prestige.getStores(false); var fullScore = 0; - fullScore = fullScore + scoreUnadded[0] * 1; - fullScore = fullScore + scoreUnadded[1] * 1.5; - fullScore = fullScore + scoreUnadded[2] * 1; - fullScore = fullScore + scoreUnadded[3] * 2; - fullScore = fullScore + scoreUnadded[4] * 2; - fullScore = fullScore + scoreUnadded[5] * 3; - fullScore = fullScore + scoreUnadded[6] * 3; - fullScore = fullScore + scoreUnadded[7] * 2; - fullScore = fullScore + scoreUnadded[8] * 2; - fullScore = fullScore + scoreUnadded[9] * 2; - fullScore = fullScore + scoreUnadded[10] * 2; - fullScore = fullScore + scoreUnadded[11] * 1.5; - fullScore = fullScore + scoreUnadded[12] * 1; - fullScore = fullScore + scoreUnadded[13] * 1; - fullScore = fullScore + scoreUnadded[14] * 10; - fullScore = fullScore + scoreUnadded[15] * 30; - fullScore = fullScore + scoreUnadded[16] * 50; - fullScore = fullScore + scoreUnadded[17] * 100; - fullScore = fullScore + scoreUnadded[18] * 150; - fullScore = fullScore + scoreUnadded[19] * 150; - fullScore = fullScore + scoreUnadded[20] * 3; - fullScore = fullScore + scoreUnadded[21] * 3; - fullScore = fullScore + scoreUnadded[22] * 5; - fullScore = fullScore + scoreUnadded[23] * 4; + + var factor = [1, 1.5, 1, 2, 2, 3, 3, 2, 2, 2, 2, 1.5, 1, + 1, 10, 30, 50, 100, 150, 150, 3, 3, 5, 4] + for(var i = 0; i< factor.length; i++){ + fullScore += scoreUnadded[i] * factor[i]; + } + fullScore = fullScore + $SM.get('stores["alien alloy"]', true) * 10; fullScore = fullScore + Ship.getMaxHull() * 50; return Math.floor(fullScore); @@ -47,4 +30,4 @@ var Score = { totalScore : function() { return $SM.get('previous.score', true) + Score.calculateScore(); } -}; \ No newline at end of file +};