From b43df10b8458ea1083289052935d5ad6a1fac295 Mon Sep 17 00:00:00 2001 From: WEBXOSS Date: Fri, 9 Jun 2017 09:55:52 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20implement=20layer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Card.js | 36 ++++++++++++++++++++++++++++++++++++ CardInfo.js | 1 - 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/Card.js b/Card.js index 77e0422..626e6b8 100644 --- a/Card.js +++ b/Card.js @@ -108,6 +108,8 @@ function Card (game,player,zone,pid,side) { this.maxAcceCount = 1; this.trap = info.trap || null; this.shadow = false; + this.layer = !!info.layer; + this.layerMarks = []; // 杂项 this.effectFilters = []; @@ -192,6 +194,7 @@ Card.abilityProps = [ 'canAttackAnySigniZone', 'canAttackNearbySigniZone', 'trap', + 'layer', ]; var mixins = { @@ -257,6 +260,22 @@ Card.prototype.cookEffect = function (rawEffect,type,offset) { }; Card.prototype.setupConstEffects = function () { + var layerMark = this.gid; + if (this.layer) { + this.addConstEffect({ + source: this, + createTimming: this.onEnterField, + once: once, + destroyTimming: this.onLeaveField2, + action: function (add,set) { + this.player.signis.forEach(function (signi) { + if (signi.hasClass('怪異')) { + add(signi,'layerMarks',layerMark); + } + }); + }, + },true); + } this.constEffects.forEach(function (eff,idx,constEffects) { var createTimming,destroyTimming,once; if (eff.duringGame) { @@ -302,6 +321,23 @@ Card.prototype.setupConstEffects = function () { condition: eff.condition, action: action, },true); + if (eff.layer) { + this.player.mainDeck.cards.forEach(function (signi) { + if (!signi.hasClass('怪異')) return; + this.game.addConstEffect({ + source: signi, + createTimming: signi.onEnterField, + once: true, + destroyTimming: signi.onLeaveField2, + cross: false, + wisdom: false, + fixed: false, + condition: function () { + return inArr(layerMark,this.layerMarks) && eff.condition.call(this); + }, + }); + }); + } },this); }; diff --git a/CardInfo.js b/CardInfo.js index 211d391..b5db074 100644 --- a/CardInfo.js +++ b/CardInfo.js @@ -115248,7 +115248,6 @@ var CardInfo = { ], constEffects: [{ layer: true, - // TODO: layer... action: function (set,add) { add(this,'effectFilters',function (card) { return !((card.player === this.player.opponent) && (card.power >= 15000));