Skip to content

Commit

Permalink
Changed all new functions to camelCase as per new standard
Browse files Browse the repository at this point in the history
  • Loading branch information
0spooky2me committed Sep 24, 2018
1 parent bdede0b commit 99a217e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 33 deletions.
18 changes: 6 additions & 12 deletions imports/api/HandScoreCalculator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { GameRecordUtils } from './utils/GameRecordUtils';

export var HandScoreCalculator = {
jpn: {
dealin_delta: jpn_dealin_delta,
selfdraw_delta: jpn_selfdraw_delta,
mistake_delta: jpn_mistake_delta
dealinDelta: jpnDealinDelta,
selfDrawDelta: jpnSelfDrawDelta,
mistakeDelta: jpnMistakeDelta
}
};

Expand All @@ -23,13 +23,7 @@ export var HandScoreCalculator = {
* @param {Number} riichiSticks - the number of riichi sticks won
* @return {Object} containing the point difference for each seat
*/
function jpn_dealin_delta(points,
fu,
bonus,
dealerWind,
winnerWind,
loserWind,
riichiSticks) {
function jpnDealinDelta(points, fu, bonus, dealerWind, winnerWind, loserWind, riichiSticks) {
let winds = {};
Constants.WINDS.forEach(w => winds[w] = 0);

Expand Down Expand Up @@ -72,7 +66,7 @@ function jpn_dealin_delta(points,
* @param {Number} riichiSticks - the total number of thrown riichi sticks
* @return {Object} containing the point difference for each seat
*/
function jpn_selfdraw_delta(points, fu, bonus, dealerWind, winnerWind, riichiSticks) {
function jpnSelfDrawDelta(points, fu, bonus, dealerWind, winnerWind, riichiSticks) {
let winds = {};
Constants.WINDS.forEach(w => winds[w] = 0);
let basicPoints, nonDealerPays, dealerPays;
Expand Down Expand Up @@ -116,7 +110,7 @@ function jpn_selfdraw_delta(points, fu, bonus, dealerWind, winnerWind, riichiSti
* @param {string} loser - the losing seat true wind
* @return {Object} containing the point difference for each seat
*/
function jpn_mistake_delta(loser) {
function jpnMistakeDelta(loser) {
let winds = {};
Constants.WINDS.forEach(w => winds[w] = Constants.JPN_MISTAKE_POINTS / 3);

Expand Down
42 changes: 21 additions & 21 deletions imports/ui/record-game/RecordJapaneseGame.js
Original file line number Diff line number Diff line change
Expand Up @@ -837,13 +837,13 @@ function push_dealin_hand(template) {
Session.set("north_riichi_sum", Number(Session.get("north_riichi_sum")) + 1);
}

let handDeltas = HandScoreCalculator.jpn.dealin_delta(points,
fu,
Number(Session.get("current_bonus")),
dealerWind,
winnerWind,
loserWind,
riichiSum);
let handDeltas = HandScoreCalculator.jpn.dealinDelta(points,
fu,
Number(Session.get("current_bonus")),
dealerWind,
winnerWind,
loserWind,
riichiSum);
Session.set("free_riichi_sticks", 0);

// Accumulate hand deltas for this round
Expand Down Expand Up @@ -932,12 +932,12 @@ function push_selfdraw_hand(template) {
Session.set("north_riichi_sum", Number(Session.get("north_riichi_sum")) + 1);
}

let handDeltas = HandScoreCalculator.jpn.selfdraw_delta(points,
fu,
Number(Session.get("current_bonus")),
dealerWind,
winnerWind,
riichiSum);
let handDeltas = HandScoreCalculator.jpn.selfDrawDelta(points,
fu,
Number(Session.get("current_bonus")),
dealerWind,
winnerWind,
riichiSum);
Session.set("free_riichi_sticks", 0);

// Accumulate hand deltas for this round
Expand Down Expand Up @@ -1060,7 +1060,7 @@ function push_restart_hand(template) {

function push_mistake_hand(template) {
let loserWind = GameRecordUtils.playerToDirection(Session.get("round_loser"));
let handDeltas = HandScoreCalculator.jpn.mistake_delta(loserWind);
let handDeltas = HandScoreCalculator.jpn.mistakeDelta(loserWind);

if (loserWind == Constants.EAST) {
Session.set("eastMistakeTotal", Number(Session.get("eastMistakeTotal")) + 1);
Expand Down Expand Up @@ -1156,13 +1156,13 @@ function push_split_pao_hand(template) {
Session.set("north_riichi_sum", Number(Session.get("north_riichi_sum")) + 1);
}

var value = HandScoreCalculator.jpn.dealin_delta(points,
fu,
Number(Session.get("current_bonus")),
dealerWind,
winnerWind,
loserWind,
0)[winnerWind];
var value = HandScoreCalculator.jpn.dealinDelta(points,
fu,
Number(Session.get("current_bonus")),
dealerWind,
winnerWind,
loserWind,
0)[winnerWind];

if (((value / 2 ) % 100) == 50) {
value += 100;
Expand Down

0 comments on commit 99a217e

Please sign in to comment.