mirror of
https://github.com/webxoss/webxoss-core.git
synced 2025-01-31 01:39:09 +01:00
💫 implement source in handleTrapAsyn (for WX17-029)
This commit is contained in:
parent
7933d8b43c
commit
ada169136a
2 changed files with 7 additions and 6 deletions
10
Card.js
10
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);
|
||||
})
|
||||
|
|
|
@ -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});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue