From fc3c6fb32ceb91f4b374cf8043d6e018f8aa72bc Mon Sep 17 00:00:00 2001 From: bill-the-dev Date: Wed, 13 Apr 2022 15:19:50 -0400 Subject: [PATCH] Click events works, but highlighting inconsistent --- dist/main.js | 2 +- src/scripts/game.js | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dist/main.js b/dist/main.js index 181a7fb..58bd9d4 100644 --- a/dist/main.js +++ b/dist/main.js @@ -49,7 +49,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Game; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.string.split.js */ \"./node_modules/core-js/modules/es.string.split.js\");\n/* harmony import */ var core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n/* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/es.promise.js */ \"./node_modules/core-js/modules/es.promise.js\");\n/* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! regenerator-runtime/runtime.js */ \"./node_modules/regenerator-runtime/runtime.js\");\n/* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _deck_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./deck.js */ \"./src/scripts/deck.js\");\n/* harmony import */ var _board_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./board.js */ \"./src/scripts/board.js\");\n/* harmony import */ var _player__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./player */ \"./src/scripts/player.js\");\n\n\n\n\n\n\n\n\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n// import Player from './player.js';\n\n\n\n\nvar Game = /*#__PURE__*/function () {\n function Game() {\n _classCallCheck(this, Game);\n\n this.activeGame = false;\n this.gameWin = false;\n this.gameWinType = '';\n this.gameWinColor = '';\n this.targetPos = null; // checkHighlight\n\n this.targetCard = null;\n this.targetMoves = null;\n this.activePawn = null; // checkHighlight\n\n this.activeCard = null; // checkHighlight\n\n this.currentPlayerIdx = 0; // aid with dealing cards\n\n this.players = [new _player__WEBPACK_IMPORTED_MODULE_10__[\"default\"](\"Player 1\", \"Blue\"), new _player__WEBPACK_IMPORTED_MODULE_10__[\"default\"](\"Player 2\", \"Red\")];\n this.player = this.currentPlayer;\n this.deck = new _deck_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]();\n this.board = new _board_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"](); // Window debugging:\n\n window.board = this.board;\n window.deck = this.deck;\n window.players = this.players;\n window.player = this.player;\n window.otherPlayer = this.otherPlayer;\n } // getter access like a property:\n\n\n _createClass(Game, [{\n key: \"currentPlayer\",\n get: function get() {\n return this.players[this.currentPlayerIdx];\n }\n }, {\n key: \"otherPlayer\",\n get: function get() {\n return this.players[(this.currentPlayerIdx + 1) % 2];\n } // always 0 or 1 using %\n\n }, {\n key: \"swapTurn\",\n value: function () {\n var _swapTurn = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.currentPlayerIdx = (this.currentPlayerIdx + 1) % 2;\n this.player = this.currentPlayer;\n window.player = this.player;\n\n case 3:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n function swapTurn() {\n return _swapTurn.apply(this, arguments);\n }\n\n return swapTurn;\n }() // deal alternates between players until 4, then on-deck\n\n }, {\n key: \"dealCard\",\n value: function dealCard() {\n var card = this.deck.deal();\n this.currentPlayer.dealCard(card);\n this.swapTurn();\n } // event handled in index.js \n\n }, {\n key: \"start\",\n value: function start() {\n for (var i = 0; i < 4; i++) {\n this.dealCard();\n }\n\n this.onDeckCard = this.deck.deal();\n this.activeGame = true;\n this.board.setBoard();\n } // all moves\n\n }, {\n key: \"possibleMoves\",\n value: function possibleMoves(card, startPos) {\n // all possible\n var that = this;\n\n if (that.currentPlayerIdx === 0) {\n return that.blueMoves(card, startPos);\n } else {\n return that.redMoves(card, startPos);\n }\n } // limits actual moves by empty and color\n\n }, {\n key: \"allowedMoves\",\n value: function allowedMoves(card, startPos) {\n var that = this;\n if (!that.board.validPos(startPos)) return false;\n var allMoves = that.possibleMoves(card, startPos); // \n\n var realMoves = [];\n\n for (var i = 0; i < allMoves.length; i++) {\n // ;\n if (that.board.validPos(allMoves[i])) {\n if (that.board.isEmpty(allMoves[i]) === true) {\n realMoves.push(allMoves[i]);\n } else {\n if (that.board.getPiece(allMoves[i]).color !== that.player.color.toLowerCase()) {\n realMoves.push(allMoves[i]);\n }\n }\n }\n }\n\n return realMoves;\n }\n }, {\n key: \"blueMoves\",\n value: function blueMoves(card, startPos) {\n var that = this;\n\n for (var i = 0; i < that.player.hand.length; i++) {\n if (that.player.hand[i] === card) {\n // changed from includes\n // console.log(\"ok\");\n var moves = that.player.hand[i].slice(1);\n var possiblePos = [];\n\n for (var j = 0; j < moves.length; j++) {\n var row = startPos[0] + moves[j][0];\n var col = startPos[1] + moves[j][1];\n possiblePos.push([row, col]);\n }\n\n return possiblePos;\n } else {// console.log(\"Card is not in your hand\"); // all returning else\n }\n }\n }\n }, {\n key: \"oppMoves\",\n value: function oppMoves(moves) {\n // flips opponent possible pos \n var newMoves = []; // console.log(moves);\n\n for (var i = 0; i < moves.length; i++) {\n var subArr = [];\n\n for (var j = 0; j < moves[0].length; j++) {\n var ele = moves[i][j];\n\n if (ele === 0) {\n subArr.push(ele);\n } else {\n subArr.push(moves[i][j] * -1);\n }\n }\n\n newMoves.push(subArr);\n }\n\n return newMoves;\n }\n }, {\n key: \"redMoves\",\n value: function redMoves(card, startPos) {\n var that = this;\n\n for (var i = 0; i < that.player.hand.length; i++) {\n if (that.player.hand[i] === card) {\n // changed from .includes \n var moves = that.player.hand[i].slice(1);\n var movesRev = that.oppMoves(moves);\n var possiblePos = [];\n\n for (var j = 0; j < movesRev.length; j++) {\n var row = startPos[0] + movesRev[j][0];\n var col = startPos[1] + movesRev[j][1];\n possiblePos.push([row, col]);\n }\n\n return possiblePos;\n } else {// console.log(\"Card is not in your hand\");\n }\n }\n }\n }, {\n key: \"checkHighlight\",\n value: function checkHighlight() {\n var allCards = document.querySelectorAll(\".back\");\n var allPawns = document.querySelectorAll(\"#pawn\");\n var that = this;\n allPawns.forEach(function (pawn) {\n if (pawn.classList.contains(\"active-pawn\")) {\n that.activePawn = pawn;\n that.targetPos = that.currentPos(pawn); // console.log(\"Found active pawn!\");\n }\n });\n allCards.forEach(function (card) {\n if (card.classList.contains(\"active-card\")) {\n // console.log(\"Found active card!\");\n that.activeCard = card;\n that.targetCard = that.currentCard(card);\n }\n });\n\n if (that.activePawn !== null && that.activeCard !== null) {\n // console.log(\"Both Active!\");\n that.targetMoves = that.viewMoves(); // highlight pos \n } else {\n return false;\n }\n } // sets game.targetPos in checkHighlight\n\n }, {\n key: \"currentPos\",\n value: function currentPos(pawnEl) {\n // const that = this;\n var pos = [];\n var posStr = pawnEl.parentElement.id;\n var strArr = posStr.slice(1, posStr.length).split(\",\");\n\n for (var i = 0; i < strArr.length; i++) {\n pos.push(parseInt(strArr[i]));\n }\n\n return pos;\n } // sets game.targetCard in checkHighlight\n\n }, {\n key: \"currentCard\",\n value: function currentCard(cardEl) {\n // console.log(\"in currentCard\");\n var that = this;\n var cardStr = cardEl.id.slice(4);\n var cardNum = parseInt(cardStr);\n if (cardNum === 1) return that.players[0].hand[0];\n if (cardNum === 2) return that.players[0].hand[1];\n if (cardNum === 3) return null; // need onDeck? Maybe not.\n\n if (cardNum === 4) return that.players[1].hand[0];\n if (cardNum === 5) return that.players[1].hand[1];\n }\n }, {\n key: \"viewMovePiece\",\n value: function viewMovePiece(posEndEle) {\n var that = this;\n var posStart = that.currentPos(that.activePawn);\n var posEnd = that.convertStrPos(posEndEle.id);\n\n if (board.grid[posEnd[0]][posEnd[1]] !== null) {\n that.board.removePiece(posEnd);\n that.board.viewRemovePiece(posEnd); // takes piece\n }\n\n that.board.movePiece(posStart, posEnd); // coded movePiece calls viewPlacePiece\n\n var piece = that.board.getPiece(posEnd); // Piece\n\n that.board.viewRemovePiece(posStart); // remove old pos\n // WIN CHECK\n\n setTimeout(function () {\n if (that.checkWin()) {\n that.modalWin();\n }\n }, 1000); // TURN SWAP \n\n setTimeout(function () {\n that.viewSwapTurn();\n }, 2000);\n }\n }, {\n key: \"viewSwapUsedCard\",\n value: function () {\n var _viewSwapUsedCard = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(playedCardEl, deckCardEl) {\n var that, currentHand, playedCard, deckCard, playedCardIdx, i, newPlayerCard, newDeckCard;\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n // console.log(\"in swap used\");\n that = this;\n currentHand = that.player.hand;\n playedCard = that.currentCard(playedCardEl);\n deckCard = that.onDeckCard;\n playedCardIdx = null;\n\n for (i = 0; i < currentHand.length; i++) {\n if (playedCard === currentHand[i]) playedCardIdx = i;\n } // board swap\n\n\n newPlayerCard = deckCard;\n newDeckCard = playedCard;\n currentHand[playedCardIdx] = newPlayerCard;\n deckCard = newDeckCard;\n this.onDeckCard = newDeckCard; // new\n // view swap\n\n that.deck.viewDealSwap(newPlayerCard, playedCardEl);\n that.deck.viewDealSwap(newDeckCard, deckCardEl);\n\n case 13:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n\n function viewSwapUsedCard(_x, _x2) {\n return _viewSwapUsedCard.apply(this, arguments);\n }\n\n return viewSwapUsedCard;\n }()\n }, {\n key: \"checkWin\",\n value: function checkWin() {\n var that = this;\n\n if (that.board.checkWinStone() !== false) {\n var winResults = that.board.checkWinStone();\n this.activeGame = false;\n this.gameWin = true;\n this.gameWinType = winResults[1];\n this.gameWinColor = winResults[0];\n return true;\n }\n\n if (that.board.checkWinStream() !== false) {\n var _winResults = that.board.checkWinStream();\n\n this.activeGame = false;\n this.gameWin = true;\n this.gameWinType = _winResults[1];\n this.gameWinColor = _winResults[0];\n return true;\n }\n\n return false;\n }\n }, {\n key: \"modalWin\",\n value: function modalWin() {\n var modalWin = document.querySelector(\".modal__win\");\n var winColor = \"\".concat(this.gameWinColor, \" Wins!\");\n var winType = \"Way of \".concat(this.gameWinType);\n document.querySelector(\".win-color\").innerHTML = winColor;\n document.querySelector(\".win-type\").innerHTML = winType;\n modalWin.style.display = 'flex';\n }\n }, {\n key: \"viewSwapTurn\",\n value: function viewSwapTurn() {\n var that = this;\n var playedCard = document.querySelector(\".active-card\");\n var deckCard = document.querySelector(\"#back3\");\n var body = document.querySelector(\".body\");\n var turnRedCircle = document.querySelector(\".turn-red-circle\");\n var turnBlueCircle = document.querySelector(\".turn-blue-circle\");\n\n if (that.currentPlayerIdx === 0) {\n // body.classList.remove(\"turn-blue\")\n body.classList.replace(\"turn-blue\", \"turn-red\");\n turnBlueCircle.style.visibility = 'hidden';\n turnRedCircle.style.visibility = 'visible';\n } else {\n body.classList.replace(\"turn-red\", \"turn-blue\");\n turnRedCircle.style.visibility = 'hidden';\n turnBlueCircle.style.visibility = 'visible';\n } // squares remove highlight\n\n\n var allSquares = document.getElementsByClassName('square');\n\n for (var i = 0; i < allSquares.length; i++) {\n allSquares[i].classList.remove(\"active\");\n allSquares[i].classList.add(\"inactive\");\n } // pawns remove highlight\n\n\n var allPawns = document.querySelectorAll(\"#pawn\");\n allPawns.forEach(function (pawn) {\n if (pawn.classList.contains(\"active-pawn\")) {\n pawn.classList.remove(\"active-pawn\");\n pawn.classList.add(\"inactive-pawn\");\n }\n }); // hide used cards\n\n setTimeout(function () {\n // flip used\n that.deck.viewToggleFlipTurn().then(setTimeout(function () {\n // swap used\n that.viewSwapUsedCard(playedCard, deckCard).then(setTimeout(function () {\n // flip back\n that.deck.viewToggleFlipTurn().then(setTimeout(function () {\n // rm highlight\n that.viewRemoveCardHighlight().then( // swap turn @ board\n that.swapTurn());\n }, 600));\n }, 600));\n }, 600));\n }, 1000);\n } // card remove highlight\n\n }, {\n key: \"viewRemoveCardHighlight\",\n value: function () {\n var _viewRemoveCardHighlight = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {\n var allCards;\n return regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n allCards = document.querySelectorAll(\".back\");\n allCards.forEach(function (card) {\n card.classList.remove(\"active-card\");\n card.classList.add(\"inactive-card\");\n });\n\n case 2:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n\n function viewRemoveCardHighlight() {\n return _viewRemoveCardHighlight.apply(this, arguments);\n }\n\n return viewRemoveCardHighlight;\n }()\n }, {\n key: \"viewMoves\",\n value: function viewMoves() {\n var that = this;\n var highlightMoves = that.allowedMoves(that.targetCard, that.targetPos);\n var viewSquares = [];\n\n for (var i = 0; i < highlightMoves.length; i++) {\n var squareSelector = JSON.stringify(highlightMoves[i]);\n var square = document.getElementById(squareSelector);\n viewSquares.push(square);\n }\n\n var allSquares = document.getElementsByClassName('square');\n\n for (var _i = 0; _i < allSquares.length; _i++) {\n allSquares[_i].classList.remove(\"active\");\n\n allSquares[_i].classList.add(\"inactive\");\n }\n\n for (var _i2 = 0; _i2 < viewSquares.length; _i2++) {\n viewSquares[_i2].classList.add(\"active\");\n\n viewSquares[_i2].classList.remove(\"inactive\");\n }\n\n return highlightMoves;\n } // '[1,2]' to [1,2]\n\n }, {\n key: \"convertStrPos\",\n value: function convertStrPos(strPos) {\n var arr = [];\n var strArr = strPos.slice(1, 4).split(','); // ['1', '2']\n\n strArr.forEach(function (ele) {\n arr.push(parseInt(ele));\n });\n return arr;\n }\n }]);\n\n return Game;\n}(); // consider adding a KEY:value list of variables like pawn, master, or player \n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvc2Ny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AgIHBhd24uY2xhc3NMaXN0LmFkZChcImluYWN0aXZlLXBhd25cIik7XG4gICAgICB9XG4gICAgfSk7XG5cblxuICAgIFxuICAgIC8vIGhpZGUgdXNlZCBjYXJkc1xuICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgLy8gZmxpcCB1c2VkXG4gICAgICB0aGF0LmRlY2sudmlld1RvZ2dsZUZsaXBUdXJuKCkudGhlbihcbiAgICAgICAgc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAgLy8gc3dhcCB1c2VkXG4gICAgICAgICAgdGhhdC52aWV3U3dhcFVzZWRDYXJkKHBsYXllZENhcmQsIGRlY2tDYXJkKS50aGVuKFxuICAgICAgICAgICAgc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAgICAgIC8vIGZsaXAgYmFja1xuICAgICAgICAgICAgICB0aGF0LmRlY2sudmlld1RvZ2dsZUZsaXBUdXJuKCkudGhlbihcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICAgIC8vIHJtIGhpZ2hsaWdodFxuICAgICAgICAgICAgICAgICAgdGhhdC52aWV3UmVtb3ZlQ2FyZEhpZ2hsaWdodCgpLnRoZW4oXG4gICAgICAgICAgICAgICAgICAgIC8vIHN3YXAgdHVybiBAIGJvYXJkXG4gICAgICAgICAgICAgICAgICAgIHRoYXQuc3dhcFR1cm4oKVxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9LCA2MDApXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9LCA2MDApXG4gICAgICAgICAgKTtcbiAgICAgICAgfSwgNjAwKVxuICAgICAgKTtcbiAgICB9LCAxMDAwKTtcbiAgfVxuXG4gIC8vIGNhcmQgcmVtb3ZlIGhpZ2hsaWdodFxuICBhc3luYyB2aWV3UmVtb3ZlQ2FyZEhpZ2hsaWdodCgpIHtcbiAgICBsZXQgYWxsQ2FyZHMgPSBkb2N1bW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wiY2hlY2tXaW5TdHJlYW0iLCJxdWVyeVNlbGVjdG9yIiwid2luQ29sb3IiLCJ3aW5UeXBlIiwiaW5uZXJIVE1MIiwic3R5bGUiLCJkaXNwbGF5IiwiYm9keSIsInR1cm5SZWRDaXJjbGUiLCJ0dXJuQmx1ZUNpcmNsZSIsInJlcGxhY2UiLCJ2aXNpYmlsaXR5IiwiYWxsU3F1YXJlcyIsImdldEVsZW1lbnRzQnlDbGFzc05hbWUiLCJyZW1vdmUiLCJhZGQiLCJ2aWV3VG9nZ2xlRmxpcFR1cm4iLCJ0aGVuIiwidmlld1N3YXBVc2VkQ2FyZCIsInZpZXdSZW1vdmVDYXJkSGlnaGxpZ2h0IiwiaGlnaGxpZ2h0TW92ZXMiLCJhbGxvd2VkTW92ZXMiLCJ2aWV3U3F1YXJlcyIsInNxdWFyZVNlbGVjdG9yIiwiSlNPTiIsInN0cmluZ2lmeSIsInNxdWFyZSIsImdldEVsZW1lbnRCeUlkIiwic3RyUG9zIiwiYXJyIl0sInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./src/scripts/game.js\n"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": function() { return /* binding */ Game; }\n/* harmony export */ });\n/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.slice.js */ \"./node_modules/core-js/modules/es.array.slice.js\");\n/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ \"./node_modules/core-js/modules/es.object.to-string.js\");\n/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ \"./node_modules/core-js/modules/web.dom-collections.for-each.js\");\n/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.regexp.exec.js */ \"./node_modules/core-js/modules/es.regexp.exec.js\");\n/* harmony import */ var core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_regexp_exec_js__WEBPACK_IMPORTED_MODULE_3__);\n/* harmony import */ var core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.string.split.js */ \"./node_modules/core-js/modules/es.string.split.js\");\n/* harmony import */ var core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_split_js__WEBPACK_IMPORTED_MODULE_4__);\n/* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.string.replace.js */ \"./node_modules/core-js/modules/es.string.replace.js\");\n/* harmony import */ var core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_replace_js__WEBPACK_IMPORTED_MODULE_5__);\n/* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/es.promise.js */ \"./node_modules/core-js/modules/es.promise.js\");\n/* harmony import */ var core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_promise_js__WEBPACK_IMPORTED_MODULE_6__);\n/* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! regenerator-runtime/runtime.js */ \"./node_modules/regenerator-runtime/runtime.js\");\n/* harmony import */ var regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(regenerator_runtime_runtime_js__WEBPACK_IMPORTED_MODULE_7__);\n/* harmony import */ var _deck_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./deck.js */ \"./src/scripts/deck.js\");\n/* harmony import */ var _board_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./board.js */ \"./src/scripts/board.js\");\n/* harmony import */ var _player__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./player */ \"./src/scripts/player.js\");\n\n\n\n\n\n\n\n\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\n// import Player from './player.js';\n\n\n\n\nvar Game = /*#__PURE__*/function () {\n function Game() {\n _classCallCheck(this, Game);\n\n this.activeGame = false;\n this.gameWin = false;\n this.gameWinType = '';\n this.gameWinColor = '';\n this.targetPos = null; // checkHighlight\n\n this.targetCard = null;\n this.targetMoves = null;\n this.activePawn = null; // checkHighlight\n\n this.activeCard = null; // checkHighlight\n\n this.currentPlayerIdx = 0; // aid with dealing cards\n\n this.players = [new _player__WEBPACK_IMPORTED_MODULE_10__[\"default\"](\"Player 1\", \"Blue\"), new _player__WEBPACK_IMPORTED_MODULE_10__[\"default\"](\"Player 2\", \"Red\")];\n this.player = this.currentPlayer;\n this.deck = new _deck_js__WEBPACK_IMPORTED_MODULE_8__[\"default\"]();\n this.board = new _board_js__WEBPACK_IMPORTED_MODULE_9__[\"default\"](); // Window debugging:\n\n window.board = this.board;\n window.deck = this.deck;\n window.players = this.players;\n window.player = this.player;\n window.otherPlayer = this.otherPlayer;\n } // getter access like a property:\n\n\n _createClass(Game, [{\n key: \"currentPlayer\",\n get: function get() {\n return this.players[this.currentPlayerIdx];\n }\n }, {\n key: \"otherPlayer\",\n get: function get() {\n return this.players[(this.currentPlayerIdx + 1) % 2];\n } // always 0 or 1 using %\n\n }, {\n key: \"swapTurn\",\n value: function () {\n var _swapTurn = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {\n return regeneratorRuntime.wrap(function _callee$(_context) {\n while (1) {\n switch (_context.prev = _context.next) {\n case 0:\n this.currentPlayerIdx = (this.currentPlayerIdx + 1) % 2;\n this.player = this.currentPlayer;\n window.player = this.player;\n\n case 3:\n case \"end\":\n return _context.stop();\n }\n }\n }, _callee, this);\n }));\n\n function swapTurn() {\n return _swapTurn.apply(this, arguments);\n }\n\n return swapTurn;\n }() // deal alternates between players until 4, then on-deck\n\n }, {\n key: \"dealCard\",\n value: function dealCard() {\n var card = this.deck.deal();\n this.currentPlayer.dealCard(card);\n this.swapTurn();\n } // event handled in index.js \n\n }, {\n key: \"start\",\n value: function start() {\n for (var i = 0; i < 4; i++) {\n this.dealCard();\n }\n\n this.onDeckCard = this.deck.deal();\n this.activeGame = true;\n this.board.setBoard();\n this.swapClickEvents(\"red\");\n } // all moves\n\n }, {\n key: \"possibleMoves\",\n value: function possibleMoves(card, startPos) {\n // all possible\n var that = this;\n\n if (that.currentPlayerIdx === 0) {\n return that.blueMoves(card, startPos);\n } else {\n return that.redMoves(card, startPos);\n }\n } // limits actual moves by empty and color\n\n }, {\n key: \"allowedMoves\",\n value: function allowedMoves(card, startPos) {\n var that = this;\n if (!that.board.validPos(startPos)) return false;\n var allMoves = that.possibleMoves(card, startPos); // \n\n var realMoves = [];\n\n for (var i = 0; i < allMoves.length; i++) {\n // ;\n if (that.board.validPos(allMoves[i])) {\n if (that.board.isEmpty(allMoves[i]) === true) {\n realMoves.push(allMoves[i]);\n } else {\n if (that.board.getPiece(allMoves[i]).color !== that.player.color.toLowerCase()) {\n realMoves.push(allMoves[i]);\n }\n }\n }\n }\n\n return realMoves;\n }\n }, {\n key: \"blueMoves\",\n value: function blueMoves(card, startPos) {\n var that = this;\n\n for (var i = 0; i < that.player.hand.length; i++) {\n if (that.player.hand[i] === card) {\n // changed from includes\n // console.log(\"ok\");\n var moves = that.player.hand[i].slice(1);\n var possiblePos = [];\n\n for (var j = 0; j < moves.length; j++) {\n var row = startPos[0] + moves[j][0];\n var col = startPos[1] + moves[j][1];\n possiblePos.push([row, col]);\n }\n\n return possiblePos;\n } else {// console.log(\"Card is not in your hand\"); // all returning else\n }\n }\n }\n }, {\n key: \"oppMoves\",\n value: function oppMoves(moves) {\n // flips opponent possible pos \n var newMoves = []; // console.log(moves);\n\n for (var i = 0; i < moves.length; i++) {\n var subArr = [];\n\n for (var j = 0; j < moves[0].length; j++) {\n var ele = moves[i][j];\n\n if (ele === 0) {\n subArr.push(ele);\n } else {\n subArr.push(moves[i][j] * -1);\n }\n }\n\n newMoves.push(subArr);\n }\n\n return newMoves;\n }\n }, {\n key: \"redMoves\",\n value: function redMoves(card, startPos) {\n var that = this;\n\n for (var i = 0; i < that.player.hand.length; i++) {\n if (that.player.hand[i] === card) {\n // changed from .includes \n var moves = that.player.hand[i].slice(1);\n var movesRev = that.oppMoves(moves);\n var possiblePos = [];\n\n for (var j = 0; j < movesRev.length; j++) {\n var row = startPos[0] + movesRev[j][0];\n var col = startPos[1] + movesRev[j][1];\n possiblePos.push([row, col]);\n }\n\n return possiblePos;\n } else {// console.log(\"Card is not in your hand\");\n }\n }\n }\n }, {\n key: \"checkHighlight\",\n value: function checkHighlight() {\n var allCards = document.querySelectorAll(\".back\");\n var allPawns = document.querySelectorAll(\"#pawn\");\n var that = this;\n allPawns.forEach(function (pawn) {\n if (pawn.classList.contains(\"active-pawn\")) {\n that.activePawn = pawn;\n that.targetPos = that.currentPos(pawn); // console.log(\"Found active pawn!\");\n }\n });\n allCards.forEach(function (card) {\n if (card.classList.contains(\"active-card\")) {\n // console.log(\"Found active card!\");\n that.activeCard = card;\n that.targetCard = that.currentCard(card);\n }\n });\n\n if (that.activePawn !== null && that.activeCard !== null) {\n // console.log(\"Both Active!\");\n that.targetMoves = that.viewMoves(); // highlight pos \n } else {\n return false;\n }\n } // sets game.targetPos in checkHighlight\n\n }, {\n key: \"currentPos\",\n value: function currentPos(pawnEl) {\n // const that = this;\n var pos = [];\n var posStr = pawnEl.parentElement.id;\n var strArr = posStr.slice(1, posStr.length).split(\",\");\n\n for (var i = 0; i < strArr.length; i++) {\n pos.push(parseInt(strArr[i]));\n }\n\n return pos;\n } // sets game.targetCard in checkHighlight\n\n }, {\n key: \"currentCard\",\n value: function currentCard(cardEl) {\n // console.log(\"in currentCard\");\n var that = this;\n var cardStr = cardEl.id.slice(4);\n var cardNum = parseInt(cardStr);\n if (cardNum === 1) return that.players[0].hand[0];\n if (cardNum === 2) return that.players[0].hand[1];\n if (cardNum === 3) return null; // need onDeck? Maybe not.\n\n if (cardNum === 4) return that.players[1].hand[0];\n if (cardNum === 5) return that.players[1].hand[1];\n }\n }, {\n key: \"viewMovePiece\",\n value: function viewMovePiece(posEndEle) {\n var that = this;\n var posStart = that.currentPos(that.activePawn);\n var posEnd = that.convertStrPos(posEndEle.id);\n\n if (board.grid[posEnd[0]][posEnd[1]] !== null) {\n that.board.removePiece(posEnd);\n that.board.viewRemovePiece(posEnd); // takes piece\n }\n\n that.board.movePiece(posStart, posEnd); // coded movePiece calls viewPlacePiece\n\n var piece = that.board.getPiece(posEnd); // Piece\n\n that.board.viewRemovePiece(posStart); // remove old pos\n // WIN CHECK\n\n setTimeout(function () {\n if (that.checkWin()) {\n that.modalWin();\n }\n }, 1000); // TURN SWAP \n\n setTimeout(function () {\n that.viewSwapTurn();\n }, 2000);\n }\n }, {\n key: \"viewSwapUsedCard\",\n value: function () {\n var _viewSwapUsedCard = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(playedCardEl, deckCardEl) {\n var that, currentHand, playedCard, deckCard, playedCardIdx, i, newPlayerCard, newDeckCard;\n return regeneratorRuntime.wrap(function _callee2$(_context2) {\n while (1) {\n switch (_context2.prev = _context2.next) {\n case 0:\n // console.log(\"in swap used\");\n that = this;\n currentHand = that.player.hand;\n playedCard = that.currentCard(playedCardEl);\n deckCard = that.onDeckCard;\n playedCardIdx = null;\n\n for (i = 0; i < currentHand.length; i++) {\n if (playedCard === currentHand[i]) playedCardIdx = i;\n } // board swap\n\n\n newPlayerCard = deckCard;\n newDeckCard = playedCard;\n currentHand[playedCardIdx] = newPlayerCard;\n deckCard = newDeckCard;\n this.onDeckCard = newDeckCard; // new\n // view swap\n\n that.deck.viewDealSwap(newPlayerCard, playedCardEl);\n that.deck.viewDealSwap(newDeckCard, deckCardEl);\n\n case 13:\n case \"end\":\n return _context2.stop();\n }\n }\n }, _callee2, this);\n }));\n\n function viewSwapUsedCard(_x, _x2) {\n return _viewSwapUsedCard.apply(this, arguments);\n }\n\n return viewSwapUsedCard;\n }()\n }, {\n key: \"checkWin\",\n value: function checkWin() {\n var that = this;\n\n if (that.board.checkWinStone() !== false) {\n var winResults = that.board.checkWinStone();\n this.activeGame = false;\n this.gameWin = true;\n this.gameWinType = winResults[1];\n this.gameWinColor = winResults[0];\n return true;\n }\n\n if (that.board.checkWinStream() !== false) {\n var _winResults = that.board.checkWinStream();\n\n this.activeGame = false;\n this.gameWin = true;\n this.gameWinType = _winResults[1];\n this.gameWinColor = _winResults[0];\n return true;\n }\n\n return false;\n }\n }, {\n key: \"modalWin\",\n value: function modalWin() {\n var modalWin = document.querySelector(\".modal__win\");\n var winColor = \"\".concat(this.gameWinColor, \" Wins!\");\n var winType = \"Way of \".concat(this.gameWinType);\n document.querySelector(\".win-color\").innerHTML = winColor;\n document.querySelector(\".win-type\").innerHTML = winType;\n modalWin.style.display = 'flex';\n }\n }, {\n key: \"swapClickEvents\",\n value: function swapClickEvents(color) {\n debugger;\n var allPawns = document.querySelectorAll(\"#pawn\");\n allPawns.forEach(function (pawn) {\n if (pawn.classList.contains(\"\".concat(color, \"-student-piece\")) || pawn.classList.contains(\"\".concat(color, \"-master-piece\"))) {\n pawn.style.pointerEvents = \"none\";\n } else {\n pawn.style.pointerEvents = \"all\";\n }\n });\n }\n }, {\n key: \"viewSwapTurn\",\n value: function viewSwapTurn() {\n var that = this;\n var playedCard = document.querySelector(\".active-card\");\n var deckCard = document.querySelector(\"#back3\");\n var body = document.querySelector(\".body\");\n var turnRedCircle = document.querySelector(\".turn-red-circle\");\n var turnBlueCircle = document.querySelector(\".turn-blue-circle\");\n\n if (that.currentPlayerIdx === 0) {\n body.classList.replace(\"turn-blue\", \"turn-red\");\n turnBlueCircle.style.visibility = 'hidden';\n turnRedCircle.style.visibility = 'visible';\n that.swapClickEvents(\"blue\");\n } else {\n body.classList.replace(\"turn-red\", \"turn-blue\");\n turnRedCircle.style.visibility = 'hidden';\n turnBlueCircle.style.visibility = 'visible';\n that.swapClickEvents(\"red\");\n } // squares remove highlight\n\n\n var allSquares = document.getElementsByClassName('square');\n\n for (var i = 0; i < allSquares.length; i++) {\n // allSquares[i].classList.replace(\"active\", \"inactive\");\n allSquares[i].classList.remove(\"active\");\n allSquares[i].classList.add(\"inactive\");\n } // pawns remove highlight\n\n\n var allPawns = document.querySelectorAll(\"#pawn\");\n allPawns.forEach(function (pawn) {\n if (pawn.classList.contains(\"active-pawn\")) {\n // pawn.classList.replace(\"active-pawn\", \"inactive-pawn\");\n pawn.classList.remove(\"active-pawn\");\n pawn.classList.add(\"inactive-pawn\");\n }\n }); // hide used cards\n\n setTimeout(function () {\n // flip used\n that.deck.viewToggleFlipTurn().then(setTimeout(function () {\n // swap used\n that.viewSwapUsedCard(playedCard, deckCard).then(setTimeout(function () {\n // flip back\n that.deck.viewToggleFlipTurn().then(setTimeout(function () {\n // rm highlight\n that.viewRemoveCardHighlight().then( // swap turn @ board\n that.swapTurn());\n }, 600));\n }, 600));\n }, 600));\n }, 1000);\n } // card remove highlight\n\n }, {\n key: \"viewRemoveCardHighlight\",\n value: function () {\n var _viewRemoveCardHighlight = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {\n var allCards;\n return regeneratorRuntime.wrap(function _callee3$(_context3) {\n while (1) {\n switch (_context3.prev = _context3.next) {\n case 0:\n allCards = document.querySelectorAll(\".back\");\n allCards.forEach(function (card) {\n card.classList.remove(\"active-card\");\n card.classList.add(\"inactive-card\");\n });\n\n case 2:\n case \"end\":\n return _context3.stop();\n }\n }\n }, _callee3);\n }));\n\n function viewRemoveCardHighlight() {\n return _viewRemoveCardHighlight.apply(this, arguments);\n }\n\n return viewRemoveCardHighlight;\n }()\n }, {\n key: \"viewMoves\",\n value: function viewMoves() {\n var that = this;\n var highlightMoves = that.allowedMoves(that.targetCard, that.targetPos);\n var viewSquares = [];\n\n for (var i = 0; i < highlightMoves.length; i++) {\n var squareSelector = JSON.stringify(highlightMoves[i]);\n var square = document.getElementById(squareSelector);\n viewSquares.push(square);\n }\n\n var allSquares = document.getElementsByClassName('square');\n\n for (var _i = 0; _i < allSquares.length; _i++) {\n allSquares[_i].classList.remove(\"active\");\n\n allSquares[_i].classList.add(\"inactive\");\n }\n\n for (var _i2 = 0; _i2 < viewSquares.length; _i2++) {\n viewSquares[_i2].classList.add(\"active\");\n\n viewSquares[_i2].classList.remove(\"inactive\");\n }\n\n return highlightMoves;\n } // '[1,2]' to [1,2]\n\n }, {\n key: \"convertStrPos\",\n value: function convertStrPos(strPos) {\n var arr = [];\n var strArr = strPos.slice(1, 4).split(','); // ['1', '2']\n\n strArr.forEach(function (ele) {\n arr.push(parseInt(ele));\n });\n return arr;\n }\n }]);\n\n return Game;\n}(); // consider adding a KEY:value list of variables like pawn, master, or player \n\n\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9zcmMvc2NyaXB0cy9nYW1lLmpzLmpzIiwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBO0FBQ0E7QUFDQTtBQUNBOztJQUVxQkc7QUFDbkIsa0JBQWM7QUFBQTs7QUFDWixTQUFLQyxVQUFMLEdBQWtCLEtBQWxCO0FBQ0EsU0FBS0MsT0FBTCxHQUFlLEtBQWY7QUFDQSxTQUFLQyxXQUFMLEdBQW1CLEVBQW5CO0FBQ0EsU0FBS0MsWUFBTCxHQUFvQixFQUFwQjtBQUNBLFNBQUtDLFNBQUwsR0FBaUIsSUFBakIsQ0FMWSxDQUtjOztBQUMxQixTQUFLQyxVQUFMLEdBQWtCLElBQWxCO0FBQ0EsU0FBS0MsV0FBTCxHQUFtQixJQUFuQjtBQUNBLFNBQUtDLFVBQUwsR0FBa0IsSUFBbEIs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4gICAgICB9XG4gICAgfSk7XG5cblxuICAgIFxuICAgIC8vIGhpZGUgdXNlZCBjYXJkc1xuICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgLy8gZmxpcCB1c2VkXG4gICAgICB0aGF0LmRlY2sudmlld1RvZ2dsZUZsaXBUdXJuKCkudGhlbihcbiAgICAgICAgc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAgLy8gc3dhcCB1c2VkXG4gICAgICAgICAgdGhhdC52aWV3U3dhcFVzZWRDYXJkKHBsYXllZENhcmQsIGRlY2tDYXJkKS50aGVuKFxuICAgICAgICAgICAgc2V0VGltZW91dCgoKSA9PiB7XG4gICAgICAgICAgICAgIC8vIGZsaXAgYmFja1xuICAgICAgICAgICAgICB0aGF0LmRlY2sudmlld1RvZ2dsZUZsaXBUdXJuKCkudGhlbihcbiAgICAgICAgICAgICAgICBzZXRUaW1lb3V0KCgpID0+IHtcbiAgICAgICAgICAgICAgICAgIC8vIHJtIGhpZ2hsaWdodFxuICAgICAgICAgICAgICAgICAgdGhhdC52aWV3UmVtb3ZlQ2FyZEhpZ2hsaWdodCgpLnRoZW4oXG4gICAgICAgICAgICAgICAgICAgIC8vIHN3YXAgdHVybiBAIGJvYXJkXG4gICAgICAgICAgICAgICAgICAgIHRoYXQuc3dhcFR1cm4oKVxuICAgICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICB9LCA2MDApXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9LCA2MDApXG4gICAgICAgICAgKTtcbiAgICAgICAgfSwgNjAwKVxuICAgICAgKTtcbiAgICB9LCAxMDAwKTtcbiAgfVxuXG4gIC8vIGNhcmQgcmVtb3ZlIGhpZ2hsaWdodFxuICBhc3luYyB2aWV3UmVtb3ZlQ2FyZEhpZ2hsaWdodCgpIHtcbiAgICBsZXQgYWxsQ2FyZHMgPSBkb2N1bWVudC5xdWVyeVNlbGVjdG9yQWxsKFwiLmJhY2tcIik7XG4gICAgYWx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VyeVNlbGVjdG9yIiwid2luQ29sb3IiLCJ3aW5UeXBlIiwiaW5uZXJIVE1MIiwic3R5bGUiLCJkaXNwbGF5IiwicG9pbnRlckV2ZW50cyIsImJvZHkiLCJ0dXJuUmVkQ2lyY2xlIiwidHVybkJsdWVDaXJjbGUiLCJyZXBsYWNlIiwidmlzaWJpbGl0eSIsImFsbFNxdWFyZXMiLCJnZXRFbGVtZW50c0J5Q2xhc3NOYW1lIiwicmVtb3ZlIiwiYWRkIiwidmlld1RvZ2dsZUZsaXBUdXJuIiwidGhlbiIsInZpZXdTd2FwVXNlZENhcmQiLCJ2aWV3UmVtb3ZlQ2FyZEhpZ2hsaWdodCIsImhpZ2hsaWdodE1vdmVzIiwiYWxsb3dlZE1vdmVzIiwidmlld1NxdWFyZXMiLCJzcXVhcmVTZWxlY3RvciIsIkpTT04iLCJzdHJpbmdpZnkiLCJzcXVhcmUiLCJnZXRFbGVtZW50QnlJZCIsInN0clBvcyIsImFyciJdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./src/scripts/game.js\n"); /***/ }), diff --git a/src/scripts/game.js b/src/scripts/game.js index 9bb25ef..0220b50 100644 --- a/src/scripts/game.js +++ b/src/scripts/game.js @@ -60,6 +60,7 @@ export default class Game { this.onDeckCard = this.deck.deal(); this.activeGame = true; this.board.setBoard(); + this.swapClickEvents("red"); } // all moves @@ -284,6 +285,20 @@ export default class Game { } + + swapClickEvents(color) { + debugger; + let allPawns = document.querySelectorAll("#pawn"); + allPawns.forEach(function (pawn) { + if (pawn.classList.contains(`${color}-student-piece`) + || pawn.classList.contains(`${color}-master-piece`)) { + pawn.style.pointerEvents = "none"; + } else { + pawn.style.pointerEvents = "all"; + } + }); + } + viewSwapTurn() { let that = this; let playedCard = document.querySelector(".active-card"); @@ -294,22 +309,23 @@ export default class Game { if (that.currentPlayerIdx === 0) { - // body.classList.remove("turn-blue") body.classList.replace("turn-blue", "turn-red"); turnBlueCircle.style.visibility = 'hidden'; turnRedCircle.style.visibility = 'visible'; + that.swapClickEvents("blue"); } else { body.classList.replace("turn-red", "turn-blue"); turnRedCircle.style.visibility = 'hidden'; turnBlueCircle.style.visibility = 'visible'; - + that.swapClickEvents("red"); } // squares remove highlight let allSquares = document.getElementsByClassName('square'); for (let i = 0; i < allSquares.length; i++) { + // allSquares[i].classList.replace("active", "inactive"); allSquares[i].classList.remove("active"); allSquares[i].classList.add("inactive"); } @@ -318,6 +334,7 @@ export default class Game { let allPawns = document.querySelectorAll("#pawn"); allPawns.forEach(function (pawn) { if (pawn.classList.contains("active-pawn")) { + // pawn.classList.replace("active-pawn", "inactive-pawn"); pawn.classList.remove("active-pawn"); pawn.classList.add("inactive-pawn"); }