implement acce

This commit is contained in:
WEBXOSS 2017-02-26 19:36:54 +08:00
parent e96cf4d4dd
commit e21fa4f2ea
4 changed files with 60 additions and 8 deletions

28
Card.js
View file

@ -97,6 +97,8 @@ function Card (game,player,zone,pid,side) {
// Lostorage
this.rise = info.rise;
this.acce = !!info.acce;
this.acceingCard = null;
// 杂项
this.effectFilters = [];
@ -1488,6 +1490,32 @@ Card.prototype.charmTo = function (signi) {
this.game.frameEnd();
};
Card.prototype.getAccedCards = function () {
if (!inArr(this,this.player.signis)) return [];
return this.zone.cards.filter(function (card) {
return card.acceingCard === this;
},this);
};
Card.prototype.isAcced = function () {
return this.getAccedCards().length;
};
Card.prototype.canBeAcced = function () {
return !this.isAcced();
};
Card.prototype.acceTo = function (signi) {
if (!signi.canBeAcced()) return;
this.acceingCard = signi;
this.game.frameStart();
this.moveTo(signi.zone,{
faceup: true,
up: signi.isUp,
});
this.game.frameEnd();
};
Card.prototype.getStates = function () {
var states = [];
if (this.frozen) states.push('frozen');

View file

@ -126139,7 +126139,7 @@ var CardInfo = {
],
constEffects: [{
condition: function () {
return this.acced;
return this.isAcced();
},
action: function (set,add) {
add(this,'power',3000);
@ -126160,7 +126160,7 @@ var CardInfo = {
constEffects: [{
auto: 'onBanished',
condition: function () {
return this.acced;
return this.isAcced();
},
actionAsyn: function () {
var cards = this.player.trashZone.filter(function (card) {
@ -126194,7 +126194,9 @@ var CardInfo = {
card.moveTo(this.player.enerZone);
this.game.moveCards(card,this.player.enerZone);
var signis = this.player.signis;
var signis = this.player.signis.filter(function (signi) {
return signi.canBeAcced();
},this);
return this.player.selectTargetOptionalAsyn(signis).callback(this,function (signi) {
if (!signi) return;
card.acceTo(signi);
@ -126290,7 +126292,7 @@ var CardInfo = {
],
constEffects: [{
condition: function () {
return this.acced;
return this.isAcced();
},
action: function (set,add) {
set(this,'lancer',true);
@ -126367,6 +126369,7 @@ var CardInfo = {
// ======================
// 起动效果
// ======================
acce: true,
actionEffectTexts: [
"【起】《緑》:このカードをエナゾーンからあなたのシグニ1体の【アクセ】にする。"
],
@ -126381,7 +126384,7 @@ var CardInfo = {
activatedInEnerZone: true,
actionAsyn: function () {
var signis = this.player.signis.filter(function (signi) {
return !signi.acced;
return !signi.canBeAcced();
},this);
return this.player.selectTargetOptionalAsyn(signis).callback(this,function (signi) {
if (!signi) return;
@ -126402,8 +126405,12 @@ var CardInfo = {
"[Constant]: The <Cooking> SIGNI accessorized with this gets +5000 power."
],
constEffects: [{
duringGame: true,
condition: function () {
return this.acceingCard;
},
action: function (set,add) {
if (this.acceingCard && this.acceingCard.hasClass('調理')) {
if (this.acceingCard.hasClass('調理')) {
add(this.acceingCard,'power',5000);
}
}
@ -126496,6 +126503,7 @@ var CardInfo = {
// ======================
// 起动效果
// ======================
acce: true,
actionEffectTexts: [
"【起】《緑×0》このカードをエナゾーンからあなたのシグニ体の【アクセ】にする。",
],
@ -126509,7 +126517,7 @@ var CardInfo = {
activatedInEnerZone: true,
actionAsyn: function () {
var signis = this.player.signis.filter(function (signi) {
return !signi.acced;
return !signi.canBeAcced();
},this);
return this.player.selectTargetOptionalAsyn(signis).callback(this,function (signi) {
if (!signi) return;
@ -126530,6 +126538,10 @@ var CardInfo = {
"[Constant]: The <Cooking> SIGNI accessorized with this gets +2000 power."
],
constEffects: [{
duringGame: true,
condition: function () {
return this.acceingCard;
},
action: function (set,add) {
if (this.acceingCard.hasClass('調理')) {
add(this.acceingCard,'power',2000);

View file

@ -936,6 +936,9 @@ Game.prototype.handleBlockEndAsyn = function () {
return this.banishNonPositiveAsyn();
}).callback(this,function () {
// 废弃【魅饰】和SIGNI下方的卡
this.trashCards.forEach(function (card) {
card.acceingCard = null;
},this);
this.trashCards(this.trashingCharms,{ isCharm: true });
this.trashCards(this.trashingCards);
this.trashingCharms.length = 0;

View file

@ -164,6 +164,12 @@ function Player (game,io,mainDeck,lrigDeck) {
// });
// };
Player.prototype.getCards = function () {
return this.game.cards.filter(function (card) {
return card.player === this;
},this);
};
// 玩家设置lrig
// (从LRIG卡组里选择等级0的卡片,背面表示放置到LRIG区)
Player.prototype.setupLrigAsyn = function () {
@ -820,6 +826,9 @@ Player.prototype.canUseActionEffect = function (effect,arg) {
// inTrashZone
if (effect.source.zone === this.trashZone && !effect.activatedInTrashZone) return false;
if (effect.source.zone !== this.trashZone && effect.activatedInTrashZone) return false;
// inEnerZone
if (effect.source.zone === this.enerZone && !effect.activatedInEnerZone) return false;
if (effect.source.zone !== this.enerZone && effect.activatedInEnerZone) return false;
// attackPhase && spellCutIn
if (!arg.ignoreTimming) {
if (arg.spellCutIn) {
@ -862,7 +871,7 @@ Player.prototype.canUseActionEffect = function (effect,arg) {
// 玩家使用起动效果
Player.prototype.useActionEffectAsyn = function () {
var effects = [];
var cards = concat(this.lrig,this.signis,this.trashZone.cards,this.hands);
var cards = this.getCards();
cards.forEach(function (card) {
card.actionEffects.forEach(function (effect) {
if (effect.spellCutIn) return;