'use strict'; mode.story={ forcehide:['wuxie','cardPileButton','pause','auto','replay'], start:function(){ 'step 0' game.loadChess(); 'step 1' game.loadScene(); }, story:{ version:1, scene:{ connect:{ hulaoguan:{ name:'虎牢关', to:['middle','east'] }, huanghedukou:{ name:'黄河渡口', to:['east','north'] }, yanmenguan:{ name:'雁门关', to:['north','northwest'] }, changjiangdukou:{ name:'长江渡口', to:['east','southeast'] }, jiamengguan:{ name:'葭萌关', to:['south','southeast'] } }, middle:{ taoyuanxiang:{ name:'桃源乡', }, yingxiongting:{ name:'英雄亭', }, nanyang:{ name:'南阳', }, xinye:{ name:'新野' }, xujiacun:{ name:'许家村', }, }, east:{ luoyang:{ name:'洛阳' }, juyang:{ name:'雎阳' }, xiapi:{ name:'下邳' }, beihai:{ name:'北海' }, tianshizhong:{ name:'天师冢' } }, north:{ yecheng:{ name:'邺城' }, julu:{ name:'钜鹿' }, shangdang:{ name:'上党' }, beiping:{ name:'北平' }, xieliang:{ name:'解良' }, }, northwest:{ wuwei:{ name:'武威' }, xiqiang:{ name:'西羌' }, xiongnu:{ name:'匈奴' }, huashan:{ name:'华山' }, changan:{ name:'长安' }, }, south:{ chengdu:{ name:'成都' }, wulin:{ name:'武陵' }, nanman:{ name:'南蛮' }, shanyue:{ name:'山越' }, changsha:{ name:'长沙' }, }, southeast:{ xiangyang:{ name:'襄阳' }, jianye:{ name:'建业' }, chaisang:{ name:'柴桑' }, jiangxia:{ name:'江夏' }, zhongshan:{ name:'钟山' }, } } }, game:{ minskin:true, singleHandcard:true, chess:true, saveData:function(){ game.save(get.config('save'),game.data); }, 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.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:'移动' } };