diff --git a/imports/api/HandScoreCalculator.js b/imports/api/HandScoreCalculator.js index b4cbd7c..48718fd 100644 --- a/imports/api/HandScoreCalculator.js +++ b/imports/api/HandScoreCalculator.js @@ -31,7 +31,7 @@ function jpn_dealin_delta(points, loserWind, riichiSticks) { let winds = {}; - Constants.WINDS.forEach(w => {winds[w] = 0}); + Constants.WINDS.forEach(w => winds[w] = 0); let handValue; let bonusPoints = bonus * Constants.JPN_BONUS_POINTS; @@ -42,7 +42,7 @@ function jpn_dealin_delta(points, // Check to see if you have to count basic points if (points < 5) { if (fu === 20 || (points === 1 && fu === 25)) { - throw TypeError("Invalid points/fu combination"); + throw RangeError("Invalid points/fu combination"); } else { // Calculate hand value, if it's above a mangan, cap it there let manganPayout = Constants.JPN_MANGAN_BASE_POINTS * multiplier; @@ -74,17 +74,14 @@ function jpn_dealin_delta(points, */ function jpn_selfdraw_delta(points, fu, bonus, dealerWind, winnerWind, riichiSticks) { let winds = {}; - Constants.WINDS.forEach(w => {winds[w] = 0}); - let basicPoints; - let nonDealerPays; - let dealerPays; - let currentBonus = bonus; + Constants.WINDS.forEach(w => winds[w] = 0); + let basicPoints, nonDealerPays, dealerPays; let individualBonusPayout = Constants.JPN_BONUS_POINTS / 3; // Check to see if you have to count basic points if (points < 5) { if ((points === 1 && (fu === 20 || fu === 25)) || (points === 2 && fu === 25)) { - throw TypeError("Invalid points/fu combination"); + throw RangeError("Invalid points/fu combination"); } else { // Calculate hand value, if it's above a mangan, cap it there basicPoints = fu * Math.pow(2, 2 + points); @@ -121,7 +118,7 @@ function jpn_selfdraw_delta(points, fu, bonus, dealerWind, winnerWind, riichiSti */ function jpn_mistake_delta(loser) { let winds = {}; - Constants.WINDS.forEach(w => {winds[w] = Constants.JPN_MISTAKE_POINTS / 3}); + Constants.WINDS.forEach(w => winds[w] = Constants.JPN_MISTAKE_POINTS / 3); winds[loser] = -Constants.JPN_MISTAKE_POINTS; return winds; diff --git a/imports/ui/record-game/RecordJapaneseGame.js b/imports/ui/record-game/RecordJapaneseGame.js index cfe3669..040541f 100644 --- a/imports/ui/record-game/RecordJapaneseGame.js +++ b/imports/ui/record-game/RecordJapaneseGame.js @@ -775,7 +775,7 @@ function push_dealin_hand(template) { var loserWind = GameRecordUtils.playerToDirection(Session.get("round_loser")); var riichiSum = Session.get("free_riichi_sticks"); let seatDeltas = {}; - Constants.WINDS.forEach(w => {seatDeltas[w] = 0}); + Constants.WINDS.forEach(w => seatDeltas[w] = 0); if (winnerWind == Constants.EAST) { Session.set("eastPlayerWins", Number(Session.get("eastPlayerWins")) + 1); @@ -879,7 +879,7 @@ function push_selfdraw_hand(template) { var winnerWind = GameRecordUtils.playerToDirection(Session.get("round_winner")); var riichiSum = Session.get("free_riichi_sticks"); let seatDeltas = {}; - Constants.WINDS.forEach(w => {seatDeltas[w] = 0}); + Constants.WINDS.forEach(w => seatDeltas[w] = 0); if (winnerWind == Constants.EAST) { Session.set("eastPlayerWins", Number(Session.get("eastPlayerWins")) + 1); @@ -1095,7 +1095,7 @@ function push_split_pao_hand(template) { var paoWind = GameRecordUtils.playerToDirection(Session.get("round_pao_player")); var riichiSum = Session.get("free_riichi_sticks"); let seatDeltas = {}; - Constants.WINDS.forEach(w => {seatDeltas[w] = 0}); + Constants.WINDS.forEach(w => seatDeltas[w] = 0); if (winnerWind == Constants.EAST) { Session.set("eastPlayerWins", Number(Session.get("eastPlayerWins")) + 1);