💫 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

54
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,18 +1339,18 @@ Card.prototype.attackAsyn = function () {
return card.handleTrapAsyn(event); return card.handleTrapAsyn(event);
}); });
}).callback(this,function () { }).callback(this,function () {
// 攻击被无效,结束处理
if (event.prevented) return;
// 处理战斗或伤害
return Callback.forEach(attackedZones,function (attackedZone) {
// 强制结束回合 // 强制结束回合
if (this.game.phase.checkForcedEndTurn()) return; if (this.game.phase.checkForcedEndTurn()) return;
// 攻击的卡不在场上,结束处理. // 攻击的卡不在场上,结束处理.
if (!inArr(card,player.signis)) return; if (!inArr(card,player.signis)) return;
// 攻击被无效,结束处理
if (event.prevented) return;
// 若攻击的目标存在,进行战斗;
// (暗杀的情况下,目标为正对面的 SIGNI 时,不战斗)
var target = attackedZone.getSigni() || null; var target = attackedZone.getSigni() || null;
var battle = true; var battle = true;
if (!target) battle = false; if (!target) battle = false;
if (card.assassin && (target === opposingSigni)) battle = false; if (card.assassin && (attackedZone === opposingZone)) battle = false;
if (battle) { if (battle) {
// 战斗 // 战斗
// 触发"进行战斗"时点 // 触发"进行战斗"时点
@ -1375,7 +1392,7 @@ Card.prototype.attackAsyn = function () {
}); });
} else { } else {
// 伤害 // 伤害
if (target !== opposingSigni) { if (attackedZone !== opposingZone) {
// 攻击非正面的区域 // 攻击非正面的区域
if (!this.game.getData(card.player,'damageWhenAttackSigniZone')) { if (!this.game.getData(card.player,'damageWhenAttackSigniZone')) {
return; return;
@ -1394,6 +1411,7 @@ Card.prototype.attackAsyn = function () {
return; return;
} }
} }
},this);
}); });
}); });
}).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);
}, },
}], }],