23 lines
463 B
JavaScript
23 lines
463 B
JavaScript
|
|
||
|
export function flag(data, location, player) {
|
||
|
let tile = data[location[0]][location[1]]
|
||
|
|
||
|
if (!tile.mask || tile.color === 0) return data
|
||
|
const color = player.color * 1
|
||
|
console.log(player)
|
||
|
|
||
|
switch (tile.flag) {
|
||
|
case (0):
|
||
|
tile.flag = color;
|
||
|
break;
|
||
|
case (color):
|
||
|
tile.flag = color + 16;
|
||
|
break;
|
||
|
default:
|
||
|
tile.flag = 0;
|
||
|
}
|
||
|
console.log(tile.flag)
|
||
|
data[location[0]][location[1]] = tile
|
||
|
return data;
|
||
|
}
|