From ada169136aca35852db86bd913321f651fb50429 Mon Sep 17 00:00:00 2001 From: WEBXOSS Date: Wed, 4 Oct 2017 15:50:03 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20implement=20source=20in=20handle?= =?UTF-8?q?TrapAsyn=20(for=20WX17-029)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Card.js | 10 ++++++---- CardInfo.js | 3 +-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Card.js b/Card.js index 59caf04..21473fd 100644 --- a/Card.js +++ b/Card.js @@ -1355,7 +1355,7 @@ Card.prototype.attackAsyn = function () { if (opposingSigni || !trap) return; return this.player.opponent.selectOptionalAsyn('LAUNCH',[trap]).callback(this,function (card) { if (!card) return; - return card.handleTrapAsyn(event); + return card.handleTrapAsyn({event: event}); }); }).callback(this,function () { // 攻击被无效,结束处理 @@ -1853,8 +1853,10 @@ Card.prototype.isInfected = function() { return this.zone.virus; }; -Card.prototype.handleTrapAsyn = function(event) { - // 注意 event 是可选的! +Card.prototype.handleTrapAsyn = function(arg) { + if (!arg) arg = {}; + var event = arg.event; // 注意 event 是可选的! + var source = arg.source || this; return Callback.immediately().callback(this,function () { if (this.zone.cards.indexOf(this) === 0) { this.faceup(); @@ -1863,7 +1865,7 @@ Card.prototype.handleTrapAsyn = function(event) { } }).callback(this,function () { if (!this.trap) return; - return this.game.blockAsyn(this,function () { + return this.game.blockAsyn(source,this,function () { this.player.onTrapTriggered.trigger(); return this.trap.actionAsyn.call(this,event); }) diff --git a/CardInfo.js b/CardInfo.js index 85349c9..f558474 100644 --- a/CardInfo.js +++ b/CardInfo.js @@ -128830,8 +128830,7 @@ var CardInfo = { return this.player.opponent.showCardsAsyn([card]).callback(this,function () { return this.player.payCostOptionalAsyn(cost).callback(this,function (costArg) { if (!costArg) return; - // TODO: source - return card.handleTrapAsyn(null,this); + return card.handleTrapAsyn({source: this}); }); }); });