From 690dbd07c6edc4d54851c83079ae397986ebacbc Mon Sep 17 00:00:00 2001 From: WEBXOSS Date: Tue, 25 Oct 2016 18:14:51 +0800 Subject: [PATCH] double sided resona --- .gitignore | 3 ++- Card.js | 27 +++++++++++++++++++++++++-- CardInfo.js | 26 ++++++++++++++++++++------ Player.js | 1 + Zone.js | 5 ++++- package.json | 8 ++++++++ webxoss-client | 2 +- 7 files changed, 61 insertions(+), 11 deletions(-) create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 098d174..bc67cdb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ node_modules trash .DS_Store -*.sublime-* \ No newline at end of file +*.sublime-* +yarn.lock \ No newline at end of file diff --git a/Card.js b/Card.js index eb6a64d..82e0255 100644 --- a/Card.js +++ b/Card.js @@ -1,6 +1,6 @@ 'use strict'; -function Card (game,player,zone,pid) { +function Card (game,player,zone,pid,side) { // 引用 this.game = game; this.player = player; @@ -85,7 +85,16 @@ function Card (game,player,zone,pid) { this.crossIcon = !!(info.crossLeft || info.crossRight); this.crossed = null; + // 双面 + if (side) { + this.sideA = info.sideA? side : null; + this.sideB = info.sideB? side : null; + } else { + this.sideA = info.sideA? new Card(game,player,zone,info.sideA,this) : null; + this.sideB = info.sideB? new Card(game,player,zone,info.sideB,this) : null; + } + // 杂项 this.effectFilters = []; this.registeredEffects = []; this.charm = null; // 魅饰卡 @@ -728,7 +737,7 @@ Card.prototype.moveTo = function (zone,arg) { zone.player.signis.push(card); } } - }else if ((zone.name === 'LrigZone') && !arg.bottom) { + } else if ((zone.name === 'LrigZone') && !arg.bottom) { // 进入 LrigZone lrigChangeEvent = { oldLrig: zone.player.lrig, @@ -836,6 +845,20 @@ Card.prototype.moveTo = function (zone,arg) { card.onStartUp.trigger(enterFieldEvent); } } + // 双面共鸣 + var side = card.sideA || card.sideB; + if (side && !arg.isSide) { + var arg = { + isSide: true, + }; + if (enterFieldEvent) { + side.moveTo(card.player.excludedZone,arg); + } else if (zone === card.player.lrigTrashZone) { + side.moveTo(zone,arg); + } else if (zone === card.player.lrigDeck) { + side.moveTo(zone,arg); + } + } card.game.frameEnd(); return true; diff --git a/CardInfo.js b/CardInfo.js index 24a6a03..346d28e 100644 --- a/CardInfo.js +++ b/CardInfo.js @@ -17607,7 +17607,11 @@ var CardInfo = { } },{ condition: function () { - return this.player.lrigTrashZone.cards.length >= 7; + // 双面共鸣 + var cards = this.player.lrigTrashZone.cards.filter(function (card) { + return !card.sideA; + },this); + return cards.length >= 7; }, action: function (set,add) { set(this,'doubleCrash',true); @@ -17752,7 +17756,7 @@ var CardInfo = { } },{ condition: function () { - return this.player.lrigDeck.cards.length === 0; + return !this.player.lrigDeck.cards.length; }, action: function (set,add) { set(this,'power',18000); @@ -107117,7 +107121,7 @@ var CardInfo = { ], constEffects: [{ action: function (set,add) { - set(this.player.opponent,'oneArtEachTurn',effect); + set(this.player.opponent,'oneArtEachTurn',true); } }], // ====================== @@ -107172,6 +107176,7 @@ var CardInfo = { cid: 1768, "timestamp": 1468055282143, "wxid": "WX13-005B", + sideA: 1769, name: "白羅星 ニュームーン", name_zh_CN: "黑幻虫 大王具足虫【HS】", name_en: "New Moon, White Natural Star", @@ -107344,6 +107349,7 @@ var CardInfo = { cid: 1769, "timestamp": 1468055282847, "wxid": "WX13-005A", + sideB: 1768, name: "白羅星 フルムーン", name_zh_CN: "白罗星 满月", name_en: "Full Moon, White Natural Star", @@ -107391,6 +107397,7 @@ var CardInfo = { }; var signis = this.player.signis.filter(filter); var hands = this.player.hands.filter(filter); + var cards_trash = []; if (concat(signis,hands).length < 3) return null; if (this.canSummon()) { return function () { @@ -107462,7 +107469,7 @@ var CardInfo = { ], constEffects: [{ action: function (set,add) { - this.player.signis.forEach(function (signis) { + this.player.signis.forEach(function (signi) { if (!signi.resona) return; add(signi,'effectFilters',function (card) { return (card.player === this.player) || (card.type !== 'SIGNI'); @@ -108113,6 +108120,7 @@ var CardInfo = { cid: 1778, "timestamp": 1468055302872, "wxid": "WX13-006A", + sideB: 1779, name: "黒幻蟲 オウグソク【FA】", name_zh_CN: "黑幻虫 大王具足虫【FA】", name_en: "Ougusoku, Black Phantom Insect (FA)", @@ -108161,6 +108169,7 @@ var CardInfo = { }; var signis = this.player.signis.filter(filter); var hands = this.player.hands.filter(filter); + var cards_trash = []; if (concat(signis,hands).length < 3) return null; if (this.canSummon()) { return function () { @@ -108285,6 +108294,7 @@ var CardInfo = { cid: 1779, "timestamp": 1468055304948, "wxid": "WX13-006B", + sideA: 1768, name: "黒幻蟲 オウグソク【HS】", name_zh_CN: "黑幻虫 大王具足虫【HS】", name_en: "Ougusoku, Black Phantom Insect (HS)", @@ -108515,11 +108525,14 @@ var CardInfo = { startUpEffects: [{ actionAsyn: function () { var cards = this.player.trashZone.cards.filter(function (card) { + // 注意这里不要 card.canSummon() ,因为可以通过选择不满足的SIGNI达成空发。 return (card.type === 'SIGNI') && card.hasColor('white'); },this); return this.player.selectAsyn('SUMMON_SIGNI',cards).callback(this,function (card) { if (!card.canSummon()) return; - return card.summonAsyn(); + return card.summonAsyn().callback(this,function () { + card.trashWhenTurnEnd(); + }); }); } }], @@ -109109,6 +109122,7 @@ var CardInfo = { }; var signis = this.player.signis.filter(filter); var hands = this.player.hands.filter(filter); + var cards_trash = []; if (concat(signis,hands).length < 3) return null; if (this.canSummon()) { return function () { @@ -109855,7 +109869,7 @@ var CardInfo = { }); } }); - add(this,'onAttackPhaseStart',effect); + add(this.player,'onAttackPhaseStart',effect); } }], // ====================== diff --git a/Player.js b/Player.js index 649d776..c3822ac 100644 --- a/Player.js +++ b/Player.js @@ -411,6 +411,7 @@ Player.prototype.summonSigniAsyn = function () { // 玩家召唤共鸣SIGNI Player.prototype.summonResonaSigniAsyn = function (arg) { + if (!arg) arg = {}; var cards = this.getResonas(arg); if (!cards.length) { return Callback.never(); diff --git a/Zone.js b/Zone.js index 701f46c..af84a6a 100644 --- a/Zone.js +++ b/Zone.js @@ -25,7 +25,10 @@ function Zone (game,player,name,args,pids) { this.cards = []; if (isArr(pids)) { pids.forEach(function (pid) { - this.cards.push(new Card(game,player,this,pid)); + var card = new Card(game,player,this,pid); + this.cards.push(card); + if (card.sideA) this.cards.push(card.sideA); + if (card.sideB) this.cards.push(card.sideB); },this); } diff --git a/package.json b/package.json new file mode 100644 index 0000000..d55e62b --- /dev/null +++ b/package.json @@ -0,0 +1,8 @@ +{ + "dependencies": { + "compression": "^1.6.2", + "express": "^4.14.0", + "random-js": "^1.0.8", + "socket.io": "^1.5.0" + } +} diff --git a/webxoss-client b/webxoss-client index 1129c71..a309b94 160000 --- a/webxoss-client +++ b/webxoss-client @@ -1 +1 @@ -Subproject commit 1129c71e168857fee9416066f7f64b7fdb8f7491 +Subproject commit a309b946d29d9a29f2ba1f69b07f3c0162665c8b