From 97dcb247ff581d99fcb1f3fbba93caa75ad3de7d Mon Sep 17 00:00:00 2001 From: WEBXOSS Date: Sat, 12 Aug 2017 20:16:39 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20WX16-027=20summon=20(add?= =?UTF-8?q?=20beforeSummonAsyn)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Card.js | 26 ++++++++++++++++++++------ CardInfo.js | 14 ++++++++++++++ Player.js | 6 ++---- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/Card.js b/Card.js index 8ef277a..2bb87d2 100644 --- a/Card.js +++ b/Card.js @@ -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); }; diff --git a/CardInfo.js b/CardInfo.js index bd817dd..286cca8 100644 --- a/CardInfo.js +++ b/CardInfo.js @@ -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); + }); + }, // ====================== // 出场效果 // ====================== diff --git a/Player.js b/Player.js index 6d00c0b..981563e 100644 --- a/Player.js +++ b/Player.js @@ -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) }); }); });