Commit b2ffceb7 authored by Tobias Bengfort's avatar Tobias Bengfort
Browse files

merge limitBuildSpace into single value

parent 019970b3
......@@ -7,8 +7,7 @@ export default {
"description": "Try and survive for 100 turns. You only have 5 Tiles. You may only build in the top left corner.",
"board": scenBoard,
"tileLimit": 5,
"limitBuildSpaceA": {x: 0, y: 0},
"limitBuildSpaceB": {x: 10, y: 10},
"limitBuildSpace": {x1: 0, y1: 0, x2: 10, y2: 10},
"winCondition": function(state) {
if (logic.compareBoards(scenBoard, state.game.board)) {
return false;
......
......@@ -62,8 +62,8 @@ on('mousedown', '.board-cell', function(state, event) {
const y = Array.prototype.indexOf.call(board.children, row);
const currentPlayer = state.game.currentPlayer === constants.EMPTY ? constants.GAIA : state.game.currentPlayer;
if (
(state.game.limitBuildSpaceA && state.game.limitBuildSpaceB) &&
(x < state.game.limitBuildSpaceA.x || x > state.game.limitBuildSpaceB.x || y < state.game.limitBuildSpaceA.y || y > state.game.limitBuildSpaceB.y)
(state.game.limitBuildSpace) &&
(x < state.game.limitBuildSpace.x1 || x > state.game.limitBuildSpace.x2 || y < state.game.limitBuildSpace.y1 || y > state.game.limitBuildSpace.y2)
) return;
if (state.game.board[y][x] === currentPlayer) {
state.game.board[y][x] = constants.EMPTY;
......@@ -142,8 +142,7 @@ on('click', '.js-menu-scenario', function(state) {
description: scenarios[i].description,
winCondition: scenarios[i].winCondition,
tileLimit: scenarios[i].tileLimit || Infinity,
limitBuildSpaceA: scenarios[i].limitBuildSpaceA,
limitBuildSpaceB: scenarios[i].limitBuildSpaceB,
limitBuildSpace: scenarios[i].limitBuildSpace,
currentPlayer: 1,
playing: false,
steps: 0,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment