From b37debbd0c8e4b0c5de8eec4fe8f13295fe9b992 Mon Sep 17 00:00:00 2001 From: WEBXOSS <webxoss@gmail.com> Date: Sun, 30 Oct 2016 21:53:40 +0800 Subject: [PATCH] Trash charms and other cards below a SIGNI in block end. See http://www.takaratomy.co.jp/products/wixoss/rule/rule_rulechange/151211/index.html for details. --- Card.js | 15 ++++++++++----- Game.js | 7 +++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Card.js b/Card.js index f469cd6..4ea1ca9 100644 --- a/Card.js +++ b/Card.js @@ -831,11 +831,16 @@ Card.prototype.moveTo = function (zone,arg) { // card.player.onSignisChange.trigger(); card.onLeaveField.trigger(leaveFieldEvent); card.player.onSigniLeaveField.trigger(leaveFieldEvent); - // SIGNI 离场时,下面的卡送入废弃区 - if (leaveFieldEvent.oldZone.cards.length) { - if (charm) charm.trash({isCharm: true}); - this.game.trashCards(leaveFieldEvent.oldZone.cards); - } + // SIGNI 离场时,下面的卡送入废弃区, + // 此处理在块结束时执行。 + // http://www.takaratomy.co.jp/products/wixoss/rule/rule_rulechange/151211/index.html + leaveFieldEvent.oldZone.cards.forEach(function (card) { + if (card === charm) { + card.game.trashingCharms.push(card); + } else { + card.game.trashingCards.push(card); + } + },this); } else if (lrigChangeEvent) { // card.player.onLrigChange.trigger(lrigChangeEvent); var oldLrig = lrigChangeEvent.oldLrig; diff --git a/Game.js b/Game.js index e82f5b3..654f2bf 100644 --- a/Game.js +++ b/Game.js @@ -22,6 +22,8 @@ function Game (cfg) { this.hostMsgObjs = []; this.guestMsgObjs = []; this.dataObj = {}; // 储存游戏对象(card,player 等)绑定的数据,回合结束时清空 + this.trashingCards = []; + this.trashingCharms = []; // 注册 this.register(this); @@ -905,6 +907,11 @@ Game.prototype.handleBlockEndAsyn = function () { this.frameEnd(); return this.banishNonPositiveAsyn(); }).callback(this,function () { + // 废弃【魅饰】和SIGNI下方的卡 + this.trashCards(this.trashingCharms,{ isCharm: true }); + this.trashCards(this.trashingCards); + this.trashingCharms.length = 0; + this.trashingCards.length = 0; return this.rebuildAsyn(); }).callback(this,function () { return this.effectManager.handleEffectsAsyn();