mirror of
https://github.com/webxoss/webxoss-core.git
synced 2025-01-18 19:56:02 +01:00
💫 implement layer
This commit is contained in:
parent
27ec313744
commit
b43df10b84
2 changed files with 36 additions and 1 deletions
36
Card.js
36
Card.js
|
@ -108,6 +108,8 @@ function Card (game,player,zone,pid,side) {
|
||||||
this.maxAcceCount = 1;
|
this.maxAcceCount = 1;
|
||||||
this.trap = info.trap || null;
|
this.trap = info.trap || null;
|
||||||
this.shadow = false;
|
this.shadow = false;
|
||||||
|
this.layer = !!info.layer;
|
||||||
|
this.layerMarks = [];
|
||||||
|
|
||||||
// 杂项
|
// 杂项
|
||||||
this.effectFilters = [];
|
this.effectFilters = [];
|
||||||
|
@ -192,6 +194,7 @@ Card.abilityProps = [
|
||||||
'canAttackAnySigniZone',
|
'canAttackAnySigniZone',
|
||||||
'canAttackNearbySigniZone',
|
'canAttackNearbySigniZone',
|
||||||
'trap',
|
'trap',
|
||||||
|
'layer',
|
||||||
];
|
];
|
||||||
|
|
||||||
var mixins = {
|
var mixins = {
|
||||||
|
@ -257,6 +260,22 @@ Card.prototype.cookEffect = function (rawEffect,type,offset) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Card.prototype.setupConstEffects = function () {
|
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) {
|
this.constEffects.forEach(function (eff,idx,constEffects) {
|
||||||
var createTimming,destroyTimming,once;
|
var createTimming,destroyTimming,once;
|
||||||
if (eff.duringGame) {
|
if (eff.duringGame) {
|
||||||
|
@ -302,6 +321,23 @@ Card.prototype.setupConstEffects = function () {
|
||||||
condition: eff.condition,
|
condition: eff.condition,
|
||||||
action: action,
|
action: action,
|
||||||
},true);
|
},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);
|
},this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -115248,7 +115248,6 @@ var CardInfo = {
|
||||||
],
|
],
|
||||||
constEffects: [{
|
constEffects: [{
|
||||||
layer: true,
|
layer: true,
|
||||||
// TODO: layer...
|
|
||||||
action: function (set,add) {
|
action: function (set,add) {
|
||||||
add(this,'effectFilters',function (card) {
|
add(this,'effectFilters',function (card) {
|
||||||
return !((card.player === this.player.opponent) && (card.power >= 15000));
|
return !((card.player === this.player.opponent) && (card.power >= 15000));
|
||||||
|
|
Loading…
Reference in a new issue