mirror of
https://github.com/taigrr/JSCheckers
synced 2025-01-18 04:33:13 -08:00
Removed ability to capture backwards except for in coomplex moves
This commit is contained in:
parent
e7188d58bb
commit
7a86cc9ad0
@ -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')&&(toRow<fromRow))||((fromType=='black')&&(toRow>fromRow))))||(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';
|
||||
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;
|
||||
}
|
||||
arrSquares[toRow][toCol].type = arrSquares[fromRow][fromCol].type;
|
||||
arrSquares[fromRow][fromCol].type = 'empty';
|
||||
playSound('Knock');
|
||||
lastUsed = toCoorString;
|
||||
lastPlayer = arrSquares[toRow][toCol].type;
|
||||
multPossible=true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user