From fae13e84aa1d42a6b28307e942d14051f1fc3228 Mon Sep 17 00:00:00 2001 From: null Date: Wed, 3 Apr 2024 12:38:00 -0500 Subject: [PATCH] added discard method to player --- src/model.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/model.ts b/src/model.ts index e1039a5..a95a93b 100644 --- a/src/model.ts +++ b/src/model.ts @@ -123,6 +123,15 @@ class Player { this.hp = 25; this.actions = 2; } + + discard(index: number = -1) { + if(index == -1){ + index = Math.floor(Math.random()*this.hand.length) + } + + this.discardPile.push(this.hand[index]) + this.hand.splice(index,1) + } } class BoardPos {