1
0
Fork 0

🐛 fix WX16-027 summon (add beforeSummonAsyn)

This commit is contained in:
WEBXOSS 2017-08-12 20:16:39 +08:00
parent 938518e58a
commit 97dcb247ff
3 changed files with 36 additions and 10 deletions

26
Card.js
View file

@ -49,6 +49,7 @@ function Card (game,player,zone,pid,side) {
this.useCondition = info.useCondition;
this.growCondition = info.growCondition;
this.growActionAsyn = info.growActionAsyn;
this.beforeSummonAsyn = info.beforeSummonAsyn;
// 效果相关的数据
this.getMinEffectCount = info.getMinEffectCount;
@ -1568,16 +1569,29 @@ Card.prototype.summonAsyn = function (optional,dontTriggerStartUp,down) {
}).callback(this,function (card) {
if (!card) return;
return this.player.selectSummonZoneAsyn(false,this.rise).callback(this,function (zone) {
card.moveTo(zone,{
isSummon: true,
dontTriggerStartUp: dontTriggerStartUp,
up: !down
});
this.game.handleFrameEnd(); // 增加一个空帧,以进行两次常计算
return this.handleSummonAsyn(zone,{
dontTriggerStartUp: !!dontTriggerStartUp,
down: !!down,
})
});
});
};
Card.prototype.handleSummonAsyn = function(zone,arg) {
if (!arg) arg = {};
return Callback.immediately().callback(this,function () {
if (!this.beforeSummonAsyn) return;
return this.game.blockAsyn(this,function () {
return this.beforeSummonAsyn(zone);
});
}).callback(this,function () {
arg = Object.create(arg);
arg.isSummon = true;
this.moveTo(zone,arg);
this.game.handleFrameEnd(); // 增加一个空帧,以进行两次常计算
});
};
Card.prototype.summonOptionalAsyn = function (dontTriggerStartUp) {
return this.summonAsyn(true,dontTriggerStartUp);
};

View file

@ -117996,6 +117996,20 @@ var CardInfo = {
if (cards.length < 2) return false;
return card.hasClass('武勇');
},
beforeSummonAsyn: function (zone) {
var card = zone.getSigni();
var cards = card.player.signis.filter(function (signi) {
return (signi !== card) && signi.hasClass('武勇');
},this);
return this.player.selectTargetAsyn(cards).callback(this,function (target) {
if (!target) return;
var cards = target.zone.getNonTrapCards().filter(function (c) {
return (c !== target) && !c.charm && !c.acceingCard;
},this);
cards.push(target);
this.game.moveCards(cards,card.zone);
});
},
// ======================
// 出场效果
// ======================

View file

@ -424,8 +424,7 @@ Player.prototype.summonSigniAsyn = function () {
return this.selectSummonZoneAsyn(true,card.rise).callback(this,function (zone) {
if (!zone) return;
return this.game.blockAsyn(this,function () {
card.moveTo(zone,{isSummon: true});
this.game.handleFrameEnd(); // 增加一个空帧,以进行两次常计算
return card.handleSummonAsyn(zone);
});
});
});
@ -469,8 +468,7 @@ Player.prototype.summonResonaAsyn = function (card) {
return this.selectSummonZoneAsyn(false).callback(this,function (zone) {
if (!zone) return;
return this.game.blockAsyn(this,function () {
card.moveTo(zone,{isSummon: true, resonaArg: resonaArg});
this.game.handleFrameEnd(); // 增加一个空帧,以进行两次常计算
return card.handleSummonAsyn(zone)
});
});
});