|
|
@ -23,6 +23,8 @@ export default class Game { |
|
|
|
this._playerAmount = playerAmount; //Anzahl der Spieler
|
|
|
|
this._rules = rules; //Array mit Regeln für das Spiel
|
|
|
|
|
|
|
|
this._stack = 0; //Für PlusAmountKarten
|
|
|
|
|
|
|
|
//Für HTML
|
|
|
|
this._style = new Style(this); |
|
|
|
|
|
|
@ -173,6 +175,28 @@ export default class Game { |
|
|
|
|
|
|
|
//HTML
|
|
|
|
this.style.refreshHtml(); |
|
|
|
|
|
|
|
//PlusAmount
|
|
|
|
let cardName = (this.cardOnDeck.name === "+4" || this.cardOnDeck.name === '+2') ? '+' : null; |
|
|
|
if (cardName === '+') { |
|
|
|
for (let i = 0; i < this.currentPlayerInstanz.hand.length; i++) { |
|
|
|
if (this.currentPlayerInstanz.hand[i].name === this.cardOnDeck.name) { |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.stack !== 0) { |
|
|
|
setTimeout(() => { |
|
|
|
|
|
|
|
this.currentPlayerInstanz.drawCard(this.stack, false, true); |
|
|
|
this.stack = 0; |
|
|
|
|
|
|
|
}, 600); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, delay) |
|
|
|
|
|
|
|
} |
|
|
@ -184,6 +208,18 @@ export default class Game { |
|
|
|
|
|
|
|
//Gehe alle Karten vom Deck durch
|
|
|
|
for (let i = 0; i < currentPlayerCards.length; i++) { |
|
|
|
if (this.stack !== 0) { |
|
|
|
if (this.cardOnDeck.name === '+4' || this.cardOnDeck.name === '+2') { |
|
|
|
|
|
|
|
for (let j = 0; j < currentPlayerCards.length; j++) { |
|
|
|
if (currentPlayerCards[j].name.toString() === this.cardOnDeck.name.toString()) { |
|
|
|
this.players[this.currentPlayer].hand[j].canPut = true; |
|
|
|
this.players[this.currentPlayer].canPlay = true; |
|
|
|
} else this.players[this.currentPlayer].hand[j].canPut = false; |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//Wenn Farbe oder Zahl gleich oder eine Karte, die keine Farbe hat
|
|
|
|
if (this.cardOnDeck.name.toString() === currentPlayerCards[i].name.toString() || this.cardOnDeck.color === currentPlayerCards[i].color || currentPlayerCards[i].color === CARD_COLORS[0] || this.cardOnDeck.color === CARD_COLORS[0]) { |
|
|
@ -274,4 +310,12 @@ export default class Game { |
|
|
|
return this._style; |
|
|
|
} |
|
|
|
|
|
|
|
get stack() { |
|
|
|
return this._stack; |
|
|
|
} |
|
|
|
|
|
|
|
set stack(stack) { |
|
|
|
this._stack = stack; |
|
|
|
} |
|
|
|
|
|
|
|
} |