Update WSS host; rename Omen to Source.

This commit is contained in:
yukirij 2024-09-03 21:16:06 -07:00
parent bbeed407bb
commit f5c0cb862b
3 changed files with 10 additions and 10 deletions

View File

@ -40,7 +40,7 @@ GAME.Board = class {
{ piece:GAME.Const.PieceId.Dragon, hex:new MATH.Vec2(4, 2) }, { piece:GAME.Const.PieceId.Dragon, hex:new MATH.Vec2(4, 2) },
{ piece:GAME.Const.PieceId.Behemoth, hex:new MATH.Vec2(4, 1) }, { piece:GAME.Const.PieceId.Behemoth, hex:new MATH.Vec2(4, 1) },
{ piece:GAME.Const.PieceId.Omen, hex:new MATH.Vec2(4, 0) }, { piece:GAME.Const.PieceId.Source, hex:new MATH.Vec2(4, 0) },
]; ];
// Add Dawn pieces // Add Dawn pieces
@ -471,7 +471,7 @@ GAME.Game = class {
let check_direct = (this.state.check & 0x040) != 0; let check_direct = (this.state.check & 0x040) != 0;
let check_count = this.state.check & 0x3F; let check_count = this.state.check & 0x3F;
if(piece.player == (this.turn & 1) && this.state.check != 0) { if(piece.player == (this.turn & 1) && this.state.check != 0) {
if(piece.piece != GAME.Const.PieceId.Omen) { if(piece.piece != GAME.Const.PieceId.Source) {
if(tile_data.checking != 0) { if(tile_data.checking != 0) {
if(target_id !== null) { if(target_id !== null) {
if(check_count > 1) { if(check_count > 1) {
@ -487,7 +487,7 @@ GAME.Game = class {
} }
// King may not move onto threatened tile. // King may not move onto threatened tile.
if(piece.piece == GAME.Const.PieceId.Omen && tile_data.threaten[+(!piece.player)] > 0) { if(piece.piece == GAME.Const.PieceId.Source && tile_data.threaten[+(!piece.player)] > 0) {
result = false; result = false;
} }
@ -512,7 +512,7 @@ GAME.Game = class {
// Target piece is opposing. // Target piece is opposing.
else { else {
// Check if target piece is opposing king. // Check if target piece is opposing king.
if(target.piece == GAME.Const.PieceId.Omen) { if(target.piece == GAME.Const.PieceId.Source) {
if(valid) { if(valid) {
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; }
@ -543,7 +543,7 @@ 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.Source) {
result = result && ((dir_mask & block_directions) == 0 || tile_occupied); result = result && ((dir_mask & block_directions) == 0 || tile_occupied);
} else { } else {
result = result && ((dir_mask & block_directions) != 0 || swap); result = result && ((dir_mask & block_directions) != 0 || swap);
@ -570,7 +570,7 @@ GAME.Game = class {
// King cannot swap onto tile that is threatened. // King cannot swap onto tile that is threatened.
// This case should also cover blocking. // This case should also cover blocking.
if(target.piece == GAME.Const.PieceId.Omen if(target.piece == GAME.Const.PieceId.Source
&& (this.board.tiles[tile].threaten[+(!target.player)] > 0 || piece.blocking != 0)) { && (this.board.tiles[tile].threaten[+(!target.player)] > 0 || piece.blocking != 0)) {
return false; return false;
} }
@ -781,7 +781,7 @@ GAME.Const = {
Castle: 4, Castle: 4,
Dragon: 5, Dragon: 5,
Behemoth: 6, Behemoth: 6,
Omen: 7, Source: 7,
}, },
Count: { Count: {
@ -929,7 +929,7 @@ GAME.Const = {
.add(17) .add(17)
), ),
new GAME.GamePiece( new GAME.GamePiece(
"Omen", "Source",
new GAME.PieceMovement() new GAME.PieceMovement()
.add(0) .add(0)
.add(1) .add(1)

View File

@ -434,7 +434,7 @@ const INTERFACE = {
} }
if(GAME_DATA.turn > 0 && play.source < 2 && (play.to == i || (play.source == 0 && play.from == i))) { if(GAME_DATA.turn > 0 && play.source < 2 && (play.to == i || (play.source == 0 && 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.Omen && piece.player == (GAME_DATA.turn & 1)) { } else if(GAME_DATA.state.check != 0 && piece !== null && piece.piece == GAME.Const.PieceId.Source && piece.player == (GAME_DATA.turn & 1)) {
ctx.fillStyle = INTERFACE.Color.HintCheck; ctx.fillStyle = INTERFACE.Color.HintCheck;
} }
switch(hover_state) { switch(hover_state) {

View File

@ -1,7 +1,7 @@
function RECONNECT() { function RECONNECT() {
if(SOCKET === null) { if(SOCKET === null) {
console.log("Websocket connecting.."); console.log("Websocket connecting..");
SOCKET = new WebSocket("wss://omen.kirisame.com:38612"); SOCKET = new WebSocket("wss://" + location.host);
SOCKET.binaryType = "arraybuffer"; SOCKET.binaryType = "arraybuffer";
SOCKET.addEventListener("error", () => { SOCKET.addEventListener("error", () => {
SOCKET = null; SOCKET = null;