Fix direction checking for jump moves.
This commit is contained in:
parent
c6fcb6bd78
commit
e7b3556ac4
@ -424,8 +424,11 @@ GAME.Game = class {
|
|||||||
let direction = GAME.Const.get_direction(direction_id);
|
let direction = GAME.Const.get_direction(direction_id);
|
||||||
let stride = (moves.stride & mask) != 0;
|
let stride = (moves.stride & mask) != 0;
|
||||||
|
|
||||||
|
let dir_mask = mask;
|
||||||
|
if((dir_mask & 0xFFF) == 0) { dir_mask >>= 12; }
|
||||||
|
|
||||||
// Get initial status in direction.
|
// Get initial status in direction.
|
||||||
let valid = (permitted_moves & mask) != 0;
|
let valid = true; //(permitted_moves & mask) != 0;
|
||||||
let pieces_blocking = 0;
|
let pieces_blocking = 0;
|
||||||
|
|
||||||
let move_hex = hex.copy();
|
let move_hex = hex.copy();
|
||||||
@ -498,7 +501,7 @@ GAME.Game = class {
|
|||||||
if(dist == 1) { check = GAME.Const.Check.Direct; }
|
if(dist == 1) { check = GAME.Const.Check.Direct; }
|
||||||
else { check = GAME.Const.Check.Stride; }
|
else { check = GAME.Const.Check.Stride; }
|
||||||
|
|
||||||
if(stride) { block = mask; }
|
if(stride) { block = dir_mask; }
|
||||||
|
|
||||||
// Apply check to previous moves.
|
// Apply check to previous moves.
|
||||||
for(let idist = 1; idist < dist; idist++) {
|
for(let idist = 1; idist < dist; idist++) {
|
||||||
@ -510,7 +513,7 @@ GAME.Game = class {
|
|||||||
// Apply blocking to last .
|
// Apply blocking to last .
|
||||||
for(let idist = 1; idist < dist; idist++) {
|
for(let idist = 1; idist < dist; idist++) {
|
||||||
if(this.board.tiles[tiles[tiles.length - idist].tile].piece !== null) {
|
if(this.board.tiles[tiles[tiles.length - idist].tile].piece !== null) {
|
||||||
tiles[tiles.length - idist].block = mask;
|
tiles[tiles.length - idist].block = dir_mask;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -525,9 +528,9 @@ GAME.Game = class {
|
|||||||
// Handle blocking restrictions.
|
// Handle blocking restrictions.
|
||||||
if(block_directions != 0) {
|
if(block_directions != 0) {
|
||||||
if(piece.piece == GAME.Const.PieceId.Omen) {
|
if(piece.piece == GAME.Const.PieceId.Omen) {
|
||||||
result = result && ((mask & block_directions) == 0 || tile_occupied);
|
result = result && ((dir_mask & block_directions) == 0 || tile_occupied);
|
||||||
} else {
|
} else {
|
||||||
result = result && ((mask & block_directions) != 0 || swap);
|
result = result && ((dir_mask & block_directions) != 0 || swap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user