Fix knight alt move handling.
This commit is contained in:
parent
444b8e8e29
commit
98b7491645
@ -391,7 +391,7 @@ GAME.Game = class {
|
|||||||
// Handle alt moves.
|
// Handle alt moves.
|
||||||
if(play.source == 3) {
|
if(play.source == 3) {
|
||||||
switch(moves.alt) {
|
switch(moves.alt) {
|
||||||
case 0: {
|
case 1: {
|
||||||
piece.promoted = false;
|
piece.promoted = false;
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
@ -595,7 +595,7 @@ GAME.Game = class {
|
|||||||
// Check all tiles if not blocking.
|
// Check all tiles if not blocking.
|
||||||
if(block_directions == 0) {
|
if(block_directions == 0) {
|
||||||
for(let i = 0; i < GAME_DATA.board.tiles.length; ++i) {
|
for(let i = 0; i < GAME_DATA.board.tiles.length; ++i) {
|
||||||
if(this.placable_tile(piece, i)) {
|
if(this.placable_tile(piece, i, {check:false})) {
|
||||||
tiles.push(new GAME.MovementTile(i, true, false, 0, 0));
|
tiles.push(new GAME.MovementTile(i, true, false, 0, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -758,9 +758,8 @@ GAME.Game = class {
|
|||||||
|
|
||||||
// Check if position puts king in check.
|
// Check if position puts king in check.
|
||||||
let checking = false;
|
let checking = false;
|
||||||
let movements = [ ];
|
let movements = this.movement_tiles(piece, tile_id, true);
|
||||||
if(params.check !== false) {
|
if(params.check !== false) {
|
||||||
movements = this.movement_tiles(piece, tile_id, true);
|
|
||||||
for(let movement of movements) {
|
for(let movement of movements) {
|
||||||
if(movement.check) {
|
if(movement.check) {
|
||||||
checking = true;
|
checking = true;
|
||||||
|
@ -436,7 +436,7 @@ const INTERFACE = {
|
|||||||
}
|
}
|
||||||
if(GAME_DATA.turn > 0 && (play.source < 2 || play.source == 3) && (play.to == i || ((play.source == 0 || play.source == 3) && play.from == i))) {
|
if(GAME_DATA.turn > 0 && (play.source < 2 || play.source == 3) && (play.to == i || ((play.source == 0 || play.source == 3) && play.from == i))) {
|
||||||
ctx.fillStyle = INTERFACE.Color.HintPlay;
|
ctx.fillStyle = INTERFACE.Color.HintPlay;
|
||||||
} else if(GAME_DATA.state.check != 0 && piece !== null && piece.piece == GAME.Const.PieceId.Source && piece.player == (GAME_DATA.turn & 1)) {
|
} else if(GAME_DATA.state.check != 0 && piece !== null && piece.piece == GAME.Const.PieceId.Heart && piece.player == (GAME_DATA.turn & 1)) {
|
||||||
ctx.fillStyle = INTERFACE.Color.HintCheck;
|
ctx.fillStyle = INTERFACE.Color.HintCheck;
|
||||||
}
|
}
|
||||||
switch(hover_state) {
|
switch(hover_state) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user