Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/classes/ai/aiHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
7 changes: 2 additions & 5 deletions src/components/game/MessageBox.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div id="message-b" :key="message">
<div id="message-box" :key="message">
{{ message }}
</div>
</template>
Expand Down Expand Up @@ -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') {
Expand All @@ -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"
Expand Down Expand Up @@ -76,7 +73,7 @@ export default {


<style scoped>
#message-b {
#message-box {
position: relative;
left: 0px;
width: 100%;
Expand Down
18 changes: 10 additions & 8 deletions src/components/game/TurnArea.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div id="turn-area" v-bind:key="update">
<div id="turn-area">
<button class="btn btn-sm btn-info col-6" v-on:click="redrawHand"
style="border-radius: 40px; margin-top: 1%;"
title="Discard your hand and draw 5 new cards">
Expand All @@ -22,7 +22,7 @@
</info-popup>
</div>

<div id="cards">
<div id="cards" :key="update">
<ul>
<li v-for="card in getCurrentPlayerHand.cards" v-bind:key="card.id">
<turn-area-card :card="card"></turn-area-card>
Expand Down Expand Up @@ -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 () {
Expand Down
28 changes: 17 additions & 11 deletions src/components/game/TurnAreaCard.vue
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
<template>
<div id="turn-area-card" v-on:mouseover="select"
draggable v-on:dragstart="startDrag($event)" :ondragstart="ondragstart">
<div id="turn-area-card">

<img v-if="activePlayer.isAi" src="static/cardImages/backOfCard.png" class="card">
<img v-else :src="card.image" class="card">
<div id="player-card" v-if="!activePlayer.isAi" v-on:mouseover="select"
draggable v-on:dragstart="startDrag($event)" :ondragstart="ondragstart">

<div v-if="isShowing" id="overlays" class="play">
<input type="image" id="discard-button"
title="Discard Card"
src="static/miscIcons/trash.png"
v-on:click="discard">
<img :src="card.image" class="card">

<effect-card-popup></effect-card-popup>
<div v-if="isShowing" id="overlays" class="play">
<input type="image" id="discard-button"
title="Discard Card"
src="static/miscIcons/trash.png"
v-on:click="discard">

<effect-card-popup></effect-card-popup>

</div>
</div>

<div v-else ondragstart="return false;">
<img src="static/cardImages/backOfCard.png" class="card">
</div>
</div>
</div>
</template>


Expand Down
8 changes: 6 additions & 2 deletions src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ export default {
}

context.commit('addPlayedCard', payload)
context.dispatch('endTurn', {draw: draw})
if (context.state.activePlayer.isAi) {
setTimeout(() => {context.dispatch('endTurn', {draw: draw})}, 800)
} else {
context.dispatch('endTurn', {draw: draw})
}
},

/**
Expand Down Expand Up @@ -109,7 +113,7 @@ export default {
// Change active player and take AI turn if needed
context.commit('nextPlayer')
if (context.state.activePlayer.isAi) {
context.dispatch('takeAiTurn')
setTimeout(() => {context.dispatch('takeAiTurn')}, 700)
}
},

Expand Down