-
@@ -176,9 +208,15 @@
-
-
-
+
+
+
diff --git a/js/Blackjack.js b/js/Blackjack.js
index bdc9cee..c7b15b0 100644
--- a/js/Blackjack.js
+++ b/js/Blackjack.js
@@ -3,9 +3,10 @@ class Blackjack {
bank;
bet;
roundActive = false;
+ vue;
constructor(vue) {
- this.vue = vue;
+ this.vue = new Vue();
this.deck = CardDeck.createAndShuffle(vue);
this.bank = LunaBank.createEmpty();
// this.bank = new LunaBank(vue);
@@ -21,7 +22,6 @@ class Blackjack {
}
this.bank.money -= this.bet;
-
this.roundActive = true;
this.player.pickCard(this.deck.takeOneCard());
@@ -38,7 +38,6 @@ class Blackjack {
}
console.log('Round has started');
- return true;
}
pass() {
diff --git a/js/app.js b/js/app.js
index 7b5bde8..58b2d95 100644
--- a/js/app.js
+++ b/js/app.js
@@ -3,6 +3,7 @@ let app = new Vue({
data: {
initiated: false,
roundActive: false,
+ roundPlayed: false,
cardBack: 'img/cardBack_red5.png',
cards: [],
cardDeck: [],
@@ -165,27 +166,33 @@ let app = new Vue({
if (this.isPlus(this.handScore)) {
alertify.notify('Hand is plus, you lose.')
this.roundActive = false;
+ this.roundPlayed = true;
}
},
pass() {
if (this.dealerScore === this.handScore) {
this.roundActive = false;
+ this.roundPlayed = true;
alertify.notify('Draw!');
this.draw();
} else if (this.dealerScore > 21) {
this.roundActive = false;
+ this.roundPlayed = true;
alertify.notify('Dealer is plus, you win');
this.win();
} else if (this.dealerScore > this.handScore) {
this.roundActive = false;
+ this.roundPlayed = true;
alertify.notify('Dealer Wins');
} else if (this.dealerScore < 17) {
this.roundActive = false;
+ this.roundPlayed = true;
this.drawCardToDealer();
this.pass();
} else if (this.handScore > this.dealerScore && this.handScore < 22) {
this.roundActive = false;
+ this.roundPlayed = true;
alertify.notify('You win ' + this.bet * 1.5 + '!');
this.win();
}
@@ -201,6 +208,7 @@ let app = new Vue({
endRound() {
this.roundActive = false;
+ this.roundPlayed = true;
this.lastCard = null;
this.status = null;
this.dealersHand = [];