From 7a86cc9ad0c5cae6e3820e9c1d499cf834cf8560 Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Mon, 17 Aug 2015 14:57:50 -0700 Subject: [PATCH] Removed ability to capture backwards except for in coomplex moves --- gameScripts.js | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/gameScripts.js b/gameScripts.js index dbb1b39..64e63f5 100755 --- a/gameScripts.js +++ b/gameScripts.js @@ -175,31 +175,36 @@ function movePiece(idName, XCoor, YCoor) } else if(((multPossible&&(lastUsed==(fromCol+'a'+fromRow)))||((fromType).substring(0,1)!=lastPlayer.substring(0,1)))&&(Math.abs(toRow-fromRow)<3)&&(Math.abs(toCol-fromCol)<3)&&((avType=='red')||(avType=='redK')||(avType=='black')||(avType=='blackK'))) { - if(fromType=='black'||fromType=='blackK') + if((!(((fromType=='red')&&(toRowfromRow))))||(multPossible&&(lastUsed==(fromCol+'a'+fromRow)))) { - if(avType=='red'||avType=='redK') + + if(fromType=='black'||fromType=='blackK') { - arrSquares[avRow][avCol].type='empty'; + if(avType=='red'||avType=='redK') + { + arrSquares[avRow][avCol].type='empty'; + } + arrSquares[toRow][toCol].type = arrSquares[fromRow][fromCol].type; + arrSquares[fromRow][fromCol].type = 'empty'; + playSound('Knock'); + lastUsed = toCoorString; + lastPlayer = arrSquares[toRow][toCol].type; + multPossible = true; } - arrSquares[toRow][toCol].type = arrSquares[fromRow][fromCol].type; - arrSquares[fromRow][fromCol].type = 'empty'; - playSound('Knock'); - lastUsed = toCoorString; - lastPlayer = arrSquares[toRow][toCol].type; - multPossible = true; - } - else - { - if(avType=='black'||avType=='blackK') + else { - arrSquares[avRow][avCol].type='empty'; - } - arrSquares[toRow][toCol].type = arrSquares[fromRow][fromCol].type; - arrSquares[fromRow][fromCol].type = 'empty'; - playSound('Knock'); - lastUsed = toCoorString; - lastPlayer = arrSquares[toRow][toCol].type; - multPossible=true; + if(avType=='black'||avType=='blackK') + { + arrSquares[avRow][avCol].type='empty'; + } + arrSquares[toRow][toCol].type = arrSquares[fromRow][fromCol].type; + arrSquares[fromRow][fromCol].type = 'empty'; + playSound('Knock'); + lastUsed = toCoorString; + lastPlayer = arrSquares[toRow][toCol].type; + multPossible=true; + } + } } }