Fix turnless pool player handling.
This commit is contained in:
parent
842a945a01
commit
be42a50cc6
@ -116,10 +116,11 @@ GAME.MovementTile = class {
|
|||||||
};
|
};
|
||||||
|
|
||||||
GAME.Play = class {
|
GAME.Play = class {
|
||||||
constructor(source, from, to) {
|
constructor(source, from, to, player=-1) {
|
||||||
this.source = source;
|
this.source = source;
|
||||||
this.from = from;
|
this.from = from;
|
||||||
this.to = to;
|
this.to = to;
|
||||||
|
this.player = player;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -319,7 +320,12 @@ GAME.Game = class {
|
|||||||
process(play) {
|
process(play) {
|
||||||
if(this.state.code != 0) { return false; }
|
if(this.state.code != 0) { return false; }
|
||||||
|
|
||||||
let player = this.turn & 1;
|
let player = 0;
|
||||||
|
if(play.player == -1) {
|
||||||
|
player = this.turn & 1;
|
||||||
|
} else {
|
||||||
|
player = play.player;
|
||||||
|
}
|
||||||
|
|
||||||
// Move piece on board.
|
// Move piece on board.
|
||||||
switch(play.source) {
|
switch(play.source) {
|
||||||
@ -399,7 +405,12 @@ GAME.Game = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
play_is_valid(play) {
|
play_is_valid(play) {
|
||||||
let player = this.turn & 1;
|
let player = 0;
|
||||||
|
if(play.player == -1) {
|
||||||
|
player = this.turn & 1;
|
||||||
|
} else {
|
||||||
|
player = play.player;
|
||||||
|
}
|
||||||
|
|
||||||
switch(play.source) {
|
switch(play.source) {
|
||||||
case 0: {
|
case 0: {
|
||||||
|
@ -215,6 +215,8 @@ const INTERFACE = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
click(event) {
|
click(event) {
|
||||||
|
let play_player = -1;
|
||||||
|
|
||||||
console.log("CLICK");
|
console.log("CLICK");
|
||||||
switch(event.button) {
|
switch(event.button) {
|
||||||
|
|
||||||
@ -252,8 +254,12 @@ const INTERFACE = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((GAME_DATA.turn & 1) != pool_selected) {
|
if((GAME_DATA.turn & 1) != pool_selected) {
|
||||||
console.log("NOT POOL");
|
if(GAME_DATA.config.rules.turn) {
|
||||||
result = 0;
|
console.log("NOT POOL");
|
||||||
|
result = 0;
|
||||||
|
} else {
|
||||||
|
play_player = pool_selected;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -292,6 +298,8 @@ const INTERFACE = {
|
|||||||
INTERFACE_DATA.hover.tile,
|
INTERFACE_DATA.hover.tile,
|
||||||
INTERFACE_DATA.alt_mode
|
INTERFACE_DATA.alt_mode
|
||||||
);
|
);
|
||||||
|
play.player = play_player;
|
||||||
|
|
||||||
INTERFACE.process(play);
|
INTERFACE.process(play);
|
||||||
INTERFACE_DATA.select = null;
|
INTERFACE_DATA.select = null;
|
||||||
INTERFACE_DATA.alt_mode = false;
|
INTERFACE_DATA.alt_mode = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user