💫 implement WD20-009 _2278

This commit is contained in:
WEBXOSS 2017-06-09 12:17:27 +08:00
parent 4e6dc83759
commit de4ba5971f
2 changed files with 98 additions and 75 deletions

172
Card.js
View file

@ -1218,7 +1218,9 @@ Card.prototype.attackAsyn = function () {
attack: true, attack: true,
}; };
var cost = null; var cost = null;
var attackedZone = null; var attackedZones = [];
var index = this.player.signiZones.indexOf(this.zone);
var opposingZone = this.getOpposingZone();
if (this.attackCostColorless) { if (this.attackCostColorless) {
cost = { cost = {
costColorless: this.attackCostColorless costColorless: this.attackCostColorless
@ -1244,13 +1246,11 @@ Card.prototype.attackAsyn = function () {
}).callback(this,function () { }).callback(this,function () {
// 选择攻击的区域 // 选择攻击的区域
var zones = []; var zones = [];
var index = this.player.signiZones.indexOf(this.zone);
var opposingZone = this.player.opponent.signiZones[2-index];
if (this.canAttackAnySigniZone) { if (this.canAttackAnySigniZone) {
zones = this.player.opponent.signiZones; zones = this.player.opponent.signiZones;
} else if (this.canAttackNearbySigniZone) { } else if (this.canAttackNearbySigniZone) {
if (index === 1) { if (index === 1) {
zones = this.player.opponent.signiZones zones = this.player.opponent.signiZones;
} else { } else {
zones = [ zones = [
opposingZone, opposingZone,
@ -1258,9 +1258,27 @@ Card.prototype.attackAsyn = function () {
]; ];
} }
} }
if (!zones.length) return attackedZone = opposingZone; if (!zones.length) return attackedZones.push(opposingZone);
return this.player.selectAsyn('TARGET',zones).callback(this,function (zone) { return this.player.selectAsyn('TARGET',zones).callback(this,function (zone) {
attackedZone = zone attackedZones.push(zone);
// FIX ME: show selected zone.
var card = zone.getSigni();
if (card) card.beSelectedAsTarget();
});
})
.callback(this,function () {
// <具英の鋭針 #コンパス#>
if (!card._2278) return;
if (attackedZones[0] !== opposingZone) return;
var zones = [];
if (index === 1) {
zones = [this.player.opponent.signiZones[0],this.player.opponent.signiZones[2]];
} else {
zones = [this.player.opponent.signiZones[1]];
}
return this.player.selectOptionalAsyn('TARGET',zones).callback(this,function (zone) {
if (zone) attackedZones.push(zone);
// FIX ME: show selected zone.
var card = zone.getSigni(); var card = zone.getSigni();
if (card) card.beSelectedAsTarget(); if (card) card.beSelectedAsTarget();
}); });
@ -1312,8 +1330,7 @@ Card.prototype.attackAsyn = function () {
if (!inArr(card,player.signis)) return; if (!inArr(card,player.signis)) return;
// 处理陷阱 // 处理陷阱
var opposingSigni = card.getOpposingSigni(); var opposingSigni = card.getOpposingSigni();
var index = this.player.signiZones.indexOf(this.zone); opposingZone = card.getOpposingZone();
var opposingZone = this.player.opponent.signiZones[2-index];
var trap = opposingZone.trap var trap = opposingZone.trap
return Callback.immediately().callback(this,function () { return Callback.immediately().callback(this,function () {
if (opposingSigni || !trap) return; if (opposingSigni || !trap) return;
@ -1322,78 +1339,79 @@ Card.prototype.attackAsyn = function () {
return card.handleTrapAsyn(event); return card.handleTrapAsyn(event);
}); });
}).callback(this,function () { }).callback(this,function () {
// 强制结束回合
if (this.game.phase.checkForcedEndTurn()) return;
// 攻击的卡不在场上,结束处理.
if (!inArr(card,player.signis)) return;
// 攻击被无效,结束处理 // 攻击被无效,结束处理
if (event.prevented) return; if (event.prevented) return;
// 若攻击的目标存在,进行战斗; // 处理战斗或伤害
// (暗杀的情况下,目标为正对面的 SIGNI 时,不战斗) return Callback.forEach(attackedZones,function (attackedZone) {
var target = attackedZone.getSigni() || null; // 强制结束回合
var battle = true; if (this.game.phase.checkForcedEndTurn()) return;
if (!target) battle = false; // 攻击的卡不在场上,结束处理.
if (card.assassin && (target === opposingSigni)) battle = false; if (!inArr(card,player.signis)) return;
if (battle) { var target = attackedZone.getSigni() || null;
// 战斗 var battle = true;
// 触发"进行战斗"时点 if (!target) battle = false;
var onBattleEvent = { if (card.assassin && (attackedZone === opposingZone)) battle = false;
card: card, if (battle) {
target: target, // 战斗
}; // 触发"进行战斗"时点
return this.game.blockAsyn(this,function () { var onBattleEvent = {
this.game.frameStart(); card: card,
card.onBattle.trigger(onBattleEvent); target: target,
target.onBattle.trigger(onBattleEvent); };
this.game.frameEnd(); return this.game.blockAsyn(this,function () {
}).callback(this,function () { this.game.frameStart();
// 此时,攻击的卡可能已不在场上 card.onBattle.trigger(onBattleEvent);
if (!inArr(card,player.signis)) return; target.onBattle.trigger(onBattleEvent);
// 受攻击的卡也可能已不在场上 this.game.frameEnd();
// 注意: 根据事务所QA,此时不击溃对方的生命护甲(即使有 lancer ). (<大剣 レヴァテイン>) }).callback(this,function () {
if (!inArr(target,target.player.signis)) return; // 此时,攻击的卡可能已不在场上
// 结算战斗伤害 if (!inArr(card,player.signis)) return;
if (card.power >= target.power) { // 受攻击的卡也可能已不在场上
// 保存此时的 lancer 属性作为参考, // 注意: 根据事务所QA,此时不击溃对方的生命护甲(即使有 lancer ). (<大剣 レヴァテイン>)
// 因为驱逐被攻击的 SIGNI 后,攻击侧的 lancer 可能改变. if (!inArr(target,target.player.signis)) return;
var lancer = card.lancer; // 结算战斗伤害
return this.game.blockAsyn(this,function () { if (card.power >= target.power) {
return target.banishAsyn({attackingSigni: card}).callback(this,function (succ) { // 保存此时的 lancer 属性作为参考,
if (succ && lancer) { // 因为驱逐被攻击的 SIGNI 后,攻击侧的 lancer 可能改变.
crashArg.lancer = lancer; var lancer = card.lancer;
return opponent.crashAsyn(1,crashArg); return this.game.blockAsyn(this,function () {
} return target.banishAsyn({attackingSigni: card}).callback(this,function (succ) {
if (succ && lancer) {
crashArg.lancer = lancer;
return opponent.crashAsyn(1,crashArg);
}
});
}); });
}); }
}).callback(this,function () {
if (onBattleEvent._1877 && inArr(target,target.player.signis)) {
return this.game.blockAsyn(onBattleEvent._1877,this,function () {
target.moveTo(target.player.mainDeck,{bottom: true});
});
}
});
} else {
// 伤害
if (attackedZone !== opposingZone) {
// 攻击非正面的区域
if (!this.game.getData(card.player,'damageWhenAttackSigniZone')) {
return;
}
} }
}).callback(this,function () { if (event.wontBeDamaged || opponent.wontBeDamaged) return;
if (onBattleEvent._1877 && inArr(target,target.player.signis)) { crashArg.damage = true;
return this.game.blockAsyn(onBattleEvent._1877,this,function () { if (opponent.lifeClothZone.cards.length) {
target.moveTo(target.player.mainDeck,{bottom: true}); var count = 1;
}); if (this.doubleCrash) count = 2;
} if (this.tripleCrash) count = 3;
}); crashArg.doubleCrash = this.doubleCrash;
} else { return opponent.crashAsyn(count,crashArg);
// 伤害 } else {
if (target !== opposingSigni) { if (card.game.win(player)) return Callback.never();
// 攻击非正面的区域
if (!this.game.getData(card.player,'damageWhenAttackSigniZone')) {
return; return;
} }
} }
if (event.wontBeDamaged || opponent.wontBeDamaged) return; },this);
crashArg.damage = true;
if (opponent.lifeClothZone.cards.length) {
var count = 1;
if (this.doubleCrash) count = 2;
if (this.tripleCrash) count = 3;
crashArg.doubleCrash = this.doubleCrash;
return opponent.crashAsyn(count,crashArg);
} else {
if (card.game.win(player)) return Callback.never();
return;
}
}
}); });
}); });
}).callback(this,function () { }).callback(this,function () {
@ -1654,9 +1672,15 @@ Card.prototype.getTotalEnerCost = function (original) {
}; };
Card.prototype.getOpposingSigni = function () { Card.prototype.getOpposingSigni = function () {
var zone = this.getOpposingZone();
if (!zone) return null;
return zone.getSigni() || null;
};
Card.prototype.getOpposingZone = 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].getSigni() || null; return this.player.opponent.signiZones[idx];
}; };
Card.prototype.charmTo = function (signi) { Card.prototype.charmTo = function (signi) {

View file

@ -116625,7 +116625,6 @@ var CardInfo = {
},{ },{
wisdom: 10, wisdom: 10,
action: function (set,add) { action: function (set,add) {
// TODO: ...
set(this,'_2278',true); set(this,'_2278',true);
}, },
}], }],