From f5c0cb862b30fe6a8d77e45b89fea500577c5dcf Mon Sep 17 00:00:00 2001 From: yukirij Date: Tue, 3 Sep 2024 21:16:06 -0700 Subject: [PATCH] Update WSS host; rename Omen to Source. --- www/js/game.js | 16 ++++++++-------- www/js/interface.js | 2 +- www/js/system.js | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/www/js/game.js b/www/js/game.js index 1c35cf7..b17d808 100644 --- a/www/js/game.js +++ b/www/js/game.js @@ -40,7 +40,7 @@ GAME.Board = class { { 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.Omen, hex:new MATH.Vec2(4, 0) }, + { piece:GAME.Const.PieceId.Source, hex:new MATH.Vec2(4, 0) }, ]; // Add Dawn pieces @@ -471,7 +471,7 @@ GAME.Game = class { let check_direct = (this.state.check & 0x040) != 0; let check_count = this.state.check & 0x3F; 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(target_id !== null) { if(check_count > 1) { @@ -487,7 +487,7 @@ GAME.Game = class { } // 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; } @@ -512,7 +512,7 @@ GAME.Game = class { // Target piece is opposing. else { // Check if target piece is opposing king. - if(target.piece == GAME.Const.PieceId.Omen) { + if(target.piece == GAME.Const.PieceId.Source) { if(valid) { if(dist == 1) { check = GAME.Const.Check.Direct; } else { check = GAME.Const.Check.Stride; } @@ -543,7 +543,7 @@ GAME.Game = class { // Handle blocking restrictions. 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); } else { result = result && ((dir_mask & block_directions) != 0 || swap); @@ -570,7 +570,7 @@ GAME.Game = class { // King cannot swap onto tile that is threatened. // 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)) { return false; } @@ -781,7 +781,7 @@ GAME.Const = { Castle: 4, Dragon: 5, Behemoth: 6, - Omen: 7, + Source: 7, }, Count: { @@ -929,7 +929,7 @@ GAME.Const = { .add(17) ), new GAME.GamePiece( - "Omen", + "Source", new GAME.PieceMovement() .add(0) .add(1) diff --git a/www/js/interface.js b/www/js/interface.js index 8270b8c..a63cb16 100644 --- a/www/js/interface.js +++ b/www/js/interface.js @@ -434,7 +434,7 @@ const INTERFACE = { } if(GAME_DATA.turn > 0 && play.source < 2 && (play.to == i || (play.source == 0 && play.from == i))) { 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; } switch(hover_state) { diff --git a/www/js/system.js b/www/js/system.js index 7f30b81..a49bfc3 100644 --- a/www/js/system.js +++ b/www/js/system.js @@ -1,7 +1,7 @@ function RECONNECT() { if(SOCKET === null) { console.log("Websocket connecting.."); - SOCKET = new WebSocket("wss://omen.kirisame.com:38612"); + SOCKET = new WebSocket("wss://" + location.host); SOCKET.binaryType = "arraybuffer"; SOCKET.addEventListener("error", () => { SOCKET = null;