From 785ba75b1c0d43e045a4155486db781df1cfce8d Mon Sep 17 00:00:00 2001 From: WEBXOSS Date: Sat, 10 Jun 2017 22:35:31 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20moving=20trap=20when=20rea?= =?UTF-8?q?rrange=20signis?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Card.js | 4 ++-- Zone.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Card.js b/Card.js index 2c4f9db..dbb03e9 100644 --- a/Card.js +++ b/Card.js @@ -1141,8 +1141,8 @@ Card.prototype.changeSigniZone = function (zone) { // 交换 zone.cards var oldZone = this.zone; - var tmp = oldZone.cards; - oldZone.cards = zone.cards; + var tmp = oldZone.getNonTrapCards().concat(zone.trap || []); + oldZone.cards = zone.getNonTrapCards().concat(oldZone.trap || []); zone.cards = tmp; // 设置 card.zone oldZone.cards.forEach(function (card) { diff --git a/Zone.js b/Zone.js index 95ed54e..b22e29c 100644 --- a/Zone.js +++ b/Zone.js @@ -59,6 +59,12 @@ Zone.prototype.getActualCards = function () { },this); }; +Zone.prototype.getNonTrapCards = function() { + return this.cards.filter(function (card) { + return (card !== this.trap); + },this); +}; + Zone.prototype.getSigni = function() { return this.player.signis.filter(function (signi) { return signi.zone === this;