From bccd2f0778714b73c4dcf66b9524ed942ce7f770 Mon Sep 17 00:00:00 2001 From: LCJ <1119884256@qq.com> Date: Sat, 19 Sep 2020 17:53:13 +0800 Subject: [PATCH] =?UTF-8?q?AI=20=E5=BB=B6=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/doudizhu/Player.js | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/doudizhu/Player.js b/src/doudizhu/Player.js index 18681af..ddc465f 100644 --- a/src/doudizhu/Player.js +++ b/src/doudizhu/Player.js @@ -39,12 +39,15 @@ class Player{ playByAI(){ - let lastObj = this.getLastObj(); - if(lastObj){ - this.playByObj(lastObj); - }else{ - this.playByAllType(); - } + let that = this; + setTimeout(function () { + let lastObj = that.getLastObj(); + if(lastObj){ + that.playByObj(lastObj); + }else{ + that.playByAllType(); + } + },1000); } @@ -818,11 +821,21 @@ class Player{ } playByPokerList(pokerList){ + if(this.game.currentPlayer!==this){ + alert('请等待 '+this.game.currentPlayer.name+' 出牌'); + return false; + } + let list = this.getListByList(pokerList); return this.handleList(list); } playByString(str){ + if(this.game.currentPlayer!==this){ + alert('请等待 '+this.game.currentPlayer.name+' 出牌'); + return false; + } + let list = this.getListByString(str); return this.handleList(list); } -- GitLab