From 410e6e1f363daacb7adb1a5173257a448384540d Mon Sep 17 00:00:00 2001 From: strinsberg Date: Mon, 15 Jun 2020 12:44:17 -0600 Subject: [PATCH 1/4] Started reworking turn area so it is not possible to take AI turns for them if we add time to make their turn more natural. --- src/components/game/TurnArea.vue | 14 ++++++++------ src/components/game/TurnAreaCard.vue | 28 +++++++++++++++++----------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/components/game/TurnArea.vue b/src/components/game/TurnArea.vue index c5e6ca94..afa15c53 100644 --- a/src/components/game/TurnArea.vue +++ b/src/components/game/TurnArea.vue @@ -75,12 +75,14 @@ export default { 'executeTurn', ]), redrawHand () { - this.executeTurn({ - playType: "REDRAW", - card: undefined, - player: this.activePlayer, - target: this.activePlayer - }) + if (!this.activePlayer.isAi) { + this.executeTurn({ + playType: "REDRAW", + card: undefined, + player: this.activePlayer, + target: this.activePlayer + }) + } } }, created () { diff --git a/src/components/game/TurnAreaCard.vue b/src/components/game/TurnAreaCard.vue index 6954f17d..d4382a75 100644 --- a/src/components/game/TurnAreaCard.vue +++ b/src/components/game/TurnAreaCard.vue @@ -1,20 +1,26 @@ From 959131eb78514e12d1bcacae296378e45fef91d8 Mon Sep 17 00:00:00 2001 From: strinsberg Date: Mon, 15 Jun 2020 12:45:28 -0600 Subject: [PATCH 2/4] Fixed lint error --- src/classes/ai/aiHelpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/classes/ai/aiHelpers.js b/src/classes/ai/aiHelpers.js index 73843fc8..356bac3d 100644 --- a/src/classes/ai/aiHelpers.js +++ b/src/classes/ai/aiHelpers.js @@ -105,7 +105,7 @@ function groupStacks (groupValue, stacks) { let group = new Set() let i = groupValue let j = stacks.length - while (true) { // eslint-disable-line FIX this + while (true) { // eslint-disable-line let cell = dp[i][j] // add used elements to the group if (cell.used) { From bbcc1758ef50eb6166e3becfd6356dfa0a67efe7 Mon Sep 17 00:00:00 2001 From: strinsberg Date: Mon, 15 Jun 2020 13:07:23 -0600 Subject: [PATCH 3/4] Made it impossible to play an AI players cards or redraw for them. Also, put a sleep on the AI turn for 1.5 sec so that it feels a little more natural. This exposed the flaw that was in the message box, it was being recreated by it's parent because of a poorly placed :key. I fixed it and it now is only created once. --- src/components/game/MessageBox.vue | 7 ++----- src/components/game/TurnArea.vue | 4 ++-- src/store/actions.js | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/components/game/MessageBox.vue b/src/components/game/MessageBox.vue index 9c36e976..e320cdd2 100644 --- a/src/components/game/MessageBox.vue +++ b/src/components/game/MessageBox.vue @@ -1,5 +1,5 @@ @@ -31,8 +31,6 @@ export default { ]) }, created () { - // Somehow message box is being destroyed and created so there are two - // listeners for this. bus.$on('ai-action', ({move}) => { const name = move.player.name if (move.playType === 'startNewStack') { @@ -41,7 +39,6 @@ export default { } else if (move.playType === 'playCardOnStack') { const newStack = this.stacks.find(s => s.stackId === move.target.stackId) - // Issue with newStack being undefined, probably related to the above issue if (newStack && newStack.isComplete()) { this.message = name + " completed a stack worth " + newStack.getScore() + " points" @@ -76,7 +73,7 @@ export default {