diff --git a/CardInfo.js b/CardInfo.js index 1cb0d73..b821977 100644 --- a/CardInfo.js +++ b/CardInfo.js @@ -125874,13 +125874,11 @@ var CardInfo = { ], trap: { actionAsyn: function () { - // TODO: player.payCostOptionalAsyn() var cost = { costBlue: 3, costColorless: 3, }; - if (!this.player.enoughCost(cost)) return; - return this.player.payCostAsyn(cost,true).callback(this,function (costArg) { + return this.player.payCostOptionalAsyn(cost).callback(this,function (costArg) { if (costArg) return; return this.game.bounceCardsAsyn(this.player.opponent.signis); }); @@ -128849,7 +128847,7 @@ var CardInfo = { return this.player.selectOptionalAsyn('LAUNCH',cards).callback(this,function (card) { if (!card) return; return this.player.opponent.showCardsAsyn([card]).callback(this,function () { - return this.player.payCostAsyn(cost,true).callback(this,function (costArg) { + return this.player.payCostOptionalAsyn(cost).callback(this,function (costArg) { if (!costArg) return; // TODO: source return card.handleTrapAsyn(null,this); @@ -129252,8 +129250,7 @@ var CardInfo = { var cost = { costBlue: 1, }; - if (!this.player.enoughCost(cost)) return; - return this.player.payCostAsyn(cost,true).callback(this,function (costArg) { + return this.player.payCostOptionalAsyn(cost,true).callback(this,function (costArg) { if (!costArg) return; if (event) { event.wontBeDamaged = true; @@ -129796,8 +129793,7 @@ var CardInfo = { var cost = { costBlue: 1, }; - if (!this.player.enoughCost(cost)) return; - return this.player.payCostAsyn(cost,true).callback(this,function (costArg) { + return this.player.payCostOptionalAsyn(cost).callback(this,function (costArg) { if (!costArg) return; return this.banishSigniAsyn(); }); diff --git a/Player.js b/Player.js index 3a2c594..c959960 100644 --- a/Player.js +++ b/Player.js @@ -1925,6 +1925,11 @@ Player.prototype.payCostAsyn = function (obj,cancelable) { }); }; +Player.prototype.payCostOptionalAsyn = function(cost) { + if (!this.enoughCost(cost)) return Callback.immediately(null); + return this.payCostAsyn(cost,true); +}; + // player.selectAsyn(label,cards,optional,needConfirm) // 玩家从cards中选一张卡, // 若cards为null或空数组: