From d39a7c79a3efb6c0a4e21f1d258f774421895190 Mon Sep 17 00:00:00 2001 From: WEBXOSS Date: Sun, 4 Dec 2016 13:27:58 +0800 Subject: [PATCH] Fix action effect in trash && black cards --- CardInfo.js | 24 +++++++++++++++++------- Player.js | 39 +++++++++++++++++++++------------------ 2 files changed, 38 insertions(+), 25 deletions(-) diff --git a/CardInfo.js b/CardInfo.js index 33f7fb3..0d889a6 100644 --- a/CardInfo.js +++ b/CardInfo.js @@ -116937,14 +116937,22 @@ var CardInfo = { "【※】:あなたのトラッシュから白のカード1枚と黒のカード1枚を手札に加える。" ], burstEffectTexts_zh_CN: [ - "【※】:抽1张牌。" + "【※】:从你的废弃区将1张白色的卡和1张黑色的卡加入手牌。" ], burstEffectTexts_en: [ "【※】:Add 1 white card and 1 black card from your trash to your hand." ], burstEffect: { actionAsyn: function () { - this.player.draw(1); + var filter = function (card) { + return card.hasColor('white'); + }; + return this.player.pickCardAsyn(filter).callback(this,function () { + var filter = function (card) { + return card.hasColor('black'); + }; + return this.player.pickCardAsyn(filter); + }); } } }, @@ -117380,7 +117388,7 @@ var CardInfo = { "【出】:あなたの手札から<天使>のシグニ1枚を公開するか、このシグニをトラッシュに置く。この方法で<天使>のシグニを公開した場合、あなたのデッキから<天使>のシグニ1枚を探してトラッシュに置く。その後、デッキをシャッフルする。" ], startUpEffectTexts_zh_CN: [ - "【出】:从你的手牌将1张<天使>SIGNI公开,或将这只SIGNI放置到废弃区。通过这个方法将<天使>SIGNI公开了的场合,从你的卡组中探寻1张<天使>SIGNI公开并加入手牌。之后,洗切牌组。" + "【出】:从你的手牌将1张<天使>SIGNI公开,或将这只SIGNI放置到废弃区。通过这个方法将<天使>SIGNI公开了的场合,从你的卡组中探寻1张<天使>SIGNI放置到废弃区。之后,洗切牌组。" ], startUpEffectTexts_en: [ "[On-Play]: Reveal 1 SIGNI from your hand, or put this SIGNI into the trash. If you revealed an SIGNI this way, search your deck for 1 SIGNI and put it into the trash. Then, shuffle your deck." @@ -117390,13 +117398,15 @@ var CardInfo = { var cards = this.player.hands.filter(function (card) { return card.hasClass('天使'); },this); - return this.player.selectOptionalAsyn('REVEAL',cards).callback(this,function (card) { + return this.player.selectOptionalAsyn('REVEAL',cards,true).callback(this,function (card) { if (!card) return this.trashAsyn(); return this.player.opponent.showCardsAsyn([card]).callback(this,function () { var filter = function (card) { return card.hasClass('天使'); }; - return this.player.seekAsyn(filter,1); + return this.player.searchAsyn(filter,1).callback(this,function (cards) { + this.game.trashCards(cards); + }); }); }); } @@ -117452,7 +117462,7 @@ var CardInfo = { var cards = this.player.hands.filter(function (card) { return card.hasClass('天使'); },this); - return this.player.selectOptionalAsyn('REVEAL',cards).callback(this,function (card) { + return this.player.selectOptionalAsyn('REVEAL',cards,true).callback(this,function (card) { if (!card) return this.trashAsyn(); }); } @@ -118924,7 +118934,7 @@ var CardInfo = { action: function (set,add) { var effect = this.game.newEffect({ source: this, - description: '1923-const-0', + description: '1923-const-1', triggerCondition: function (event) { return (event.oldZone === this.player.trashZone); }, diff --git a/Player.js b/Player.js index 154d7ee..04dd216 100644 --- a/Player.js +++ b/Player.js @@ -791,10 +791,26 @@ Player.prototype.canUseActionEffect = function (effect,arg) { if (!arg) arg = {}; if (this.charmedActionEffectBanned && effect.source.charm) return false; if (effect.source.abilityLost) return false; + // inHand + if (effect.source.zone === this.handZone && !effect.activatedInHand) return false; + if (effect.source.zone !== this.handZone && effect.activatedInHand) return false; + // inTrashZone + if (effect.source.zone === this.trashZone && !effect.activatedInTrashZone) return false; + if (effect.source.zone !== this.handZone && effect.activatedInHand) return false; + // attackPhase + if (this.game.phase.isAttackPhase()) { + if (!effect.attackPhase) return false; + } else { + if (effect.attackPhase && !effect.mainPhase) return false; + } + // onAttack if (arg.onAttack && !effect.onAttack) return false; if (!arg.onAttack && effect.onAttack) return false; + // cross if (effect.cross && !effect.source.crossed) return false; + // once if (effect.once && inArr(effect,this.usedActionEffects)) return false; + // condition if (effect.useCondition && !effect.useCondition.call(effect.source,arg)) return false; // <混沌之键主 乌姆尔=FYRA> if (effect.activatedInTrashZone) { @@ -821,10 +837,6 @@ Player.prototype.useActionEffectAsyn = function () { cards.forEach(function (card) { card.actionEffects.forEach(function (effect) { if (effect.spellCutIn) return; - if (card.zone === this.handZone && !effect.activatedInHand) return; - if (card.zone !== this.handZone && effect.activatedInHand) return; - if (effect.attackPhase && !effect.mainPhase) return; - if (effect.activatedInTrashZone && card.zone !== this.trashZone) return; if (this.canUseActionEffect(effect)) { effects.push(effect); } @@ -933,24 +945,15 @@ Player.prototype.useAttackPhaseArtsAsyn = function () { }; Player.prototype.useAttackPhaseActionEffect = function () { - var cards = []; - concat(this.signis,this.lrig).forEach(function (card) { - var flag = card.actionEffects.some(function (effect) { - return !effect.activatedInTrashZone && effect.attackPhase && this.canUseActionEffect(effect); + var cards = concat(this.signis,this.lrig,this.trashZone.cards).filter(function (card) { + return card.actionEffects.some(function (effect) { + return this.canUseActionEffect(effect); },this); - if (flag) cards.push(card); - },this); - this.trashZone.cards.forEach(function (card) { - // if (card.type !== 'SIGNI') return; - var flag = card.actionEffects.some(function (effect) { - return effect.activatedInTrashZone && effect.attackPhase && this.canUseActionEffect(effect); - },this); - if (flag) cards.push(card); - },this); + }); if (!cards.length) return Callback.never(); return this.selectAsyn('USE_ACTION_EFFECT',cards).callback(this,function (card) { var effects = card.actionEffects.filter(function (effect) { - return effect.attackPhase && this.canUseActionEffect(effect); + return this.canUseActionEffect(effect); },this); if (!effects.length) return; return Callback.immediately().callback(this,function () {