1
0
Fork 0

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 // Lostorage
this.rise = info.rise; this.rise = info.rise;
this.acce = !!info.acce;
this.acceingCard = null;
// 杂项 // 杂项
this.effectFilters = []; this.effectFilters = [];
@ -1488,6 +1490,32 @@ Card.prototype.charmTo = function (signi) {
this.game.frameEnd(); 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 () { Card.prototype.getStates = function () {
var states = []; var states = [];
if (this.frozen) states.push('frozen'); if (this.frozen) states.push('frozen');

View file

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

View file

@ -936,6 +936,9 @@ Game.prototype.handleBlockEndAsyn = function () {
return this.banishNonPositiveAsyn(); return this.banishNonPositiveAsyn();
}).callback(this,function () { }).callback(this,function () {
// 废弃【魅饰】和SIGNI下方的卡 // 废弃【魅饰】和SIGNI下方的卡
this.trashCards.forEach(function (card) {
card.acceingCard = null;
},this);
this.trashCards(this.trashingCharms,{ isCharm: true }); this.trashCards(this.trashingCharms,{ isCharm: true });
this.trashCards(this.trashingCards); this.trashCards(this.trashingCards);
this.trashingCharms.length = 0; 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
// (从LRIG卡组里选择等级0的卡片,背面表示放置到LRIG区) // (从LRIG卡组里选择等级0的卡片,背面表示放置到LRIG区)
Player.prototype.setupLrigAsyn = function () { Player.prototype.setupLrigAsyn = function () {
@ -820,6 +826,9 @@ Player.prototype.canUseActionEffect = function (effect,arg) {
// inTrashZone // inTrashZone
if (effect.source.zone === this.trashZone && !effect.activatedInTrashZone) return false; if (effect.source.zone === this.trashZone && !effect.activatedInTrashZone) return false;
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 // attackPhase && spellCutIn
if (!arg.ignoreTimming) { if (!arg.ignoreTimming) {
if (arg.spellCutIn) { if (arg.spellCutIn) {
@ -862,7 +871,7 @@ Player.prototype.canUseActionEffect = function (effect,arg) {
// 玩家使用起动效果 // 玩家使用起动效果
Player.prototype.useActionEffectAsyn = function () { Player.prototype.useActionEffectAsyn = function () {
var effects = []; var effects = [];
var cards = concat(this.lrig,this.signis,this.trashZone.cards,this.hands); var cards = this.getCards();
cards.forEach(function (card) { cards.forEach(function (card) {
card.actionEffects.forEach(function (effect) { card.actionEffects.forEach(function (effect) {
if (effect.spellCutIn) return; if (effect.spellCutIn) return;