Skip to content

Commit

Permalink
fixed a rare bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TVke committed Oct 24, 2016
1 parent c61e1a8 commit e40845e
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion game.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,28 +114,60 @@ var gameController = {
}
}, 250);
},
startRules: function () {
startRules: function (data) {
var currentPawn = gameModel.pawns[gameModel.activePlayer.publish()];
var secondDiceValue = gameModel.dice[1].publish();
switch (gameModel.dice[0].publish()) {
case 3:
if (secondDiceValue === 6) {
currentPawn.publish(26);
}else{
setTimeout(function () {
if (gameModel.tempPos.publish()<data){
currentPawn.publish(data + gameModel.currentThrow.publish());
}else{
currentPawn.publish(data - gameModel.currentThrow.publish());
}
}, 500);
}
break;
case 4:
if (secondDiceValue === 5) {
currentPawn.publish(53);
}else{
setTimeout(function () {
if (gameModel.tempPos.publish()<data){
currentPawn.publish(data + gameModel.currentThrow.publish());
}else{
currentPawn.publish(data - gameModel.currentThrow.publish());
}
}, 500);
}
break;
case 5:
if (secondDiceValue === 4) {
currentPawn.publish(53);
}else{
setTimeout(function () {
if (gameModel.tempPos.publish()<data){
currentPawn.publish(data + gameModel.currentThrow.publish());
}else{
currentPawn.publish(data - gameModel.currentThrow.publish());
}
}, 500);
}
break;
case 6:
if (secondDiceValue === 3) {
currentPawn.publish(26);
}else{
setTimeout(function () {
if (gameModel.tempPos.publish()<data){
currentPawn.publish(data + gameModel.currentThrow.publish());
}else{
currentPawn.publish(data - gameModel.currentThrow.publish());
}
}, 500);
}
break;
default:
Expand Down

0 comments on commit e40845e

Please sign in to comment.