🐛 fix acce mixin

This commit is contained in:
WEBXOSS 2017-08-06 20:29:10 +08:00
parent 7e95ed5512
commit 844dfc33d0

10
Card.js
View file

@ -208,9 +208,10 @@ var mixins = {
},this); },this);
}, },
costChange: function () { costChange: function () {
var player = this.source.player;
var obj = Object.create(this); var obj = Object.create(this);
obj.costChange = null; obj.costChange = null;
var flag = this.player.signis.some(function (signi) { var flag = player.signis.some(function (signi) {
return signi.canBeAcced() && signi._2313; return signi.canBeAcced() && signi._2313;
},this); },this);
if (flag) { if (flag) {
@ -220,21 +221,22 @@ var mixins = {
return obj; return obj;
}, },
costChangeAsyn: function () { costChangeAsyn: function () {
var player = this.source.player;
var cost = Object.create(this); var cost = Object.create(this);
cost.costChange = null; cost.costChange = null;
var reducedCost = Object.create(this); var reducedCost = Object.create(this);
reducedCost.costGreen -= 1; reducedCost.costGreen -= 1;
if (reducedCost.costGreen < 0) reducedCost.costGreen = 0; if (reducedCost.costGreen < 0) reducedCost.costGreen = 0;
var cards = this.player.signis.filter(function (signi) { var cards = player.signis.filter(function (signi) {
return signi.canBeAcced(); return signi.canBeAcced();
},this); },this);
if (!this.player.enoughCost(cost)) { if (!player.enoughCost(cost)) {
cards = cards.filter(function (signi) { cards = cards.filter(function (signi) {
return signi._2313; return signi._2313;
},this); },this);
} }
return this.player.selectTargetAsyn(cards).callback(this,function (card) { return player.selectTargetAsyn(cards).callback(this,function (card) {
this._data = card; this._data = card;
return (card && card._2313) ? reducedCost : cost; return (card && card._2313) ? reducedCost : cost;
}); });