diff --git a/src/utils/engine-client.js b/src/utils/engine-client.js index efedd1d..18e411f 100644 --- a/src/utils/engine-client.js +++ b/src/utils/engine-client.js @@ -35,8 +35,8 @@ export function getReadableCauseOfDeath(death) { return `Lost head-to-head with ${death.eliminatedBy}`; case "wall-collision": return "Moved out of bounds"; - case "team-eliminated": - return "Team was eliminated"; + case "squad-eliminated": + return "Squad was eliminated"; default: return death.cause; } diff --git a/src/utils/engine-client.test.js b/src/utils/engine-client.test.js index 328cb18..d8aca46 100644 --- a/src/utils/engine-client.test.js +++ b/src/utils/engine-client.test.js @@ -83,8 +83,8 @@ function singleSnakeData() { return { "http://localhost/games/123": gameResponse, "ws://localhost/socket/123": framesResponse, - "images/snake/head/regular.svg": svgText, - "images/snake/tail/regular.svg": svgText + "images/snake/head/default.svg": svgText, + "images/snake/tail/default.svg": svgText }; } @@ -99,8 +99,8 @@ function multiSnakeData() { URL: "http://localhost:5000", Health: 1, Body: [{ X: 3, Y: 3 }, { X: 3, Y: 4 }, { X: 3, Y: 5 }], - Head: "regular", - Tail: "regular" + Head: "default", + Tail: "default" }, { ID: "qwer", diff --git a/src/utils/game-state.js b/src/utils/game-state.js index 05f0f7f..9beafde 100644 --- a/src/utils/game-state.js +++ b/src/utils/game-state.js @@ -69,7 +69,7 @@ function formatSnake(snake) { tail: snake.TailType && snake.TailType.toLowerCase(), headSvg: snake.HeadSvg, tailSvg: snake.TailSvg, - team: snake.Team + squad: snake.Squad }; } @@ -208,9 +208,9 @@ function oneLeft(snakes) { return alive.length <= 1; } -function getUniqueTeams(snakes) { +function getUniqueSquads(snakes) { return snakes - .map(function (snake) { return snake.team; }) + .map(function (snake) { return snake.squad; }) .filter(function (value) { return (typeof value !== "undefined" && value !== "") }) .filter(function (value, index, self) { return self.indexOf(value) === index }) .sort(); @@ -224,10 +224,10 @@ export function isLastFrameOfGame(frame) { return true; } - const remainingTeams = getUniqueTeams(aliveSnakes); - if (remainingTeams.length > 0) { - // Team Game, we're done if one team is left. - return remainingTeams.length === 1; + const remainingSquads = getUniqueSquads(aliveSnakes); + if (remainingSquads.length > 0) { + // Squad game, we're done if one squad is left. + return remainingSquads.length === 1; } if (snakes.length === 1) { diff --git a/src/utils/game-state.test.js b/src/utils/game-state.test.js index 0563b28..17678ff 100644 --- a/src/utils/game-state.test.js +++ b/src/utils/game-state.test.js @@ -167,7 +167,7 @@ it("should not break on case sensitivity for head and tail types", () => { Name: "snake 1", URL: "http://snake1", Health: 100, - HeadType: "rEgUlAr", + HeadType: "dEfaUlT", TailType: "BOLT", Color: "red", Body: [{ X: 4, Y: 4 }, { X: 4, Y: 4 }, { X: 4, Y: 4 }] @@ -195,7 +195,7 @@ it("should not break on case sensitivity for head and tail types", () => { { x: 4, y: 4, direction: "up", type: "tail", isOverlapped: true } ], isDead: false, - head: "regular", + head: "default", tail: "bolt", headSvg: undefined, tailSvg: undefined