1
0
Fork 0

💫 implement player.payCostOptionalAsyn()

This commit is contained in:
WEBXOSS 2017-10-04 15:27:21 +08:00
parent 36a0f2b25b
commit e509b99bf6
2 changed files with 9 additions and 8 deletions

View file

@ -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();
});

View file

@ -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或空数组: