diff --git a/card/extra.js b/card/extra.js index 3e726e46b..7744a7d63 100755 --- a/card/extra.js +++ b/card/extra.js @@ -28,11 +28,11 @@ card.extra={ target.node.jiu=ui.create.div('.playerjiu',target.node.avatar); target.node.jiu2=ui.create.div('.playerjiu',target.node.avatar2); } - if(card.clone&&card.clone.parentNode==target.parentNode){ + if(card.clone&&(card.clone.parentNode==target.parentNode||card.clone.parentNode==ui.arena)){ card.clone.moveDelete(target); } },target,card); - if(card.clone&&card.clone.parentNode==target.parentNode){ + if(card.clone&&(card.clone.parentNode==target.parentNode||card.clone.parentNode==ui.arena)){ game.addVideo('gain2',target,get.cardsInfo([card])); } } diff --git a/card/swd.js b/card/swd.js index 5fec01d9f..6f0094356 100755 --- a/card/swd.js +++ b/card/swd.js @@ -260,7 +260,7 @@ card.swd={ if(target==_status.dying) target.recover(); else{ target.addTempSkill('tianxianjiu',['phaseAfter','shaAfter']); - if(card.clone&&card.clone.parentNode==player.parentNode){ + if(card.clone&&(card.clone.parentNode==player.parentNode||card.clone.parentNode==ui.arena)){ card.clone.moveDelete(target); game.addVideo('gain2',target,get.cardsInfo([card])); } diff --git a/character/shenhua.js b/character/shenhua.js index fe0f6d074..ff9643c5f 100644 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -1869,6 +1869,7 @@ character.shenhua={ event.current.animate('target'); event.current.chooseToUse('乱舞:使用一张杀或流失一点体力',{name:'sha'},function(card,player,target){ if(player==target) return false; + if(!player.canUse('sha',target)) return false; if(get.distance(player,target)<=1) return true; for(var i=0;iui.arenalog.offsetHeight){ ui.arenalog.lastChild.remove(); @@ -23058,7 +23188,7 @@ e.preventDefault(); var item=document.elementFromPoint(e.touches[0].clientX,e.touches[0].clientY); while(item){ - if(lib.config.enable_touchdragline&&_status.mouseleft&&lib.config.mode!='chess'){ + if(lib.config.enable_touchdragline&&_status.mouseleft&&!game.chess){ ui.canvas.width=ui.arena.offsetWidth; ui.canvas.height=ui.arena.offsetHeight; var ctx=ui.ctx; @@ -23111,7 +23241,7 @@ var ex=e.touches[0].clientX-ui.arena.offsetLeft; var ey=e.touches[0].clientY-ui.arena.offsetTop; var exx=ex,eyy=ey; - if(lib.config.mode=='chess'){ + if(game.chess){ ex-=-ui.chessContainer.scrollLeft+ui.chess.offsetLeft; ey-=-ui.chessContainer.scrollTop+ui.chess.offsetTop; } @@ -23163,7 +23293,7 @@ } node.style.transform='rotate('+(-deg)+'deg) scaleY(0)'; node.style.height=get.xyDistance(from,to)+'px'; - if(lib.config.mode=='chess'){ + if(game.chess){ ui.chess.appendChild(node); } else{ @@ -23443,7 +23573,7 @@ var ex=e.x-ui.arena.offsetLeft; var ey=e.y-ui.arena.offsetTop; var exx=ex,eyy=ey; - if(lib.config.mode=='chess'){ + if(game.chess){ ex-=-ui.chessContainer.scrollLeft+ui.chess.offsetLeft; ey-=-ui.chessContainer.scrollTop+ui.chess.offsetTop; } @@ -23863,7 +23993,7 @@ else{ game.closePopped(); } - if(_status.event.custom.add.window){ + if(_status.event.custom&&_status.event.custom.add.window){ _status.event.custom.add.window(clicked); } }, @@ -23984,7 +24114,7 @@ if(!notoggle){ this.classList.toggle('selected'); } - if(lib.config.mode=='chess'&&get.config('show_range')&&!_status.event.skill&&this.classList.contains('selected')&& + if(game.chess&&get.config('show_range')&&!_status.event.skill&&this.classList.contains('selected')&& _status.event.isMine()&&_status.event.name=='chooseToUse'){ var player=_status.event.player; var range=get.info(this).range; @@ -24710,6 +24840,7 @@ var offset=-length/2; var control=controls.shift(); control.style.transform='translateX('+offset+'px)'; + control._offset=offset; while(controls.length){ var control=controls.shift(); var width=widths.shift(); @@ -24718,6 +24849,7 @@ offset+=6; } control.style.transform='translateX('+offset+'px)'; + control._offset=offset; } }, updatex:function(){ @@ -24862,7 +24994,7 @@ ui.updates[i](); } if(ui.dialog&&!ui.dialog.classList.contains('noupdate')){ - if(lib.config.mode=='chess'){ + if(game.chess){ if(ui.dialog.content.scrollHeight<240&&(!ui.dialog.buttons||!ui.dialog.buttons.length)){ ui.dialog.style.height=ui.dialog.content.offsetHeight+'px'; ui.dialog.classList.add('slim'); @@ -25517,7 +25649,7 @@ if(!game.players.contains(to)&&!game.dead.contains(to)) return Infinity; var player=from,m,n=1,i; var fxy,txy; - if(lib.config.mode=='chess'){ + if(game.chess){ fxy=from.getXY(); txy=to.getXY(); n=Math.abs(fxy[0]-txy[0])+Math.abs(fxy[1]-txy[1]); diff --git a/image/splash/realtime.jpg b/image/splash/realtime.jpg new file mode 100755 index 000000000..c0bb96785 Binary files /dev/null and b/image/splash/realtime.jpg differ diff --git a/image/splash/story.jpg b/image/splash/story.jpg new file mode 100644 index 000000000..1b8f68c92 Binary files /dev/null and b/image/splash/story.jpg differ diff --git a/layout/default/layout.css b/layout/default/layout.css index a1d719ada..5514b2a38 100755 --- a/layout/default/layout.css +++ b/layout/default/layout.css @@ -140,7 +140,13 @@ table{table-layout: fixed;} position: relative; transition: all 0.8s; } -#splash:not(.touch)>div:hover{ +#splash>div:first-child{ + margin-left: 20px; +} +#splash>div:last-child{ + margin-right: 20px; +} +#splash:not(.touch)>div:hover:not(.clicked){ transform: translateY(-20px); } #splash>div.clicked{ @@ -1306,6 +1312,7 @@ div:hover>.intro{opacity: 1;} } .player .identity[data-color="zhu"], .player .identity[data-color="truezhu"], +.player .identity[data-color="enemy"], div[data-nature='fire'], span[data-nature='fire']{ text-shadow: black 0 0 1px,rgba(232, 53, 53,1) 0 0 2px,rgba(232, 53, 53,1) 0 0 5px,rgba(232, 53, 53,1) 0 0 10px, @@ -1319,6 +1326,8 @@ span[data-nature='firem']{ .player .identity[data-color="zhong"], .player .identity[data-color="mingzhong"], .player .identity[data-color="qun"], +.player .identity[data-color="neutral"], +.player .identity[data-color="friend2"], div[data-nature='metal'], span[data-nature='metal']{ text-shadow: black 0 0 1px,rgba(255, 203, 0,1) 0 0 2px,rgba(255, 203, 0,1) 0 0 5px,rgba(255, 203, 0,1) 0 0 10px, @@ -1366,6 +1375,7 @@ span[data-nature='woodmm']{ .player .identity[data-color="cai"], .player .identity[data-color="wei"], .player .identity[data-color="falsezhu"], +.player .identity[data-color="friend"], div[data-nature='water'], span[data-nature='water']{ text-shadow: rgba(78, 117, 140,1) 0 0 2px,rgba(78, 117, 140,1) 0 0 5px,rgba(78, 117, 140,1) 0 0 10px, diff --git a/mode/chess.js b/mode/chess.js index 2ee2310eb..bcdeed7c3 100755 --- a/mode/chess.js +++ b/mode/chess.js @@ -1015,7 +1015,7 @@ mode.chess={ } game.over(game.me.side==game.players[0].side); }, - $draw:function(num){ + $draw_old:function(num){ var cards; if(get.itemtype(num)=='cards'){ cards=num; @@ -1113,7 +1113,7 @@ mode.chess={ } } }, - $throw:function(card,time,init){ + $throw_old:function(card,time,init){ if(init!==false){ if(get.itemtype(card)!='cards'){ if(get.itemtype(card)=='card'){ @@ -1413,6 +1413,7 @@ mode.chess={ game:{ minskin:true, singleHandcard:true, + chess:true, treasures:[], obstacles:[], getVideoName:function(){ @@ -2283,7 +2284,7 @@ mode.chess={ var node=ui.create.div('.avatar',ui.chessinfo); node.style.backgroundImage=p.node.avatar.style.backgroundImage; node.link=p; - node.listen(game.clickChessInfo); + node.listen(ui.click.chessInfo); p.instance=node; if(_status.currentPhase==p){ node.classList.add('glow2'); @@ -2300,18 +2301,6 @@ mode.chess={ character:[] }); }, - clickChessInfo:function(e){ - if(this.link.isAlive()){ - this.link.chessFocus(); - if(this.link.classList.contains('selectable')|| - this.link.classList.contains('selected')){ - // this.link.click(); - ui.click.target.call(this.link,e); - ui.click.window.call(ui.window,e); - } - e.stopPropagation(); - } - }, leaderView:function(){ var next=game.createEvent('leaderView',false); next.content=function(){ @@ -5462,12 +5451,9 @@ mode.chess={ if(current){ current.classList.remove('glow2'); } - for(var i=0;i0; }, content:function(){ "step 0" - // var move=player.skills.contains('noactpunish')?2:1; var move=2; move=game.checkMod(player,move,'chessMove',player.get('s')); player.chooseToMove(move).phasing=true; @@ -5563,7 +5547,7 @@ mode.chess={ popup:false, filter:function(event,player){ if(event.autochoose&&event.autochoose()) return false; - if(_status.mode=='combat'&&!get.config('single_control')) return false; + if(lib.config.mode=='chess'&&_status.mode=='combat'&&!get.config('single_control')) return false; return player.isUnderControl(); }, content:function(){ @@ -5919,6 +5903,17 @@ mode.chess={ } }, click:{ + chessInfo:function(e){ + if(this.link.isAlive()){ + this.link.chessFocus(); + if(this.link.classList.contains('selectable')|| + this.link.classList.contains('selected')){ + ui.click.target.call(this.link,e); + ui.click.window.call(ui.window,e); + } + e.stopPropagation(); + } + }, playergrid:function(){ if(!_status.paused) return; var pos=parseInt(this.dataset.position); diff --git a/mode/realtime.js b/mode/realtime.js new file mode 100644 index 000000000..c76fe797a --- /dev/null +++ b/mode/realtime.js @@ -0,0 +1,9 @@ +'use strict'; +mode.realtime={ + start:function(){ + + }, + game:{ + + } +}; diff --git a/mode/story.js b/mode/story.js new file mode 100644 index 000000000..7b52927e6 --- /dev/null +++ b/mode/story.js @@ -0,0 +1,349 @@ +'use strict'; +mode.story={ + start:function(){ + 'step 0' + game.loadChess(); + 'step 1' + game.combat({ + size:[6,4] + }); + }, + game:{ + minskin:true, + singleHandcard:true, + chess:true, + addChessPlayer:function(name,enemy,num,pos){ + if(typeof num!='number'){ + num=4; + } + var player=ui.create.player(); + player.animate('start'); + if(enemy){ + player.side=!game.me.side; + player.setIdentity('enemy'); + player.identity='enemy'; + _status.enemies.push(player); + } + else{ + player.side=game.me.side; + player.setIdentity('friend'); + player.identity='friend'; + _status.friends.push(player); + } + game.players.push(player); + game.phasequeue.push(player); + ui.chess.appendChild(player); + + if(pos&&!lib.posmap[pos]){ + player.dataset.position=pos; + } + else{ + var grids=[]; + var gridnum=ui.chessheight*ui.chesswidth; + for(var i=0;i.player'+pos+ + '{left:'+(14+i*148)+'px;top:'+(14+j*148)+'px}',0); + ui.chesssheet.sheet.insertRule('#arena.chess #chess>.card'+pos+ + '{left:'+(22+i*148)+'px;top:'+(22+j*148)+'px}',0); + ui.chesssheet.sheet.insertRule('#arena.chess #chess>.popup'+pos+ + '{left:'+(19+i*148)+'px;top:'+(142+j*148)+'px}',0); + } + } + + var grids=[]; + var gridnum=ui.chessheight*ui.chesswidth; + for(var i=0;i=list.length/2,0); + } + game.modeSwapPlayer(game.players[3]); + game.delay(0.5); + 'step 1' + event.trigger('gameStart'); + game.gameDraw(game.players[0]); + game.phaseLoop(game.players[0]); + } + }, + loadChess:function(){ + var next=game.createEvent('loadChess'); + next.content=function(){ + 'step 0' + game.loadMode('chess'); + 'step 1' + for(var i in result.element){ + for(var j in result.element[i]){ + if(j!='dieAfter'){ + lib.element[i][j]=result.element[i][j]; + } + } + } + for(var i in result.ui){ + for(var j in result.ui[i]){ + ui[i][j]=result.ui[i][j]; + } + } + ai.get.attitude=result.ai.get.attitude; + game.$randomMove=result.game.$randomMove; + game.modeSwapPlayer=result.game.modeSwapPlayer; + game.isChessNeighbour=result.game.isChessNeighbour; + get.chessDistance=result.get.chessDistance; + lib.skill._chessmove=result.skill._chessmove; + lib.skill._chessswap=result.skill._chessswap; + lib.skill._chesscenter=result.skill._chesscenter; + lib.skill._phasequeue=result.skill._phasequeue; + 'step 2' + for(var i in lib.skill){ + if(lib.skill[i].changeSeat){ + lib.skill[i]={}; + if(lib.translate[i+'_info']){ + lib.translate[i+'_info']='此模式下不可用'; + } + } + } + lib.init.css(lib.assetURL+'layout/mode','chess'); + ui.create.cards(); + game.finishCards(); + ui.arena.classList.add('chess'); + + ui.chessContainer=ui.create.div('#chess-container',ui.arena); + lib.setScroll(ui.chessContainer); + ui.chess=ui.create.div('#chess',ui.chessContainer); + ui.canvas2=document.createElement('canvas'); + ui.canvas2.id='canvas2'; + ui.chess.appendChild(ui.canvas2); + ui.ctx2=ui.canvas2.getContext('2d'); + game.me=ui.create.player(); + + if(!lib.config.touchscreen){ + ui.chess.addEventListener('mousedown',function(e){ + if(Array.isArray(e.path)){ + for(var i=0;i2) return false; + var xy1=event.source.getXY(); + var xy2=player.getXY(); + var dx=xy2[0]-xy1[0]; + var dy=xy2[1]-xy1[1]; + if(dx==0&&Math.abs(dy)==2){ + dy/=2; + } + if(dy==0&&Math.abs(dx)==2){ + dx/=2; + } + return player.movable(dx,dy); + }, + content:function(){ + var xy1=trigger.source.getXY(); + var xy2=player.getXY(); + var dx=xy2[0]-xy1[0]; + var dy=xy2[1]-xy1[1]; + if(dx==0&&Math.abs(dy)==2){ + dy/=2; + } + if(dy==0&&Math.abs(dx)==2){ + dx/=2; + } + if(player.movable(dx,dy)){ + player.move(dx,dy); + } + } + }, + }, + posmap:{}, + translate:{ + friend:'友', + friend2:'友', + enemy:'敌', + neutral:'中', + _chessmove:'移动' + } +};