1
0
Fork 0

Fix bugs in trashing cards below a SIGNI

This commit is contained in:
WEBXOSS 2016-11-02 23:44:35 +08:00
parent fb6f290591
commit 13a19498c9
4 changed files with 39 additions and 33 deletions

View file

@ -716,7 +716,7 @@ Card.prototype.moveTo = function (zone,arg) {
} else { } else {
// 是 SIGNI 下方的卡,比如魅饰卡 // 是 SIGNI 下方的卡,比如魅饰卡
// 处理魅饰卡 // 处理魅饰卡
var signi = card.zone.cards[0]; var signi = card.zone.getActualCards()[0];
if (card === signi.charm) { if (card === signi.charm) {
moveEvent.isCharm = true; moveEvent.isCharm = true;
signi.charm = null; signi.charm = null;
@ -728,7 +728,7 @@ Card.prototype.moveTo = function (zone,arg) {
zone.player.hands.push(card); zone.player.hands.push(card);
} else if (zone.name === 'SigniZone') { } else if (zone.name === 'SigniZone') {
if (card.zone.name !== 'SigniZone' || zone.player !== card.player) { if (card.zone.name !== 'SigniZone' || zone.player !== card.player) {
if (zone.cards.length) { if (zone.getActualCards().length) {
// 放置到 SIGNI 下面的卡 // 放置到 SIGNI 下面的卡
} else { } else {
// 进入 SigniZone // 进入 SigniZone
@ -1224,7 +1224,7 @@ Card.prototype.banishAsyn = function (arg) {
Card.prototype.summonAsyn = function (optional,dontTriggerStartUp,down) { Card.prototype.summonAsyn = function (optional,dontTriggerStartUp,down) {
var zones = this.player.signiZones.filter(function (zone) { var zones = this.player.signiZones.filter(function (zone) {
return (zone.cards.length === 0); return (zone.getActualCards().length === 0);
},this); },this);
if (!this.canSummon() || !zones.length) return Callback.immediately(); if (!this.canSummon() || !zones.length) return Callback.immediately();
return Callback.immediately().callback(this,function () { return Callback.immediately().callback(this,function () {
@ -1346,7 +1346,7 @@ Card.prototype.getTotalEnerCost = function (original) {
Card.prototype.getOpposingSigni = function () { Card.prototype.getOpposingSigni = function () {
if (!inArr(this,this.player.signis)) return null; if (!inArr(this,this.player.signis)) return null;
var idx = 2 - this.player.signiZones.indexOf(this.zone); var idx = 2 - this.player.signiZones.indexOf(this.zone);
return this.player.opponent.signiZones[idx].cards[0] || null; return this.player.opponent.signiZones[idx].getActualCards()[0] || null;
}; };
Card.prototype.charmTo = function (signi) { Card.prototype.charmTo = function (signi) {

View file

@ -24427,16 +24427,12 @@ var CardInfo = {
triggerCondition: function (event) { triggerCondition: function (event) {
var card = event.card; var card = event.card;
if (card.type !== 'SIGNI') return false; if (card.type !== 'SIGNI') return false;
var idx = 2 - card.player.signiZones.indexOf(card.zone); return !card.getOpposingSigni();
var opposingSigni = card.player.opponent.signiZones[idx].cards[0];
return !opposingSigni;
}, },
condition: function (event) { condition: function (event) {
var card = event.card; var card = event.card;
if (!inArr(card,card.player.signis)) return false; if (!inArr(card,card.player.signis)) return false;
var idx = 2 - card.player.signiZones.indexOf(card.zone); return !card.getOpposingSigni();
var opposingSigni = card.player.opponent.signiZones[idx].cards[0];
return !opposingSigni;
}, },
costGreen: 1, costGreen: 1,
costColorless: 1, costColorless: 1,
@ -25887,7 +25883,8 @@ var CardInfo = {
if (!inArr(card,card.player.signis)) return; if (!inArr(card,card.player.signis)) return;
var idx = 2 - card.player.signiZones.indexOf(card.zone); var idx = 2 - card.player.signiZones.indexOf(card.zone);
var zone = this.player.signiZones[idx]; var zone = this.player.signiZones[idx];
var opposingSigni = zone.cards[0]; var opposingSigni = zone.getActualCards()[0];
var opposingSigni = card.getOpposingSigni();
if (opposingSigni) return; if (opposingSigni) return;
if (zone.disabled) return; if (zone.disabled) return;
@ -27226,7 +27223,8 @@ var CardInfo = {
},this); },this);
var zones = this.player.opponent.signiZones.filter(function (zone) { var zones = this.player.opponent.signiZones.filter(function (zone) {
if (zone.disabled) return false; if (zone.disabled) return false;
return (!zone.cards.length) || (!zone.cards[0].isEffectFiltered()); var cards = zone.getActualCards();
return (!cards.length) || (!cards[0].isEffectFiltered());
},this); },this);
return Callback.loop(this,2,function () { return Callback.loop(this,2,function () {
if (done) return; if (done) return;
@ -28306,7 +28304,8 @@ var CardInfo = {
},this); },this);
var zones = this.player.signiZones.filter(function (zone) { var zones = this.player.signiZones.filter(function (zone) {
if (zone.disabled) return false; if (zone.disabled) return false;
return (!zone.cards.length) || (!zone.cards[0].isEffectFiltered()); var cards = zone.getActualCards();
return (!cards.length) || (!cards[0].isEffectFiltered());
},this); },this);
return Callback.loop(this,2,function () { return Callback.loop(this,2,function () {
if (done) return; if (done) return;
@ -29770,8 +29769,7 @@ var CardInfo = {
], ],
constEffects: [{ constEffects: [{
action: function (set,add) { action: function (set,add) {
var idx = 2 - this.player.signiZones.indexOf(this.zone); var opposingSigni = this.getOpposingSigni();
var opposingSigni = this.player.opponent.signiZones[idx].cards[0];
if (!opposingSigni) return; if (!opposingSigni) return;
var effect = this.game.newEffect({ var effect = this.game.newEffect({
source: this, source: this,
@ -30837,8 +30835,7 @@ var CardInfo = {
var card = event.card; var card = event.card;
if (card.type !== 'SIGNI') return false; if (card.type !== 'SIGNI') return false;
if (card.level > 2) return false; if (card.level > 2) return false;
var idx = 2 - card.player.signiZones.indexOf(card.zone); var opposingSigni = card.getOpposingSigni();
var opposingSigni = card.player.opponent.signiZones[idx].cards[0];
return (opposingSigni === this); return (opposingSigni === this);
}, },
// condition: function () { // condition: function () {
@ -34144,8 +34141,7 @@ var CardInfo = {
destroyTimming: this.game.phase.onTurnEnd, destroyTimming: this.game.phase.onTurnEnd,
action: function (set,add) { action: function (set,add) {
this.player.signis.forEach(function (signi) { this.player.signis.forEach(function (signi) {
var idx = 2 - signi.player.signiZones.indexOf(signi.zone); var opposingSigni = signi.getOpposingSigni();
var opposingSigni = signi.player.opponent.signiZones[idx].cards[0];
if (opposingSigni && (opposingSigni.power >= 12000)) { if (opposingSigni && (opposingSigni.power >= 12000)) {
set(signi,'assassin',true); set(signi,'assassin',true);
} }
@ -36228,8 +36224,7 @@ var CardInfo = {
], ],
constEffects: [{ constEffects: [{
action: function (set,add) { action: function (set,add) {
var idx = 2 - this.player.signiZones.indexOf(this.zone); var opposingSigni = this.getOpposingSigni();
var opposingSigni = this.player.opponent.signiZones[idx].cards[0];
if (!opposingSigni) return; if (!opposingSigni) return;
var effect = this.game.newEffect({ var effect = this.game.newEffect({
source: this, source: this,
@ -38884,7 +38879,7 @@ var CardInfo = {
source: this, source: this,
destroyTimming: this.game.phase.onTurnEnd, destroyTimming: this.game.phase.onTurnEnd,
action: function (set,add) { action: function (set,add) {
var card = this.player.signiZones[1].cards[0]; var card = this.player.signiZones[1].getActualCards()[0];
if (card) { if (card) {
set(card,'doubleCrash',true); set(card,'doubleCrash',true);
} }
@ -38896,7 +38891,7 @@ var CardInfo = {
once: true, once: true,
destroyTimming: this.game.phase.onTurnEnd, destroyTimming: this.game.phase.onTurnEnd,
action: function (set,add) { action: function (set,add) {
var card = this.player.signiZones[1].cards[0]; var card = this.player.signiZones[1].getActualCards()[0];
if (card) { if (card) {
set(card,'doubleCrash',true); set(card,'doubleCrash',true);
} }
@ -64103,7 +64098,7 @@ var CardInfo = {
destroyTimming: [this.game.phase.onTurnEnd], destroyTimming: [this.game.phase.onTurnEnd],
action: function (set,add) { action: function (set,add) {
set(zone,'powerDown',true); set(zone,'powerDown',true);
var card = zone.cards[0]; var card = zone.getActualCards()[0];
if (!card) return; if (!card) return;
add(card,'power',-7000); add(card,'power',-7000);
} }
@ -64116,7 +64111,7 @@ var CardInfo = {
destroyTimming: [this.game.phase.onTurnEnd], destroyTimming: [this.game.phase.onTurnEnd],
action: function (set,add) { action: function (set,add) {
set(zone,'powerDown',true); set(zone,'powerDown',true);
var card = zone.cards[0]; var card = zone.getActualCards()[0];
if (!card) return; if (!card) return;
add(card,'power',-7000); add(card,'power',-7000);
} }
@ -82816,7 +82811,7 @@ var CardInfo = {
destroyTimming: this.game.phase.onTurnEnd, destroyTimming: this.game.phase.onTurnEnd,
action: function (set,add) { action: function (set,add) {
var zone = this.player.signiZones[1]; var zone = this.player.signiZones[1];
var card = zone.cards[0]; var card = zone.getActualCards()[0];
if (!inArr(card,this.player.signis)) return; if (!inArr(card,this.player.signis)) return;
var opposingSigni = card.getOpposingSigni(); var opposingSigni = card.getOpposingSigni();
if (!opposingSigni || !opposingSigni.charm) return; if (!opposingSigni || !opposingSigni.charm) return;
@ -87980,7 +87975,7 @@ var CardInfo = {
destroyTimming: this.game.phase.onTurnEnd, destroyTimming: this.game.phase.onTurnEnd,
action: function (set,add) { action: function (set,add) {
var zone = this.player.signiZones[1]; var zone = this.player.signiZones[1];
var card = zone.cards[0]; var card = zone.getActualCards()[0];
if (!inArr(card,this.player.signis)) return; if (!inArr(card,this.player.signis)) return;
add(card,'power',5000); add(card,'power',5000);
set(card,'lancer',true); set(card,'lancer',true);
@ -104734,7 +104729,7 @@ var CardInfo = {
destroyTimming: this.game.phase.onTurnEnd, destroyTimming: this.game.phase.onTurnEnd,
action: function (set,add) { action: function (set,add) {
var zone = this.player.signiZones[1]; var zone = this.player.signiZones[1];
var card = zone.cards[0]; var card = zone.getActualCards()[0];
if (!inArr(card,this.player.signis)) return; if (!inArr(card,this.player.signis)) return;
if (!card.hasClass('龍獣')) return; if (!card.hasClass('龍獣')) return;
set(card,'doubleCrash',true); set(card,'doubleCrash',true);
@ -109896,7 +109891,9 @@ var CardInfo = {
}]; }];
return this.player.selectAsyn('LAUNCH',effects).callback(this,function (effect) { return this.player.selectAsyn('LAUNCH',effects).callback(this,function (effect) {
if (!effect) return; if (!effect) return;
return effect.actionAsyn.call(this); return this.player.opponent.showEffectsAsyn([effect]).callback(this,function () {
return effect.actionAsyn.call(this);
});
}); });
} }
}); });

View file

@ -393,7 +393,7 @@ Player.prototype.summonSigniAsyn = function () {
return card.canSummon() && (!this.summonPowerLimit || (card.power < this.summonPowerLimit)); return card.canSummon() && (!this.summonPowerLimit || (card.power < this.summonPowerLimit));
},this); },this);
var zones = this.signiZones.filter(function (zone) { var zones = this.signiZones.filter(function (zone) {
return (zone.cards.length === 0); return (zone.getActualCards().length === 0);
},this); },this);
if (!cards.length || !zones.length) { if (!cards.length || !zones.length) {
return Callback.never(); return Callback.never();
@ -469,9 +469,9 @@ Player.prototype.getSummonZones = function (signis) {
var forcedZones = []; var forcedZones = [];
var zones = this.signiZones.filter(function (zone,idx) { var zones = this.signiZones.filter(function (zone,idx) {
if (zone.disabled) return false; if (zone.disabled) return false;
var signi = zone.cards[0]; var signi = zone.getActualCards()[0];
if (signi && inArr(signi,signis)) return false; if (signi && inArr(signi,signis)) return false;
var opposingSigni = this.opponent.signiZones[2-idx].cards[0]; var opposingSigni = this.opponent.signiZones[2-idx].getActualCards()[0];
if (opposingSigni && opposingSigni.forceSummonZone) { if (opposingSigni && opposingSigni.forceSummonZone) {
forcedZones.push(zone); forcedZones.push(zone);
} }
@ -2133,7 +2133,7 @@ Player.prototype.setCrossPair = function () {
if (!card.crossLeft && !card.crossRight) return; if (!card.crossLeft && !card.crossRight) return;
function checkMatch (zone,cross) { function checkMatch (zone,cross) {
if (!zone) return null; if (!zone) return null;
var card = zone.cards[0]; var card = zone.getActualCards()[0];
if (!card) return null; if (!card) return null;
var cids = concat(cross); var cids = concat(cross);
var matched = cids.some(function (cid) { var matched = cids.some(function (cid) {

View file

@ -48,6 +48,15 @@ Zone.prototype.getTopCards = function (n) {
return this.cards.slice(0,n); return this.cards.slice(0,n);
}; };
// SIGNI 区中,魅饰卡及其它下方的卡在块结束时送至废弃区,
// 该函数返回区域中除了这些卡的卡.
Zone.prototype.getActualCards = function () {
return this.cards.filter(function (card) {
return !inArr(card,this.game.trashingCharms) &&
!inArr(card,this.game.trashingCards);
});
};
Zone.prototype.moveCardsToTop = function (cards) { Zone.prototype.moveCardsToTop = function (cards) {
cards.forEach(function (card) { cards.forEach(function (card) {
removeFromArr(card,this.cards); removeFromArr(card,this.cards);