"use strict"; (function(){ if(!localStorage.getItem('gplv3_noname_alerted')){ if(confirm('①无名杀是一款基于GPLv3协议的开源软件!\n你可以在遵守GPLv3协议的基础上任意使用,修改并转发《无名杀》,以及所有基于《无名杀》开发的拓展。\n点击“确定”即代表您认可并接受GPLv3协议↓️\nhttps://www.gnu.org/licenses/gpl-3.0.html\n②无名杀官方发布地址仅有GitHub仓库!\n其他所有的所谓“无名杀”社群(包括但不限于绝大多数“官方”QQ群、QQ频道等)均为玩家自发组织,与无名杀官方无关!')){ localStorage.setItem('gplv3_noname_alerted',true); } else{ var ua=navigator.userAgent.toLowerCase(); var ios=ua.indexOf('iphone')!=-1||ua.indexOf('ipad')!=-1||ua.indexOf('macintosh')!=-1; //electron if(typeof window.process=='object'&&typeof window.require=='function'){ var versions=window.process.versions; var electronVersion=parseFloat(versions.electron); var remote; if(electronVersion>=14){ remote=require('@electron/remote'); }else{ remote=require('electron').remote; } var thisWindow=remote.getCurrentWindow(); thisWindow.destroy(); window.process.exit(); } //android-cordova环境 //ios-cordova环境或ios浏览器环境 //非ios的网页版 else if(!ios){ window.close(); } } } var _status={ paused:false, paused2:false, paused3:false, over:false, clicked:false, auto:false, event:{ finished:true, next:[], after:[] }, ai:{}, lastdragchange:[], skillaudio:[], dieClose:[], dragline:[], dying:[], globalHistory:[{ cardMove:[], custom:[], useCard:[], changeHp:[], }], cardtag:{ yingbian_zhuzhan:[], yingbian_kongchao:[], yingbian_fujia:[], yingbian_canqu:[], }, renku:[], prehidden_skills:[], postReconnect:{}, }; var lib={ configprefix:'noname_0.9_', versionOL:27, updateURLS:{ coding:'https://ghproxy.com/https://raw.githubusercontent.com/libccy/noname', github:'https://raw.githubusercontent.com/libccy/noname', }, updateURL:'https://raw.githubusercontent.com/libccy/noname', mirrorURL:'https://nakamurayuri.coding.net/p/noname/d/noname/git/raw', hallURL:'47.99.105.222', assetURL:'', changeLog:[], updates:[], canvasUpdates:[], video:[], skilllist:[], connectBanned:[], characterIntro:{}, characterTitle:{}, characterPack:{}, characterFilter:{}, characterSort:{}, characterReplace:{}, dynamicTranslate:{}, cardPack:{}, skin:{}, onresize:[], onphase:[], onwash:[], onover:[], ondb:[], ondb2:[], chatHistory:[], emotionList:{ xiaowu_emotion:14, shibing_emotion:15, guojia_emotion:20, zhenji_emotion:20, xiaosha_emotion:20, xiaotao_emotion:20, xiaojiu_emotion:20, }, animate:{ skill:{}, card:{}, }, arenaReady:[], onfree:[], inpile:[], inpile_nature:[], extensions:[], extensionPack:{}, cardType:{}, hook:{globaltrigger:{},globalskill:{}}, hookmap:{}, imported:{}, layoutfixed:['chess','tafang','stone'], pinyins:{ metadata:{ shengmu:['zh','ch','sh','b','p','m','f','d','t','l','n','g','k','h','j','q','x','r','z','c','s','y','w'], special_shengmu:['j','q','x','y'], feijiemu:{ i:['ing','iu','ie','in'], u:['ui','un'], ü:['üe','ün'], }, zhengtirendu:['zhi','chi','shi','ri','zi','ci','si'], yunjiao:{ '一麻':['a','ia','ua'], '二波':['o','e','uo'], '三皆':['ie','üe'], '四开':['ai','uai'], '五微':['ei','ui'], '六豪':['ao','iao'], '七尤':['ou','iu'], '八寒':['an','ian','uan','üan'], '九文':['en','in','un','ün'], '十唐':['ang','iang','uang'], '十一庚':['eng','ing','ong','ung'], '十二齐':['i','er','ü'], '十三支':['-i'], '十四姑':['u'], }, } }, characterDialogGroup:{ '收藏':function(name,capt){ return lib.config.favouriteCharacter.contains(name)?capt:null; }, '最近':function(name,capt){ var list=get.config('recentCharacter')||[]; return list.contains(name)?capt:null; } }, listenEnd:function(node){ if(!node._listeningEnd){ node._listeningEnd=true; node.listenTransition(function(){ delete node._listeningEnd; if(node._onEndMoveDelete){ node.moveDelete(node._onEndMoveDelete); } else if(node._onEndDelete){ node.delete(); } node._transitionEnded=true; }); } }, configMenu:{ general:{ name:'通用', config:{ low_performance:{ name:'流畅模式', init:false, intro:'减少部分游戏特效,提高游戏速度', onclick:function(bool){ game.saveConfig('low_performance',bool); if(bool){ ui.window.classList.add('low_performance'); } else{ ui.window.classList.remove('low_performance'); } } }, compatiblemode:{ name:'兼容模式', init:false, intro:'开启兼容模式可防止扩展使游戏卡死并提高对旧扩展的兼容性,但对游戏速度有一定影响,若无不稳定或不兼容的扩展建议关闭', onclick:function(bool){ game.saveConfig('compatiblemode',bool); if(bool){ ui.window.classList.add('compatiblemode'); } else{ ui.window.classList.remove('compatiblemode'); } } }, confirm_exit:{ name:'确认退出', init:false, unfrequent:true, intro:'离开游戏前弹出确认对话框', }, keep_awake:{ name:'屏幕常亮', init:false, unfrequent:true, intro:'防止屏幕自动关闭
注:旧版本通过NoSleep.js实现的屏幕常亮可能会影响外置音频的音量', onclick:function(bool){ game.saveConfig('keep_awake',bool); if(bool){ if(window.plugins&&window.plugins.insomnia) window.plugins.insomnia.keepAwake(); else if(window.noSleep){ document.addEventListener(lib.config.touchscreen?'touchend':'click', function enableNoSleepX() { document.removeEventListener(lib.config.touchscreen?'touchend':'click', enableNoSleepX, false); window.noSleep.enable(); }, false); } } else{ if(window.plugins&&window.plugins.insomnia) window.plugins.insomnia.allowSleepAgain(); else if(window.noSleep) window.noSleep.disable(); } } }, auto_confirm:{ name:'自动确认', init:true, unfrequent:true, intro:'当候选目标只有1个时,点击目标后无需再点击确认', }, skip_shan:{ name:'无闪自动取消', init:false, unfrequent:true, intro:'当自己需要使用或打出【闪】时,若自己没有【闪】,则跳过该步骤', }, unauto_choose:{ name:'拆顺手牌选择', init:false, unfrequent:true, intro:'拆牌或者顺牌时,就算只能选择对方的手牌依然手动选择', }, wuxie_self:{ name:'不无懈自己', init:true, unfrequent:true, intro:'自己使用的单目标普通锦囊即将生效时,不询问无懈', }, tao_enemy:{ name:'不对敌方出桃', init:false, intro:'双方阵营明确的模式中(如对决),敌方角色濒死时不询问出桃', unfrequent:true, }, enable_drag:{ name:'启用拖拽', init:true, intro:'按住卡牌后可将卡牌拖至目标', unfrequent:true, }, enable_dragline:{ name:'拖拽指示线', init:true, unfrequent:true, intro:'拖拽时显示虚线,可能降低游戏速度', }, enable_touchdragline:{ name:'拖拽指示线', init:false, unfrequent:true, intro:'拖拽时显示虚线,可能降低游戏速度', }, // enable_pressure:{ // name:'启用压感', // init:false, // intro:'开启后可通过按压执行操作', // unfrequent:true, // }, // pressure_taptic:{ // name:'触觉反馈', // init:false, // intro:'开启后按压操作执行时将产生震动', // unfrequent:true, // }, // pressure_click:{ // name:'按压操作', // init:'pause', // intro:'在空白区域按压时的操作', // unfrequent:true, // item:{ // pause:'暂停', // config:'选项', // auto:'托管', // } // }, touchscreen:{ name:'触屏模式', init:false, restart:true, unfrequent:true, intro:'开启后可使触屏设备反应更快,但无法使用鼠标操作', onclick:function(bool){ if(get.is.nomenu('touchscreen',bool)) return false; game.saveConfig('touchscreen',bool); } }, swipe:{ name:'滑动手势', init:true, unfrequent:true, intro:'在非滚动区域向四个方向滑动可执行对应操作', }, swipe_down:{ name:'下划操作', init:'menu', unfrequent:true, intro:'向下滑动时执行的操作', item:{ system:'显示按钮', menu:'打开菜单', pause:'切换暂停', auto:'切换托管', chat:'显示聊天', off:'关闭', }, onclick:function(item){ if(get.is.nomenu('swipe_down',item)) return false; game.saveConfig('swipe_down',item); } }, swipe_up:{ name:'上划操作', intro:'向上滑动时执行的操作', init:'auto', unfrequent:true, item:{ system:'显示按钮', menu:'打开菜单', pause:'切换暂停', auto:'切换托管', chat:'显示聊天', off:'关闭', }, onclick:function(item){ if(get.is.nomenu('swipe_up',item)) return false; game.saveConfig('swipe_up',item); } }, swipe_left:{ name:'左划操作', intro:'向左滑动时执行的操作', init:'system', unfrequent:true, item:{ system:'显示按钮', menu:'打开菜单', pause:'切换暂停', auto:'切换托管', chat:'显示聊天', off:'关闭', }, onclick:function(item){ if(get.is.nomenu('swipe_left',item)) return false; game.saveConfig('swipe_left',item); } }, swipe_right:{ name:'右划操作', intro:'向右滑动时执行的操作', init:'system', unfrequent:true, item:{ system:'显示按钮', menu:'打开菜单', pause:'切换暂停', auto:'切换托管', chat:'显示聊天', off:'关闭', }, onclick:function(item){ if(get.is.nomenu('swipe_right',item)) return false; game.saveConfig('swipe_right',item); } }, round_menu_func:{ name:'触屏按钮操作', intro:'点击屏幕中圆形按钮时执行的操作', init:'system', unfrequent:true, item:{ system:'显示按钮', menu:'打开菜单', pause:'切换暂停', auto:'切换托管' }, onclick:function(item){ if(get.is.nomenu('round_menu_func',item)) return false; game.saveConfig('round_menu_func',item); }, }, show_splash:{ name:'显示开始界面', intro:'游戏开始前进入模式选择画面', init:'init', item:{ off:'关闭', init:'首次启动', always:'保持开启', } }, game_speed:{ name:'游戏速度', init:'mid', item:{ vslow:'慢', slow:'较慢', mid:'中', fast:'较快', vfast:'快', vvfast:'很快', }, intro:'设置不同游戏操作间的时间间隔' }, sync_speed:{ name:'限制结算速度', intro:'在动画结算完成前不执行下一步操作,开启后游戏操作的间隔更长但画面更浏畅,在游戏较卡时建议开启', init:true }, enable_vibrate:{ name:'开启震动', intro:'回合开始时使手机震动', init:false }, right_click:{ name:'右键操作', init:'pause', intro:'在空白区域点击右键时的操作', unfrequent:true, item:{ pause:'暂停', shortcut:'工具', config:'选项', auto:'托管', }, onclick:function(item){ if(get.is.nomenu('right_click',item)) return false; game.saveConfig('right_click',item); } }, longpress_info:{ name:'长按显示信息', init:true, unfrequent:true, restart:true, intro:'长按后弹出菜单', }, right_info:{ name:'右键显示信息', init:true, unfrequent:true, restart:true, intro:'右键点击后弹出菜单', }, hover_all:{ name:'悬停显示信息', init:true, unfrequent:true, restart:true, intro:'悬停后弹出菜单', }, hover_handcard:{ name:'悬停手牌显示信息', init:true, unfrequent:true, intro:'悬停手牌后弹出菜单', }, hoveration:{ name:'悬停菜单弹出时间', unfrequent:true, intro:'鼠标移至目标到弹出菜单的时间间隔', init:'1000', item:{ '500':'0.5秒', '700':'0.7秒', '1000':'1秒', '1500':'1.5秒', '2500':'2.5秒', } }, doubleclick_intro:{ name:'双击显示武将资料', init:true, unfrequent:true, intro:'双击武将头像后显示其资料卡', }, video:{ name:'保存录像', init:'20', intro:'游戏结束后保存录像在最大条数,超过后将从最早的录像开始删除(已收藏的录像不计入条数)', item:{ '0':'关闭', '5':'五局', '10':'十局', '20':'二十局', '50':'五十局', '10000':'无限', }, unfrequent:true, }, max_loadtime:{ name:'最长载入时间', intro:'设置游戏从启动到完成载入所需的最长时间,超过此时间未完成载入会报错,若设备较慢或安装了较多扩展可适当延长此时间', init:'5000', unfrequent:true, item:{ 5000:'5秒', 10000:'10秒', 20000:'20秒', 60000:'60秒' }, onclick:function(item){ game.saveConfig('max_loadtime',item); if(item=='5000'){ localStorage.removeItem(lib.configprefix+'loadtime'); } else{ localStorage.setItem(lib.configprefix+'loadtime',item); } } }, mousewheel:{ name:'滚轮控制手牌', init:true, unfrequent:true, intro:'开启后滚轮可使手牌横向滚动,在mac等可横向滚动的设备上建议关闭', onclick:function(bool){ game.saveConfig('mousewheel',bool); if(lib.config.touchscreen) return; if(lib.config.mousewheel){ ui.handcards1Container.onmousewheel=ui.click.mousewheel; ui.handcards2Container.onmousewheel=ui.click.mousewheel; } else{ ui.handcards1Container.onmousewheel=null; ui.handcards2Container.onmousewheel=null; } } }, auto_check_update:{ name:'自动检查游戏更新', intro:'进入游戏时检查更新', init:false, unfrequent:true }, lucky_star:{ name:'幸运星模式', intro:'在涉及随机数等的技能中,必定得到效果最好的结果。(联机模式无效)', init:false, unfrequent:true }, dev:{ name:'开发者模式', intro:'开启后可使用浏览器控制台控制游戏,同时可更新到开发版', init:false, onclick:function(bool){ game.saveConfig('dev',bool); if(_status.connectMode) return; if(bool){ lib.cheat.i(); } else{ delete window.cheat; delete window.game; delete window.ui; delete window.get; delete window.ai; delete window.lib; delete window._status; } }, unfrequent:true, }, fuck_sojson:{ name:'检测加密扩展', init:false, }, errstop:{ name:'出错时停止游戏', init:false, unfrequent:true }, update_link:{ name:'更新地址', init:'coding', unfrequent:true, item:{ coding:'Github Proxy', github:'GitHub', }, onclick:function(item){ game.saveConfig('update_link',item); lib.updateURL=lib.updateURLS[item]||lib.updateURLS.coding; }, }, extension_source:{ name:'获取扩展地址', init:'Coding', unfrequent:true, item:{}, intro:function(){ return '获取在线扩展时的地址。当前地址:
'+lib.config.extension_sources[lib.config.extension_source]; }, onclick:function(item){ game.saveConfig('extension_source',item); }, }, extension_create:{ name:'添加获取扩展地址', clear:true, unfrequent:true, onclick:function(){ game.prompt('请输入地址名称',function(str){ if(str){ var map=lib.config.extension_sources; game.prompt('请输入'+str+'的地址',function(str2){ if(str2){ delete map[str]; map[str]=str2; game.saveConfig('extension_sources',map); game.saveConfig('extension_source',str); var nodexx=ui.extension_source; nodexx.updateInner(); var nodeyy=nodexx._link.menu; var nodezz=nodexx._link.config; for(var i=0;i
'); } }, onclick:function(theme){ game.saveConfig('theme',theme); ui.arena.hide(); lib.init.background(); if(lib.config.autostyle){ if(theme=='simple'){ lib.configMenu.appearence.config.player_border.onclick('slim'); } else{ lib.configMenu.appearence.config.player_border.onclick('normal'); } } setTimeout(function(){ var theme=ui.css.theme; ui.css.theme=lib.init.css(lib.assetURL+'theme/'+lib.config.theme,'style'); theme.remove(); setTimeout(function(){ui.arena.show();},100); },500); } }, layout:{ name:'布局', init:'mobile', item:{ //default:'旧版', newlayout:'对称', mobile:'默认', long:'宽屏', long2:'手杀', nova:'新版' }, visualMenu:function(node,link){ node.className='button character themebutton '+lib.config.theme; if(!node.created){ node.created=true; node.style.overflow='hidden'; node.firstChild.style.display='none'; // node.firstChild.classList.add('shadowed'); // node.firstChild.style.width='16px'; // node.firstChild.style.height='auto'; // node.firstChild.style.padding='2px'; // node.firstChild.style.textAlign='center'; var me=ui.create.div(node); me.style.top='auto'; if(link=='default'||link=='newlayout'){ me.style.width='calc(100% - 6px)'; me.style.left='3px'; me.style.bottom='3px'; me.style.height='25px'; if(link=='newlayout'){ me.style.height='23px'; me.style.bottom='4px'; } } else if(link=='long2'||link=='nova'){ me.style.display='none'; } else{ me.style.width='120%'; me.style.left='-10%'; me.style.bottom='0'; me.style.height='22px'; } me.style.borderRadius='2px'; var list=['re_caocao','re_liubei','sp_zhangjiao','sunquan']; for(var i=0;i<4;i++){ var player=ui.create.div('.fakeplayer',node); ui.create.div('.avatar',player).setBackground(list.randomRemove(),'character'); player.style.borderRadius='2px'; if(i!=3){ player.style.top='auto'; } if(link=='default'){ player.style.height='19px'; player.style.width='38px'; player.classList.add('oldlayout') } else if(link=='mobile'||link=='newlayout'){ player.style.width='24px'; player.style.height='29px'; } else if(link=='nova') { player.style.width='20px'; player.style.height='24px'; } else{ player.style.width='20px'; player.style.height='34px'; } if(i==1){ player.style.left='3px'; } if(i==2){ player.style.left='auto'; player.style.right='3px'; } if(i==3){ player.style.top='3px'; } if(link=='default'){ if(i==0){ player.style.bottom='6px'; } if(i==0||i==3){ player.style.left='calc(50% - 18px)'; } if(i==1||i==2){ player.style.bottom='36px'; } } else if(link=='newlayout'){ if(i==0){ player.style.bottom='1px'; } if(i==0||i==3){ player.style.left='calc(50% - 12px)'; } if(i==1||i==2){ player.style.bottom='32px'; } } else if(link=='mobile'){ if(i==0||i==3){ player.style.left='calc(50% - 12px)'; } if(i==1||i==2){ player.style.bottom='30px'; } } else if(link=='long'){ if(i==0||i==3){ player.style.left='calc(50% - 10px)'; } if(i==1||i==2){ player.style.bottom='45px'; } } else if(link=='long2'){ if(i==0){ player.style.bottom='2px'; player.style.left='3px'; } if(i==3){ player.style.left='calc(50% - 10px)'; } if(i==1||i==2){ player.style.bottom='45px'; } } else if(link=='nova'){ if(i==0){ player.style.bottom='2px'; player.style.left='3px'; } if(i==3){ player.style.left='calc(50% - 10px)'; } if(i==1||i==2){ player.style.left='3px'; player.style.bottom=(i*30)+'px'; } } if(i==0&&(link=='mobile'||link=='long')){ player.classList.add('me'); player.style.borderRadius='0px'; player.style.width='25px'; player.style.height='25px'; player.style.bottom='-3px'; player.style.left='-3px'; } } } }, onclick:function(layout){ if(lib.layoutfixed.contains(lib.config.mode)){ game.saveConfig('layout',layout); } else{ lib.init.layout(layout); } } }, // fewplayer:{ // name:'启用人数', // intro:'设置启用新版布局的最小人数(不足时切换至默认布局)', // init:'3', // // unfrequent:true, // item:{ // '2':'两人', // '3':'三人', // '4':'四人', // '5':'五人', // '6':'六人', // '7':'七人', // '8':'八人', // }, // onclick:function(item){ // game.saveConfig('fewplayer',item); // if(ui.arena) ui.arena.setNumber(ui.arena.dataset.number); // } // }, player_height:{ name:'角色高度', init:'long', // unfrequent:true, item:{ short:'矮', default:'中', long:'高', }, onclick:function(item){ game.saveConfig('player_height',item); ui.arena.dataset.player_height=item; } }, player_height_nova:{ name:'角色高度', init:'short', item:{ // auto:'自动', short:'矮', default:'中', long:'高', }, onclick:function(item){ game.saveConfig('player_height_nova',item); // if(item=='auto'){ // if(parseInt(ui.arena.dataset.number)>=7){ // ui.arena.dataset.player_height_nova='short'; // } // else{ // ui.arena.dataset.player_height_nova='default'; // } // } // else{ ui.arena.dataset.player_height_nova=item; // } } }, // background_color_music:{ // name:'背景色', // init:'black', // item:{ // blue:'蓝色', // black:'黑色', // }, // onclick:function(color){ // game.saveConfig('background_color_music',color); // document.body.dataset.background_color_music=color; // } // }, // background_color_wood:{ // name:'背景色', // init:'blue', // item:{ // blue:'蓝色', // black:'黑色', // }, // onclick:function(color){ // game.saveConfig('background_color_wood',color); // document.body.dataset.background_color_wood=color; // } // }, // theme_color_music:{ // name:'主题色', // init:'black', // item:{ // blue:'蓝色', // black:'黑色', // }, // onclick:function(color){ // game.saveConfig('theme_color_music',color); // document.body.dataset.theme_color_music=color; // } // }, ui_zoom:{ name:'界面缩放', unfrequent:true, init:'normal', item:{ esmall:'80%', vsmall:'90%', small:'95%', normal:'100%', big:'105%', vbig:'110%', ebig:'120%', eebig:'150%', eeebig:'180%', eeeebig:'200%', }, onclick:function(zoom){ game.saveConfig('ui_zoom',zoom); switch(zoom){ case 'esmall':zoom=0.8;break; case 'vsmall':zoom=0.9;break; case 'small':zoom=0.93;break; case 'big':zoom=1.05;break; case 'vbig':zoom=1.1;break; case 'ebig':zoom=1.2;break; case 'eebig':zoom=1.5;break; case 'eeebig':zoom=1.8;break; case 'eeeebig':zoom=2;break; default:zoom=1; } game.documentZoom=game.deviceZoom*zoom; ui.updatez(); if (Array.isArray(lib.onresize)) { lib.onresize.forEach(fun => { if (typeof fun == 'function') fun(); }); } } }, image_background:{ name:'游戏背景', init:'default', item:{}, visualBar:function(node,item,create){ if(node.created){ node.lastChild.classList.remove('active'); return; } node.created=true; ui.create.filediv('.menubutton','添加背景',node,function(file){ if(file){ var name=file.name; if(name.indexOf('.')!=-1){ name=name.slice(0,name.indexOf('.')); } var link=(game.writeFile?'cdv_':'custom_')+name; if(item[link]){ for(var i=1;i<1000;i++){ if(!item[link+'_'+i]){ link=link+'_'+i;break; } } } item[link]=name; var callback=function(){ create(link,node.parentNode.defaultNode); node.parentNode.updateBr(); lib.config.customBackgroundPack.add(link); game.saveConfig('customBackgroundPack',lib.config.customBackgroundPack); }; if(game.writeFile){ game.writeFile(file,'image/background',link+'.jpg',callback); } else{ game.putDB('image',link,file,callback); } if(node.lastChild.classList.contains('active')){ editbg.call(node.lastChild); } } }).inputNode.accept='image/*'; var editbg=function(){ this.classList.toggle('active'); var page=this.parentNode.parentNode; for(var i=0;i4){ node.classList.add('hideadd'); button.classList.remove('transparent'); delete node.currentDB; } }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); }); } }).inputNode.accept='image/*'; deletepic=ui.create.div('.menubutton.deletebutton','删除图片',node,function(){ if(confirm('确定删除自定义图片?(此操作不可撤销)')){ game.deleteDB('image','hp_style1'); game.deleteDB('image','hp_style2'); game.deleteDB('image','hp_style3'); game.deleteDB('image','hp_style4'); for(var i=0;idiv:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); game.getDB('image','hp_style2',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.hp_stylesheet2){ ui.css.hp_stylesheet2.remove(); } ui.css.hp_stylesheet2=lib.init.sheet('.hp:not(.text):not(.actcount)[data-condition="mid"]>div:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); game.getDB('image','hp_style3',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.hp_stylesheet3){ ui.css.hp_stylesheet3.remove(); } ui.css.hp_stylesheet3=lib.init.sheet('.hp:not(.text):not(.actcount)[data-condition="low"]>div:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); game.getDB('image','hp_style4',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.hp_stylesheet4){ ui.css.hp_stylesheet4.remove(); } ui.css.hp_stylesheet4=lib.init.sheet('.hp:not(.text):not(.actcount)>.lost{background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } }, unfrequent:true, }, player_style:{ name:'角色背景', init:'default', intro:'设置角色的背景图片', item:{ wood:'木纹', music:'音乐', simple:'简约', custom:'自定', default:'默认', }, visualBar:function(node,item,create,switcher){ if(node.created){ return; } var button; for(var i=0;i.framebg{display:block;background-image:url("'+fileLoadedEvent.target.result+'")}',0); ui.css.border_stylesheet.sheet.insertRule('.player>.count{z-index: 3 !important;border-radius: 2px !important;text-align: center !important;}',0); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } else if(layout!='default'&&layout!='auto'){ ui.css.border_stylesheet=lib.init.sheet(); if(layout.indexOf('dragon_')==0){ layout=layout.slice(7); ui.arena.dataset.framedecoration=layout; } else{ ui.arena.dataset.framedecoration=''; } ui.css.border_stylesheet.sheet.insertRule('#window .player>.framebg,#window #arena.long.mobile:not(.fewplayer) .player[data-position="0"]>.framebg{display:block;background-image:url("'+lib.assetURL+'theme/style/player/'+layout+'1.png")}',0); ui.css.border_stylesheet.sheet.insertRule('#window #arena.long:not(.fewplayer) .player>.framebg, #arena.oldlayout .player>.framebg{background-image:url("'+lib.assetURL+'theme/style/player/'+layout+'3.png")}',0); ui.css.border_stylesheet.sheet.insertRule('.player>.count{z-index: 3 !important;border-radius: 2px !important;text-align: center !important;}',0); } }, unfrequent:true, }, autoborder_count:{ name:'边框升级方式', intro:'击杀 每击杀一人,边框提升两级
伤害 每造成两点伤害,边框提升一级
混合 击杀量决定边框颜色,伤害量决定边框装饰', init:'kill', item:{ kill:'击杀', damage:'伤害', mix:'混合', }, unfrequent:true, }, autoborder_start:{ name:'基础边框颜色', init:'bronze', item:{ bronze:'铜', silver:'银', gold:'金' }, unfrequent:true }, player_border:{ name:'边框宽度', init:'normal', intro:'设置角色的边框宽度', unfrequent:true, item:{ slim:'细', narrow:'窄', normal:'中', wide:'宽' }, onclick:function(item){ game.saveConfig('player_border',item); if(item!='wide'||game.layout=='long'||game.layout=='long2'){ ui.arena.classList.add('slim_player'); } else{ ui.arena.classList.remove('slim_player'); } if(item=='slim'){ ui.arena.classList.add('uslim_player'); } else{ ui.arena.classList.remove('uslim_player'); } if(item=='narrow'){ ui.arena.classList.add('mslim_player'); } else{ ui.arena.classList.remove('mslim_player'); } if(item=='normal'&&lib.config.mode!='brawl'&&(game.layout=='long'||game.layout=='long2')){ ui.arena.classList.add('lslim_player'); } else{ ui.arena.classList.remove('lslim_player'); } ui.window.dataset.player_border=item; } }, menu_style:{ name:'菜单背景', init:'default', item:{ wood:'木纹', music:'音乐', simple:'简约', custom:'自定', default:'默认', }, visualBar:function(node,item,create,switcher){ if(node.created){ return; } var button; for(var i=0;i.dialog.popped,html .menu,html .menubg{background-image:url("'+fileLoadedEvent.target.result+'");background-size:cover}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } else if(layout!='default'){ var str=''; switch(layout){ case 'wood':str='url("'+lib.assetURL+'theme/woodden/wood2.png")';break; case 'music':str='linear-gradient(#4b4b4b, #464646);color:white;text-shadow:black 0 0 2px';break; case 'simple':str='linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4));color:white;text-shadow:black 0 0 2px';break; } ui.css.menu_stylesheet=lib.init.sheet('html #window>.dialog.popped,html .menu,html .menubg{background-image:'+str+'}'); } }, unfrequent:true, }, control_style:{ name:'按钮背景', init:'default', item:{ wood:'木纹', music:'音乐', simple:'简约', custom:'自定', default:'默认', }, visualBar:function(node,item,create,switcher){ if(node.created){ return; } var button; for(var i=0;idiv>div{background-image:url("'+fileLoadedEvent.target.result+'")}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } else if(layout!='default'){ var str=''; switch(layout){ case 'wood':str='url("'+lib.assetURL+'theme/woodden/wood.jpg")';break; case 'music':str='linear-gradient(#4b4b4b, #464646);color:white;text-shadow:black 0 0 2px';break; case 'simple':str='linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4));color:white;text-shadow:black 0 0 2px';break; } if(layout=='wood'){ ui.css.control_stylesheet=lib.init.sheet('#window .control,#window .menubutton,#window #system>div>div,#window #system>div>.pressdown2{background-image:'+str+'}'); } else{ ui.css.control_stylesheet=lib.init.sheet('#window .control,.menubutton:not(.active):not(.highlight):not(.red):not(.blue),#window #system>div>div{background-image:'+str+'}'); } } }, unfrequent:true, }, custom_button:{ name:'自定义按钮高度', init:false, unfrequent:true, onclick:function(bool){ if(bool!=='skip'){ game.saveConfig('custom_button',bool); } if(ui.css.buttonsheet){ ui.css.buttonsheet.remove(); } if(lib.config.custom_button){ var cbnum1=6+(parseInt(lib.config.custom_button_system_top)||0); var cbnum2=6+(parseInt(lib.config.custom_button_system_bottom)||0); var cbnum3=3+(parseInt(lib.config.custom_button_control_top)||0); var cbnum4=3+(parseInt(lib.config.custom_button_control_bottom)||0); var cbnum5=2; var cbnum6=2; if(cbnum3<0){ cbnum5+=cbnum3; cbnum3=0; } if(cbnum4<0){ cbnum6+=cbnum4; cbnum4=0; } ui.css.buttonsheet=lib.init.sheet( '#system>div>div, .caption>div>.tdnode{padding-top:'+cbnum1+'px !important;padding-bottom:'+cbnum2+'px !important}', '#control>.control>div{padding-top:'+cbnum3+'px;padding-bottom:'+cbnum4+'px}', '#control>.control{padding-top:'+cbnum5+'px;padding-bottom:'+cbnum6+'px}' ); } } }, custom_button_system_top:{ name:'菜单上部高度', init:'0x', item:{ '-5x':'-5px', '-4x':'-4px', '-3x':'-3px', '-2x':'-2px', '-1x':'-1px', '0x':'默认', '1x':'1px', '2x':'2px', '3x':'3px', '4x':'4px', '5x':'5px', }, unfrequent:true, onclick:function(item){ game.saveConfig('custom_button_system_top',item); lib.configMenu.appearence.config.custom_button.onclick('skip'); } }, custom_button_system_bottom:{ name:'菜单下部高度', init:'0x', item:{ '-5x':'-5px', '-4x':'-4px', '-3x':'-3px', '-2x':'-2px', '-1x':'-1px', '0x':'默认', '1x':'1px', '2x':'2px', '3x':'3px', '4x':'4px', '5x':'5px', }, unfrequent:true, onclick:function(item){ game.saveConfig('custom_button_system_bottom',item); lib.configMenu.appearence.config.custom_button.onclick('skip'); } }, custom_button_control_top:{ name:'技能上部高度', init:'0x', item:{ '-5x':'-5px', '-4x':'-4px', '-3x':'-3px', '-2x':'-2px', '-1x':'-1px', '0x':'默认', '1x':'1px', '2x':'2px', '3x':'3px', '4x':'4px', '5x':'5px', }, unfrequent:true, onclick:function(item){ game.saveConfig('custom_button_control_top',item); lib.configMenu.appearence.config.custom_button.onclick('skip'); } }, custom_button_control_bottom:{ name:'技能下部高度', init:'0x', item:{ '-5x':'-5px', '-4x':'-4px', '-3x':'-3px', '-2x':'-2px', '-1x':'-1px', '0x':'默认', '1x':'1px', '2x':'2px', '3x':'3px', '4x':'4px', '5x':'5px', }, unfrequent:true, onclick:function(item){ game.saveConfig('custom_button_control_bottom',item); lib.configMenu.appearence.config.custom_button.onclick('skip'); } }, radius_size:{ name:'圆角大小', init:'default', item:{ off:'关闭', reduce:'减小', default:'默认', increase:'增大', }, unfrequent:true, onclick:function(item){ game.saveConfig('radius_size',item); ui.window.dataset.radius_size=item; } }, glow_phase:{ name:'当前回合角色高亮', unfrequent:true, init:'yellow', intro:'设置当前回合角色的边框颜色', item:{ none:'无', yellow:'黄色', green:'绿色', purple:'紫色', }, onclick:function(bool){ game.saveConfig('glow_phase',bool); lib.init.cssstyles(); } }, fold_card:{ name:'折叠手牌', init:true, unfrequent:true, }, fold_mode:{ name:'折叠模式菜单', intro:'关闭后模式菜单中“更多”内的项目将直接展开', init:true, unfrequent:true, }, seperate_control:{ name:'分离选项条', init:true, unfrequent:true, intro:'开启后玩家在进行选择时不同的选项将分开,而不是连在一起', }, blur_ui:{ name:'模糊效果', intro:'在暂停或打开菜单时开启模糊效果', init:false, unfrequent:true, onclick:function(bool){ game.saveConfig('blur_ui',bool); if(bool){ ui.window.classList.add('blur_ui'); } else{ ui.window.classList.remove('blur_ui'); } } }, glass_ui:{ name:'玻璃主题', intro:'为游戏主题打开玻璃效果(手机暂不支持)', init:false, unfrequent:true, onclick:function(bool){ game.saveConfig('glass_ui',bool); if(bool){ ui.window.classList.add('glass_ui'); } else{ ui.window.classList.remove('glass_ui'); } } }, damage_shake:{ name:'伤害抖动', intro:'角色受到伤害时的抖动效果', init:true, unfrequent:true, }, button_press:{ name:'按钮效果', intro:'选项条被按下时将有按下效果', init:true, unfrequent:true, }, jiu_effect:{ name:'喝酒效果', init:true, unfrequent:true, }, animation:{ name:'游戏特效', intro:'开启后出现属性伤害、回复体力等情况时会显示动画', init:false, unfrequent:true, }, skill_animation_type:{ name:'技能特效', intro:'开启后觉醒技、限定技将显示全屏文字', init:'default', unfrequent:true, item:{ default:'默认', old:'旧版', off:'关闭' } }, die_move:{ name:'阵亡效果', intro:'阵亡后武将的显示效果', init:'flip', unfrequent:true, item:{ off:'关闭', move:'移动', flip:'翻面', } }, target_shake:{ name:'目标效果', intro:'一名玩家成为卡牌或技能的目标时的显示效果', init:'off', item:{ off:'关闭', zoom:'缩放', shake:'抖动', }, unfrequent:true, onclick:function(bool){ game.saveConfig('target_shake',bool); ui.arena.dataset.target_shake=bool; } }, turned_style:{ name:'翻面文字', intro:'角色被翻面时显示“翻面”', init:true, unfrequent:true, onclick:function(bool){ game.saveConfig('turned_style',bool); if(bool){ ui.arena.classList.remove('hide_turned'); } else{ ui.arena.classList.add('hide_turned'); } } }, link_style2:{ name:'横置样式', intro:'设置角色被横置时的样式', init:'chain', unfrequent:true, item:{ chain:'铁索', rotate:'横置', mark:'标记' }, onclick:function(style){ var list=[]; for(var i=0;i'+ ''+ '', clear:true, }, background_audio:{ name:'游戏音效', init:true, }, background_speak:{ name:'人物配音', init:true, }, equip_audio:{ name:'装备配音', init:false, }, repeat_audio:{ name:'播放重复语音', init:false, }, volumn_audio:{ name:'音效音量', init:8, item:{ '0':'〇', '1':'一', '2':'二', '3':'三', '4':'四', '5':'五', '6':'六', '7':'七', '8':'八', }, onclick:function(volume){ game.saveConfig('volumn_audio',parseInt(volume)); } }, volumn_background:{ name:'音乐音量', init:8, item:{ '0':'〇', '1':'一', '2':'二', '3':'三', '4':'四', '5':'五', '6':'六', '7':'七', '8':'八', }, onclick:function(volume){ game.saveConfig('volumn_background',parseInt(volume)); ui.backgroundMusic.volume=volume/8; } }, clear_background_music:{ name:'清除自定义背景音乐', clear:true, onclick:function(){ if(confirm('是否清除已导入的所有自定义背景音乐?(该操作不可撤销!)')){ for(var i in lib.config.customBackgroundMusic){ lib.config.all.background_music.remove(i); if(i.indexOf('cdv_')==0){ game.removeFile('audio/background/'+i+'.mp3'); } else{ game.deleteDB('audio',i); } } lib.config.customBackgroundMusic=null; game.saveConfig('customBackgroundMusic',null); game.saveConfig('background_music','music_off'); if(!_status._aozhan) game.playBackgroundMusic(); } }, }, } }, skill:{ name:'技能', config:{ update:function(config,map){ for(var i in map){ if(map[i]._link.config.type=='autoskill'){ if(!lib.config.autoskilllist.contains(i)){ map[i].classList.add('on'); } else{ map[i].classList.remove('on'); } } else if(map[i]._link.config.type=='banskill'){ if(!lib.config.forbidlist.contains(i)){ map[i].classList.add('on'); } else{ map[i].classList.remove('on'); } } } } } }, others:{ name:'其它', config:{ // reset_database:{ // name:'重置游戏', // onclick:function(){ // var node=this; // if(node._clearing){ // if(indexedDB) indexedDB.deleteDatabase(lib.configprefix+'data'); // game.reload(); // return; // } // node._clearing=true; // node.innerHTML='单击以确认 (3)'; // setTimeout(function(){ // node.innerHTML='单击以确认 (2)'; // setTimeout(function(){ // node.innerHTML='单击以确认 (1)'; // setTimeout(function(){ // node.innerHTML='重置游戏录像'; // delete node._clearing; // },1000); // },1000); // },1000); // }, // clear:true // }, reset_game:{ name:'重置游戏设置', onclick:function(){ var node=this; if(node._clearing){ var noname_inited=localStorage.getItem('noname_inited'); var onlineKey=localStorage.getItem(lib.configprefix+'key'); localStorage.clear(); if(noname_inited){ localStorage.setItem('noname_inited',noname_inited); } if(onlineKey){ localStorage.setItem(lib.configprefix+'key',onlineKey); } game.deleteDB('config'); game.deleteDB('data'); game.reload(); return; } node._clearing=true; node.firstChild.innerHTML='单击以确认 (3)'; setTimeout(function(){ node.firstChild.innerHTML='单击以确认 (2)'; setTimeout(function(){ node.firstChild.innerHTML='单击以确认 (1)'; setTimeout(function(){ node.firstChild.innerHTML='重置游戏设置'; delete node._clearing; },1000); },1000); },1000); }, clear:true }, reset_hiddenpack:{ name:'重置隐藏内容', onclick:function(){ if(this.firstChild.innerHTML!='已重置'){ this.firstChild.innerHTML='已重置' game.saveConfig('hiddenModePack',[]); game.saveConfig('hiddenCharacterPack',[]); game.saveConfig('hiddenCardPack',[]); game.saveConfig('hiddenPlayPack',[]); game.saveConfig('hiddenBackgroundPack',[]); var that=this; setTimeout(function(){ that.firstChild.innerHTML='重置隐藏内容'; setTimeout(function(){ if(confirm('是否重新启动使改变生效?')){ game.reload(); } }); },500); } }, clear:true }, reset_tutorial:{ name:'重置新手向导', onclick:function(){ if(this.firstChild.innerHTML!='已重置'){ this.firstChild.innerHTML='已重置' game.saveConfig('new_tutorial',false); game.saveConfig('prompt_hidebg'); game.saveConfig('prompt_hidepack'); var that=this; setTimeout(function(){ that.firstChild.innerHTML='重置新手向导'; },500); } }, clear:true }, import_data:{ name:'导入游戏设置', onclick:function(){ ui.import_data_button.classList.toggle('hidden'); }, clear:true }, import_data_button:{ name:'
'+ ''+ '
', clear:true, }, export_data:{ name:'导出游戏设置', onclick:function(){ var data; var export_data=function(data){ game.export(lib.init.encode(JSON.stringify(data)),'无名杀 - 数据 - '+(new Date()).toLocaleString()); } if(!lib.db){ data={}; for(var i in localStorage){ if(i.indexOf(lib.configprefix)==0){ data[i]=localStorage[i]; } } export_data(data); } else{ game.getDB('config',null,function(data1){ game.getDB('data',null,function(data2){ export_data({ config:data1, data:data2 }); }); }); } }, clear:true }, redownload_game:{ name:'重新下载游戏', onclick:function(){ var node=this; if(node._clearing){ localStorage.removeItem('noname_inited'); game.reload(); return; } node._clearing=true; node.firstChild.innerHTML='单击以确认 (3)'; setTimeout(function(){ node.firstChild.innerHTML='单击以确认 (2)'; setTimeout(function(){ node.firstChild.innerHTML='单击以确认 (1)'; setTimeout(function(){ node.firstChild.innerHTML='重新下载游戏'; delete node._clearing; },1000); },1000); },1000); }, clear:true }, update:function(config,map){ if(lib.device||lib.node){ map.redownload_game.show(); } else{ map.redownload_game.hide(); } } // trim_game:{ // name:'隐藏非官方扩展包', // onclick:function(){ // if(this.innerHTML!='已隐藏'){ // this.innerHTML='已隐藏'; // var pack=lib.config.all.cards.slice(0); // if(Array.isArray(lib.config.hiddenCardPack)){ // for(var i=0;igame.players.length*num&&game.showIdentity){ _status.identityShown=true; game.showIdentity(false); } }, intro:'游戏进行若干轮将自动显示所有角色的身份', }, auto_mark_identity:{ name:'自动标记身份', init:true, intro:'根据角色的出牌行为自动标记可能的身份', }, // ban_weak:{ // name:'屏蔽弱将', // init:true, // restart:true, // }, // ban_strong:{ // name:'屏蔽强将', // init:false, // restart:true, // }, enhance_zhu:{ name:'加强主公', init:false, restart:true, intro:'为主公增加一个额外技能' }, free_choose:{ name:'自由选将', init:true, onclick:function(bool){ game.saveConfig('free_choose',bool,this._link.config.mode); if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat2&&get.config('free_choose')) ui.create.cheat2(); else if(ui.cheat2&&!get.config('free_choose')){ ui.cheat2.close(); delete ui.cheat2; } } }, change_identity:{ name:'自由选择身份和座位', init:true, onclick:function(bool){ game.saveConfig('change_identity',bool,this._link.config.mode); if(get.mode()!='identity'||!_status.event.getParent().showConfig&&!_status.event.showConfig) return; var dialog; if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup; else dialog=_status.event.dialog; if(!_status.brawl||!_status.brawl.noAddSetting){ if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog); else _status.event.getParent().removeSetting(dialog); } ui.update(); } }, change_choice:{ name:'开启换将卡', init:true, onclick:function(bool){ game.saveConfig('change_choice',bool,this._link.config.mode); if(get.mode()!='identity'||!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat&&get.config('change_choice')) ui.create.cheat(); else if(ui.cheat&&!get.config('change_choice')){ ui.cheat.close(); delete ui.cheat; } } }, change_card:{ name:'开启手气卡', init:'disabled', item:{ disabled:'禁用', once:'一次', twice:'两次', unlimited:'无限', }, }, continue_game:{ name:'显示再战', init:false, onclick:function(bool){ game.saveConfig('continue_game',bool,this._link.config.mode); if(get.config('continue_game')&&get.mode()=='identity'){ if(!ui.continue_game&&_status.over&&!_status.brawl&&!game.no_continue_game){ ui.continue_game=ui.create.control('再战',game.reloadCurrent); } } else if(ui.continue_game){ ui.continue_game.close(); delete ui.continue_game; } }, intro:'游戏结束后可选择用相同的武将再进行一局游戏' }, dierestart:{ name:'死亡后显示重来', init:true, onclick:function(bool){ game.saveConfig('dierestart',bool,this._link.config.mode); if(get.config('dierestart')&&get.mode()=='identity'){ if(!ui.restart&&game.me.isDead()&&!_status.connectMode){ ui.restart=ui.create.control('restart',game.reload); } } else if(ui.restart){ ui.restart.close(); delete ui.restart; } } }, revive:{ name:'死亡后显示复活', init:false, onclick:function(bool){ game.saveConfig('revive',bool,this._link.config.mode); if(get.config('revive')&&get.mode()=='identity'){ if(!ui.revive&&game.me.isDead()){ ui.revive=ui.create.control('revive',ui.click.dierevive); } } else if(ui.revive){ ui.revive.close(); delete ui.revive; } } }, ban_identity:{ name:'屏蔽身份', init:'off', item:{ off:'关闭', zhu:'主公', zhong:'忠臣', nei:'内奸', fan:'反贼', }, }, ban_identity2:{ name:'屏蔽身份2', init:'off', item:{ off:'关闭', zhu:'主公', zhong:'忠臣', nei:'内奸', fan:'反贼', }, }, ban_identity3:{ name:'屏蔽身份3', init:'off', item:{ off:'关闭', zhu:'主公', zhong:'忠臣', nei:'内奸', fan:'反贼', }, }, ai_strategy:{ name:'内奸策略', init:'ai_strategy_1', item:{ ai_strategy_1:'均衡', ai_strategy_2:'偏反', ai_strategy_3:'偏忠', ai_strategy_4:'酱油', ai_strategy_5:'天使', ai_strategy_6:'仇主', }, intro:'设置内奸对主忠反的态度' }, difficulty:{ name:'AI对人类态度', init:'normal', item:{ easy:'友好', normal:'一般', hard:'仇视', }, }, choice_zhu:{ name:'主公候选武将数', init:'3', restart:true, item:{ '3':'三', '4':'四', '5':'五', '6':'六', '8':'八', '10':'十', }, }, limit_zhu:{ name:'常备主候选武将数', init:'group', restart:true, item:{ off:'不限制', group:'按势力筛选', '4':'四', '6':'六', '8':'八', }, }, choice_zhong:{ name:'忠臣候选武将数', init:'4', restart:true, item:{ '3':'三', '4':'四', '5':'五', '6':'六', '8':'八', '10':'十', }, }, choice_nei:{ name:'内奸候选武将数', init:'5', restart:true, item:{ '3':'三', '4':'四', '5':'五', '6':'六', '8':'八', '10':'十', }, }, choice_fan:{ name:'反贼候选武将数', init:'3', restart:true, item:{ '3':'三', '4':'四', '5':'五', '6':'六', '8':'八', '10':'十', }, }, } }, guozhan:{ name:'国战', connect:{ connect_guozhan_mode:{ name:'游戏模式', init:'normal', item:{ normal:'势备', yingbian:'应变', old:'怀旧', }, frequent:true, restart:true, intro:'
  • 势备:默认模式,使用线下《君临天下·势备篇》的牌堆进行游戏。
  • 应变:使用OL的应变国战牌堆进行游戏。
  • 怀旧:使用传统国战的牌堆进行游戏。', }, connect_player_number:{ name:'游戏人数', init:'8', item:{ '3':'三人', '4':'四人', '5':'五人', '6':'六人', '7':'七人', '8':'八人' }, frequent:true, restart:true, }, connect_initshow_draw:{ name:'首亮奖励', item:{ 'off':'关闭', 'draw':'摸牌', 'mark':'标记', }, init:'mark', frequent:true, intro:'第一个明置武将牌的角色可获得首亮奖励' }, connect_aozhan:{ name:'鏖战模式', init:true, intro:'若开启此选项,则将在游戏中引入“鏖战模式”的规则:
    当游戏中仅剩四名或更少角色时(七人以下游戏时改为三名或更少),若此时全场没有超过一名势力相同的角色,则从一个新的回合开始,游戏进入鏖战模式直至游戏结束。
    ◇在鏖战模式下,【桃】只能当做【杀】或【闪】使用或打出,不能用来回复体力。
    注:进入鏖战模式后,即使之后有两名或者更多势力相同的角色出现,仍然不会取消鏖战模式。', frequent:true, restart:true, }, connect_viewnext:{ name:'观看下家副将', init:false, intro:'若开启此选项,所有的玩家将在挑选武将后,分发起始手牌之前,分别观看自己下家的副将。', }, connect_zhulian:{ name:'珠联璧合', init:true, // frequent:true, intro:'主将和副将都明置后,若为特定组合,可获得【珠联璧合】标记' }, connect_junzhu:{ name:'替换君主', init:true, // frequent:true, restart:true, intro:'若开启此选项,玩家的第一个回合开始时,若其主武将牌有对应的君主武将牌,则其可以将此武将牌替换为对应的君主武将牌,然后重新调整体力上限。若玩家的体力上限因此增大,则玩家回复等量的体力。' }, connect_change_card:{ name:'启用手气卡', init:false, frequent:true, restart:true, }, // connect_ban_weak:{ // name:'屏蔽弱将', // init:false, // restart:true, // }, // connect_ban_strong:{ // name:'屏蔽强将', // init:false, // restart:true, // }, }, config:{ update:function(config,map){ if(config.onlyguozhan){ map.junzhu.show(); } else{ map.junzhu.hide(); } }, guozhan_mode:{ name:'游戏模式', init:'normal', item:{ normal:'势备', yingbian:'应变', old:'怀旧', free:'自由', }, frequent:true, restart:true, intro:'
  • 势备:默认模式,使用线下《君临天下·势备篇》的牌堆进行游戏。
  • 应变:使用OL的应变国战牌堆进行游戏。
  • 怀旧:使用传统国战的牌堆进行游戏。
  • 自由:使用玩家的自定义牌堆进行游戏。', }, player_number:{ name:'游戏人数', init:'8', item:{ '3':'三人', '4':'四人', '5':'五人', '6':'六人', '7':'七人', '8':'八人' }, frequent:true, restart:true, }, initshow_draw:{ name:'首亮奖励', item:{ 'off':'关闭', 'draw':'摸牌', 'mark':'标记', }, init:'mark', frequent:true, intro:'第一个明置身份牌的角色可获得摸牌奖励' }, aozhan:{ name:'鏖战模式', init:true, frequent:true, restart:true, intro:'若开启此选项,则将在游戏中引入“鏖战模式”的规则:
    当游戏中仅剩四名或更少角色时(七人以下游戏时改为三名或更少),若此时全场没有超过一名势力相同的角色,则从一个新的回合开始,游戏进入鏖战模式直至游戏结束。
    ◇在鏖战模式下,【桃】只能当做【杀】或【闪】使用或打出,不能用来回复体力。
    注:进入鏖战模式后,即使之后有两名或者更多势力相同的角色出现,仍然不会取消鏖战模式。', }, viewnext:{ name:'观看下家副将', init:false, intro:'若开启此选项,所有的玩家将在挑选武将后,分发起始手牌之前,分别观看自己下家的副将。', }, aozhan_bgm:{ name:'鏖战背景音乐', item:{ disabled:'不启用', online:'Online', rewrite:'Rewrite', chaoming:'潮鸣', random:'随机播放', }, init:'rewrite', onclick:function(item){ game.saveConfig('aozhan_bgm',item,this._link.config.mode); if(_status._aozhan==true) game.playBackgroundMusic(); }, }, zhulian:{ name:'珠联璧合', init:true, // frequent:true, intro:'主将和副将都明置后,若为特定组合,可获得【珠联璧合】标记' }, changeViceType:{ name:'副将变更方式', init:'default', item:{ default:'发现式', online:'随机式', }, frequent:true, restart:true, }, onlyguozhan:{ name:'使用国战武将', init:true, frequent:true, restart:true, intro:'开启武将技能将替换为国战版本并禁用非国战武将' }, guozhanSkin:{ name:'使用国战皮肤', init:true, frequent:true, restart:true, intro:'开启此选项后,将会把有国战专属皮肤的武将替换为国战皮肤' }, junzhu:{ name:'替换君主', init:true, // frequent:true, restart:true, intro:'若开启此选项,玩家的第一个回合开始时,若其主武将牌有对应的君主武将牌,则其可以将此武将牌替换为对应的君主武将牌,然后重新调整体力上限。若玩家的体力上限因此增大,则玩家回复等量的体力。' }, double_hp:{ name:'双将体力上限', init:'pingjun', item:{ hejiansan:'和减三', pingjun:'平均值', zuidazhi:'最大值', zuixiaozhi:'最小值', zonghe:'相加', }, restart:true, }, // ban_weak:{ // name:'屏蔽弱将', // init:true, // restart:true, // }, // ban_strong:{ // name:'屏蔽强将', // init:false, // restart:true, // }, free_choose:{ name:'自由选将', init:true, onclick:function(bool){ game.saveConfig('free_choose',bool,this._link.config.mode); if(get.mode()!='guozhan'||!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat2&&get.config('free_choose')) ui.create.cheat2(); else if(ui.cheat2&&!get.config('free_choose')){ ui.cheat2.close(); delete ui.cheat2; } } }, onlyguozhanexpand:{ name:'默认展开自由选将', init:false, restart:true, intro:'开启后自由选将对话框将默认显示全部武将' }, change_identity:{ name:'自由选择座位', init:true, onclick:function(bool){ game.saveConfig('change_identity',bool,this._link.config.mode); if(get.mode()!='guozhan'||!_status.event.getParent().showConfig&&!_status.event.showConfig) return; var dialog; if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup; else dialog=_status.event.dialog; if(!_status.brawl||!_status.brawl.noAddSetting){ if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog); else _status.event.getParent().removeSetting(dialog); } ui.update(); } }, change_choice:{ name:'开启换将卡', init:true, onclick:function(bool){ game.saveConfig('change_choice',bool,this._link.config.mode); if(get.mode()!='guozhan'||!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat&&get.config('change_choice')) ui.create.cheat(); else if(ui.cheat&&!get.config('change_choice')){ ui.cheat.close(); delete ui.cheat; } } }, change_card:{ name:'开启手气卡', init:'disabled', item:{ disabled:'禁用', once:'一次', twice:'两次', unlimited:'无限', } }, continue_game:{ name:'显示再战', init:true, intro:'游戏结束后可选择用相同的武将再进行一局游戏', onclick:function(bool){ game.saveConfig('continue_game',bool,this._link.config.mode); if(get.config('continue_game')&&get.mode()=='guozhan'){ if(!ui.continue_game&&_status.over&&!_status.brawl&&!game.no_continue_game){ ui.continue_game=ui.create.control('再战',game.reloadCurrent); } } else if(ui.continue_game){ ui.continue_game.close(); delete ui.continue_game; } } }, dierestart:{ name:'死亡后显示重来', init:true, onclick:function(bool){ game.saveConfig('dierestart',bool,this._link.config.mode); if(get.config('dierestart')&&get.mode()=='guozhan'){ if(!ui.restart&&game.me.isDead()&&!_status.connectMode){ ui.restart=ui.create.control('restart',game.reload); } } else if(ui.restart){ ui.restart.close(); delete ui.restart; } } }, revive:{ name:'死亡后显示复活', init:false, onclick:function(bool){ game.saveConfig('revive',bool,this._link.config.mode); if(get.config('revive')&&get.mode()=='guozhan'){ if(!ui.revive&&game.me.isDead()){ ui.revive=ui.create.control('revive',ui.click.dierevive); } } else if(ui.revive){ ui.revive.close(); delete ui.revive; } } }, difficulty:{ name:'AI对人类态度', init:'normal', item:{ easy:'友好', normal:'一般', hard:'仇视', } }, choice_num:{ name:'候选武将数', init:'7', restart:true, item:{ '5':'五', '6':'六', '7':'七', '8':'八', '9':'九', '10':'十', } }, } }, versus:{ name:'对决', connect:{ update:function(config,map){ if(config.connect_versus_mode=='1v1'){ map.connect_choice_num.show(); map.connect_replace_number.show(); } else{ map.connect_choice_num.hide(); map.connect_replace_number.hide(); } if(config.connect_versus_mode=='2v2'||config.connect_versus_mode=='3v3'){ map.connect_replace_handcard.show(); } else{ map.connect_replace_handcard.hide(); } }, connect_versus_mode:{ name:'游戏模式', init:'1v1', item:{ '1v1':'1v1', '2v2':'2v2', '3v3':'3v3', '4v4':'4v4', 'guandu':'官渡', }, frequent:true }, connect_replace_handcard:{ name:'四号位保护', init:true, frequent:true, intro:'最后行动的角色起始手牌数+1' }, connect_choice_num:{ name:'侯选武将数', init:'20', frequent:true, item:{ '12':'12人', '16':'16人', '20':'20人', '24':'24人', '40':'40人', } }, connect_replace_number:{ name:'替补人数', init:'2', frequent:true, item:{ '0':'无', '1':'1人', '2':'2人', '3':'3人', '4':'4人', '5':'5人', } }, // connect_ban_weak:{ // name:'屏蔽弱将', // init:true, // restart:true, // }, // connect_ban_strong:{ // name:'屏蔽强将', // init:false, // restart:true, // }, }, config:{ update:function(config,map){ if(config.versus_mode=='four'){ map.change_choice.hide(); map.ladder.show(); if(config.ladder){ map.ladder_monthly.show(); map.ladder_reset.show(); } else{ map.ladder_monthly.hide(); map.ladder_reset.hide(); } map.enable_all.show(); map.enable_all_cards_four.show(); map.four_assign.show(); map.four_phaseswap.show(); map.expand_dialog.show(); map.fouralign.show(); } else{ map.change_choice.show(); map.ladder.hide(); map.ladder_monthly.hide(); map.ladder_reset.hide(); map.enable_all.hide(); map.enable_all_cards_four.hide(); map.four_assign.hide(); map.four_phaseswap.hide(); map.expand_dialog.hide(); map.fouralign.hide(); } if(config.versus_mode=='three'){ map.edit_character_three.show(); } else{ map.edit_character_three.hide(); } if(config.versus_mode=='three'||config.versus_mode=='one'){ map.enable_all_three.show(); map.enable_all_cards.show(); } else{ map.enable_all_three.hide(); map.enable_all_cards.hide(); } if(config.versus_mode=='jiange'||config.versus_mode=='two'||config.versus_mode=='endless'|| config.versus_mode=='three'||config.versus_mode=='one'||config.versus_mode=='siguo'){ map.free_choose.show(); } else{ map.free_choose.hide(); } if(config.versus_mode=='jiange'){ map.double_character_jiange.show(); } else{ map.double_character_jiange.hide(); } if(config.versus_mode=='two'){ map.replace_handcard_two.show(); map.replace_character_two.show(); map.two_assign.show(); map.two_phaseswap.show(); } else{ map.replace_handcard_two.hide(); map.replace_character_two.hide(); map.two_assign.hide(); map.two_phaseswap.hide(); } if(config.versus_mode=='two'||config.versus_mode=='siguo'||config.versus_mode=='four'){ if(config.versus_mode=='four'&&(config.four_assign||config.four_phaseswap)){ map.change_identity.hide(); } else{ map.change_identity.show(); } } else{ map.change_identity.hide(); } if(config.versus_mode=='siguo'){ map.siguo_character.show(); } else{ map.siguo_character.hide(); } }, versus_mode:{ name:'游戏模式', init:'four', item:{ four:'对抗', three:'统率', two:'欢乐', guandu:'官渡', jiange:'剑阁', siguo:'四国', standard:'自由' // endless:'无尽', // triple:'血战', // one:'1v1', }, restart:true, frequent:true, }, ladder:{ name:'天梯模式', init:true, frequent:true, restart:true }, ladder_monthly:{ name:'每月重置天梯', init:true, frequent:true, }, enable_all:{ name:'启用全部武将', init:false, frequent:true, restart:true, }, enable_all_cards_four:{ name:'启用全部卡牌', init:false, frequent:true, restart:true, }, enable_all_three:{ name:'启用全部武将', init:false, frequent:true, restart:true, }, enable_all_cards:{ name:'启用全部卡牌', init:false, frequent:true, restart:true, }, four_assign:{ name:'代替队友选将', init:false, restart:true, }, four_phaseswap:{ name:'代替队友行动', init:false, restart:true, }, two_assign:{ name:'代替队友选将', init:false, restart:true, }, two_phaseswap:{ name:'代替队友行动', init:false, restart:true, }, free_choose:{ name:'自由选将', init:true, frequent:true, onclick:function(bool){ game.saveConfig('free_choose',bool,this._link.config.mode); if(!ui.create.cheat2) return; if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat2&&get.config('free_choose')) ui.create.cheat2(); else if(ui.cheat2&&!get.config('free_choose')){ ui.cheat2.close(); delete ui.cheat2; } } }, fouralign:{ name:'自由选择阵型', init:false }, change_identity:{ name:'自由选择座位', init:true, onclick:function(bool){ game.saveConfig('change_identity',bool,this._link.config.mode); if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(_status.mode=='four'){ if(get.config('four_assign')||get.config('four_phaseswap')) return; if(bool){ if(_status.event.parent.addSetting){ _status.event.parent.addSetting(); } } else{ var seats=_status.event.parent.seatsbutton; if(seats){ while(seats.length){ seats.shift().remove(); } delete _status.event.parent.seatsbutton; } } } else{ var dialog; if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup; else dialog=_status.event.dialog; if(!_status.brawl||!_status.brawl.noAddSetting){ if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog); else _status.event.getParent().removeSetting(dialog); } ui.update(); } } }, change_choice:{ name:'开启换将卡', init:true, onclick:function(bool){ game.saveConfig('change_choice',bool,this._link.config.mode); if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat&&get.config('change_choice')) ui.create.cheat(); else if(ui.cheat&&!get.config('change_choice')){ ui.cheat.close(); delete ui.cheat; } }, frequent:true, }, double_character_jiange:{ name:'双将模式', init:false, frequent:true, }, replace_handcard_two:{ name:'四号位保护', init:true, frequent:true, intro:'最后行动的角色起始手牌+1' }, replace_character_two:{ name:'替补模式', init:false, frequent:true, intro:'每个额外选择一名武将,死亡后用该武将代替重新上场,替补武将用完时失败' }, expand_dialog:{ name:'默认展开选将框', intro:'选将框打开时直接显示全部武将(可能使游戏在开始时卡顿)', init:false, }, siguo_character:{ name:'专属武将出场率', init:'increase', item:{ increase:'大概率', normal:'默认概率', off:'不出现', }, frequent:true }, // ban_weak:{ // name:'屏蔽弱将', // init:true, // restart:true, // }, // ban_strong:{ // name:'屏蔽强将', // init:false, // restart:true // }, ladder_reset:{ name:'重置天梯数据', onclick:function(){ var node=this; if(node._clearing){ game.save('ladder',{ current:900, top:900, month:(new Date()).getMonth() }); ui.ladder.innerHTML='卫士五'; clearTimeout(node._clearing); node.firstChild.innerHTML='重置天梯数据'; delete node._clearing; return; } node.firstChild.innerHTML='单击以确认 (3)'; node._clearing=setTimeout(function(){ node.firstChild.innerHTML='单击以确认 (2)'; node._clearing=setTimeout(function(){ node.firstChild.innerHTML='单击以确认 (1)'; node._clearing=setTimeout(function(){ node.firstChild.innerHTML='重置天梯数据'; delete node._clearing; },1000); },1000); },1000); }, clear:true, }, edit_character_three:{ name:'编辑统率将池', clear:true, onclick:function(){ if(get.mode()!='versus'){ alert('请进入对决模式,然后再编辑将池'); return; } var container=ui.create.div('.popup-container.editor'); var editorpage=ui.create.div(container); var discardConfig=ui.create.div('.editbutton','取消',editorpage,function(){ ui.window.classList.remove('shortcutpaused'); ui.window.classList.remove('systempaused'); container.delete(null); delete window.saveNonameInput; }); var node=container; var map=get.config('character_three')||lib.choiceThree; var str='character=[\n '; for(var i=0;i请不要轻易勾选此项!', }, } }, boss:{ name:'挑战', config:{ free_choose:{ name:'自由选将', init:true, frequent:true, onclick:function(bool){ game.saveConfig('free_choose',bool,this._link.config.mode); if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat2&&get.config('free_choose')) ui.create.cheat2(); else if(ui.cheat2&&!get.config('free_choose')){ ui.cheat2.close(); delete ui.cheat2; } } }, change_choice:{ name:'开启换将卡', init:true, onclick:function(bool){ game.saveConfig('change_choice',bool,this._link.config.mode); if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat&&get.config('change_choice')) ui.create.cheat(); else if(ui.cheat&&!get.config('change_choice')){ ui.cheat.close(); delete ui.cheat; } }, frequent:true, }, single_control:{ name:'单人控制', init:true, frequent:true, onclick:function(bool){ game.saveConfig('single_control',bool,this._link.config.mode); if(ui.single_swap&&game.me!=game.boss){ if(bool){ ui.single_swap.style.display='none'; } else{ ui.single_swap.style.display=''; } } }, intro:'只控制一名角色,其他角色由AI控制' }, // ban_weak:{ // name:'屏蔽弱将', // init:true, // restart:true, // }, // ban_strong:{ // name:'屏蔽强将', // init:false, // restart:true, // }, } }, doudizhu:{ name:'斗地主', connect:{ update:function(config,map){ if(config.connect_doudizhu_mode=='online'){ map.connect_change_card.hide(); } else{ map.connect_change_card.show(); } if(config.connect_doudizhu_mode!='normal'){ map.connect_double_character.hide(); } else{ map.connect_double_character.show(); } }, connect_doudizhu_mode:{ name:'游戏模式', init:'normal', item:{ normal:'休闲', kaihei:'开黑', huanle:'欢乐', binglin:'兵临', online:'智斗', }, restart:true, frequent:true, }, connect_double_character:{ name:'双将模式', init:false, frequent:true, restart:true, }, connect_change_card:{ name:'启用手气卡', init:false, frequent:true, restart:true, }, }, config:{ update:function(config,map){ if(config.doudizhu_mode=='online'){ map.change_card.hide(); map.edit_character.show(); map.reset_character.show(); } else{ map.change_card.show(); map.edit_character.hide(); map.reset_character.hide(); } if(config.doudizhu_mode!='normal'){ map.double_character.hide(); map.free_choose.hide(); map.change_identity.hide(); map.change_choice.hide(); map.continue_game.hide(); map.dierestart.hide(); map.choice_zhu.hide(); map.choice_fan.hide(); map.revive.hide(); } else{ map.double_character.show(); map.free_choose.show(); map.change_identity.show(); map.change_choice.show(); map.continue_game.show(); map.dierestart.show(); map.choice_zhu.show(); map.choice_fan.show(); map.revive.show(); } if(config.double_character&&config.doudizhu_mode=='normal'){ map.double_hp.show(); } else{ map.double_hp.hide(); } }, doudizhu_mode:{ name:'游戏模式', init:'normal', item:{ normal:'休闲', kaihei:'开黑', huanle:'欢乐', binglin:'兵临', online:'智斗', }, restart:true, frequent:true, }, double_character:{ name:'双将模式', init:false, frequent:true, restart:true, }, double_hp:{ name:'双将体力上限', init:'pingjun', item:{ hejiansan:'和减三', pingjun:'平均值', zuidazhi:'最大值', zuixiaozhi:'最小值', zonghe:'相加', }, restart:true, }, free_choose:{ name:'自由选将', init:true, onclick:function(bool){ game.saveConfig('free_choose',bool,this._link.config.mode); if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat2&&get.config('free_choose')) ui.create.cheat2(); else if(ui.cheat2&&!get.config('free_choose')){ ui.cheat2.close(); delete ui.cheat2; } } }, change_identity:{ name:'自由选择身份和座位', init:true, onclick:function(bool){ game.saveConfig('change_identity',bool,this._link.config.mode); if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; var dialog; if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup; else dialog=_status.event.dialog; if(!_status.brawl||!_status.brawl.noAddSetting){ if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog); else _status.event.getParent().removeSetting(dialog); } ui.update(); } }, change_choice:{ name:'开启换将卡', init:true, onclick:function(bool){ game.saveConfig('change_choice',bool,this._link.config.mode); if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat&&get.config('change_choice')) ui.create.cheat(); else if(ui.cheat&&!get.config('change_choice')){ ui.cheat.close(); delete ui.cheat; } } }, change_card:{ name:'开启手气卡', init:'disabled', item:{ disabled:'禁用', once:'一次', twice:'两次', unlimited:'无限', }, }, continue_game:{ name:'显示再战', init:false, onclick:function(bool){ game.saveConfig('continue_game',bool,this._link.config.mode); if(get.config('continue_game')){ if(!ui.continue_game&&_status.over&&!_status.brawl&&!game.no_continue_game){ ui.continue_game=ui.create.control('再战',game.reloadCurrent); } } else if(ui.continue_game){ ui.continue_game.close(); delete ui.continue_game; } }, intro:'游戏结束后可选择用相同的武将再进行一局游戏' }, dierestart:{ name:'死亡后显示重来', init:true, onclick:function(bool){ game.saveConfig('dierestart',bool,this._link.config.mode); if(get.config('dierestart')){ if(!ui.restart&&game.me.isDead()&&!_status.connectMode){ ui.restart=ui.create.control('restart',game.reload); } } else if(ui.restart){ ui.restart.close(); delete ui.restart; } } }, revive:{ name:'死亡后显示复活', init:false, onclick:function(bool){ game.saveConfig('revive',bool,this._link.config.mode); if(get.config('revive')){ if(!ui.revive&&game.me.isDead()){ ui.revive=ui.create.control('revive',ui.click.dierevive); } } else if(ui.revive){ ui.revive.close(); delete ui.revive; } } }, choice_zhu:{ name:'地主候选武将数', init:'3', restart:true, item:{ '3':'三', '4':'四', '5':'五', '6':'六', '8':'八', '10':'十', }, }, choice_fan:{ name:'农民候选武将数', init:'3', restart:true, item:{ '3':'三', '4':'四', '5':'五', '6':'六', '8':'八', '10':'十', }, }, edit_character:{ name:'编辑将池', clear:true, onclick:function(){ if(get.mode()!='doudizhu'){ alert('请进入斗地主模式,然后再编辑将池'); return; } var container=ui.create.div('.popup-container.editor'); var editorpage=ui.create.div(container); var discardConfig=ui.create.div('.editbutton','取消',editorpage,function(){ ui.window.classList.remove('shortcutpaused'); ui.window.classList.remove('systempaused'); container.delete(null); delete window.saveNonameInput; }); var node=container; var map=get.config('character_online')||lib.characterOnline; node.code='character='+get.stringify(map)+'\n/*\n 这里是智斗三国模式的武将将池。\n 您可以在这里编辑对武将将池进行编辑,然后点击“保存”按钮即可保存。\n 将池中的Key势力武将,仅同时在没有被禁用的情况下,才会出现在选将框中。\n 而非Key势力的武将,只要所在的武将包没有被隐藏,即可出现在选将框中。\n 该将池为单机模式/联机模式通用将池。在这里编辑后,即使进入联机模式,也依然会生效。\n 但联机模式本身禁用的武将(如神貂蝉)不会出现在联机模式的选将框中。\n*/'; ui.window.classList.add('shortcutpaused'); ui.window.classList.add('systempaused'); var saveInput=function(){ var code; if(container.editor){ code=container.editor.getValue(); } else if(container.textarea){ code=container.textarea.value; } try{ var character=null; eval(code); if(!get.is.object(character)){ throw('err'); } var groups=[]; for(var i in character){ if(!Array.isArray(character[i])) throw('type'); if(character[i].length>=3) groups.push(i); } if(groups.length<3) throw('enough'); } catch(e){ if(e=='type'){ alert('请严格按照格式填写,不要写入不为数组的数据'); } else if(e=='enough'){ alert('请保证至少写入了3个势力,且每个势力至少有3个武将'); } else if(e=='err'){ alert('代码格式有错误,请对比示例代码仔细检查'); } else{ alert('代码语法有错误,请仔细检查('+e+')') } return; } game.saveConfig('character_online',character,'doudizhu'); ui.window.classList.remove('shortcutpaused'); ui.window.classList.remove('systempaused'); container.delete(); container.code=code; delete window.saveNonameInput; }; window.saveNonameInput=saveInput; var saveConfig=ui.create.div('.editbutton','保存',editorpage,saveInput); var editor=ui.create.div(editorpage); if(node.aced){ ui.window.appendChild(node); node.editor.setValue(node.code,1); } else if(lib.device=='ios'){ ui.window.appendChild(node); if(!node.textarea){ var textarea=document.createElement('textarea'); editor.appendChild(textarea); node.textarea=textarea; lib.setScroll(textarea); } node.textarea.value=node.code; } else{ var aceReady=function(){ ui.window.appendChild(node); var mirror = window.CodeMirror(editor, { value:node.code, mode:"javascript", lineWrapping:!lib.config.touchscreen&&lib.config.mousewheel, lineNumbers:true, indentUnit:4, autoCloseBrackets:true, theme:'mdn-like' }); lib.setScroll(editor.querySelector('.CodeMirror-scroll')); node.aced=true; node.editor=mirror; } if(!window.ace){ lib.init.js(lib.assetURL+'game','codemirror',aceReady); lib.init.css(lib.assetURL+'layout/default','codemirror'); } else{ aceReady(); } }; }, }, reset_character:{ name:'重置将池', intro:'将智斗三国模式下的将池重置为默认将池', clear:true, onclick:function(){ if(confirm('该操作不可撤销!是否清除智斗三国模式的自定义将池,并将其重置为默认将池?')){ game.saveConfig('character_online',null,'doudizhu'); alert('将池已重置'); } }, }, } }, single:{ name:'单挑', connect:{ connect_single_mode:{ name:'游戏模式', init:'normal', item:{ normal:'新1v1', dianjiang:'点将单挑', changban:'血战长坂坡', }, restart:true, frequent:true, }, connect_enable_jin:{ name:'启用晋势力武将', init:false, restart:true, frequent:true, }, update:function(config,map){ if(config.connect_single_mode!='normal'){ map.connect_enable_jin.hide(); } else{ map.connect_enable_jin.show(); } }, }, config:{ single_mode:{ name:'游戏模式', init:'normal', item:{ normal:'新1v1', dianjiang:'点将单挑', changban:'血战长坂坡', }, restart:true, frequent:true, }, enable_jin:{ name:'启用晋势力武将', init:false, restart:true, frequent:true, }, update:function(config,map){ if(config.single_mode!='normal'){ map.enable_jin.hide(); } else{ map.enable_jin.show(); } }, } }, chess:{ name:'战棋', config:{ chess_mode:{ name:'游戏模式', init:'combat', item:{ combat:'自由', three:'统率', leader:'君主', }, restart:true, frequent:true, }, update:function(config,map){ if(config.chess_mode=='leader'){ map.chess_leader_save.show(); map.chess_leader_clear.show(); map.chess_leader_allcharacter.show(); map.chess_character.hide(); } else{ map.chess_leader_save.hide(); map.chess_leader_clear.hide(); map.chess_leader_allcharacter.hide(); map.chess_character.show(); } if(config.chess_mode=='combat'){ // map.battle_number.show(); // map.chess_ordered.show(); map.free_choose.show(); map.change_choice.show(); } else{ // map.battle_number.hide(); // map.chess_ordered.hide(); map.free_choose.hide(); map.change_choice.hide(); } // if(config.chess_mode!='leader'){ // map.ban_weak.show(); // map.ban_strong.show(); // } // else{ // map.ban_weak.hide(); // map.ban_strong.hide(); // } }, chess_leader_save:{ name:'选择历程', init:'save1', item:{ save1:'一', save2:'二', save3:'三', save4:'四', save5:'五', }, restart:true, frequent:true, }, chess_leader_allcharacter:{ name:'启用全部角色', init:true, onclick:function(bool){ if(confirm('调整该设置将清除所有进度,是否继续?')){ for(var i=1;i<6;i++) game.save('save'+i,null,'chess'); game.saveConfig('chess_leader_allcharacter',bool,'chess') if(get.mode()=='chess') game.reload(); return; } else this.classList.toggle('on'); }, }, chess_leader_clear:{ name:'清除进度', onclick:function(){ var node=this; if(node._clearing){ for(var i=1;i<6;i++) game.save('save'+i,null,'chess'); game.reload(); return; } node._clearing=true; node.firstChild.innerHTML='单击以确认 (3)'; setTimeout(function(){ node.firstChild.innerHTML='单击以确认 (2)'; setTimeout(function(){ node.firstChild.innerHTML='单击以确认 (1)'; setTimeout(function(){ node.firstChild.innerHTML='清除进度'; delete node._clearing; },1000); },1000); },1000); }, clear:true, frequent:true, }, // chess_treasure:{ // name:'战场机关', // init:'0', // frequent:true, // item:{ // '0':'关闭', // '0.1':'较少出现', // '0.2':'偶尔出现', // '0.333':'时常出现', // '0.5':'频繁出现', // } // }, chess_obstacle:{ name:'随机路障', init:'0.2', item:{ '0':'关闭', '0.2':'少量', '0.333':'中量', '0.5':'大量', }, frequent:true, }, show_range:{ name:'显示卡牌范围', init:true, }, show_distance:{ name:'显示距离', init:true, }, chess_character:{ name:'战棋武将', init:true, frequent:true, }, chess_card:{ name:'战棋卡牌', init:true, frequent:true, }, free_choose:{ name:'自由选将', init:true, onclick:function(bool){ game.saveConfig('free_choose',bool,this._link.config.mode); if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat2&&get.config('free_choose')) ui.create.cheat2(); else if(ui.cheat2&&!get.config('free_choose')){ ui.cheat2.close(); delete ui.cheat2; } }, }, change_choice:{ name:'开启换将卡', init:true, onclick:function(bool){ game.saveConfig('change_choice',bool,this._link.config.mode); if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat&&get.config('change_choice')) ui.create.cheat(); else if(ui.cheat&&!get.config('change_choice')){ ui.cheat.close(); delete ui.cheat; } }, }, // ban_weak:{ // name:'屏蔽弱将', // init:true, // restart:true, // }, // ban_strong:{ // name:'屏蔽强将', // init:false, // restart:true, // }, chessscroll_speed:{ name:'边缘滚动速度', init:'20', intro:'鼠标移至屏幕边缘时自动滚屏', item:{ '0':'不滚动', '10':'10格/秒', '20':'20格/秒', '30':'30格/秒', } }, } }, tafang:{ name:'塔防', config:{ tafang_turn:{ name:'游戏胜利', init:'10', frequent:true, item:{ '10':'十回合', '20':'二十回合', '30':'三十回合', '1000':'无限', } }, // tafang_size:{ // name:'战场大小', // init:'9', // frequent:true, // item:{ // '6':'小', // '9':'中', // '12':'大', // } // }, tafang_difficulty:{ name:'战斗难度', init:'2', frequent:true, item:{ '1':'简单', '2':'普通', '3':'困难', } }, show_range:{ name:'显示卡牌范围', init:true, }, show_distance:{ name:'显示距离', init:true, }, // ban_weak:{ // name:'屏蔽弱将', // init:true, // restart:true, // }, // ban_strong:{ // name:'屏蔽强将', // init:false, // restart:true, // }, chessscroll_speed:{ name:'边缘滚动速度', intro:'鼠标移至屏幕边缘时自动滚屏', init:'20', item:{ '0':'不滚动', '10':'10格/秒', '20':'20格/秒', '30':'30格/秒', } }, } }, brawl:{ name:'乱斗', config:{ huanhuazhizhan:{ name:'幻化之战', init:true, frequent:true }, qunxionggeju:{ name:'群雄割据', init:true, frequent:true }, duzhansanguo:{ name:'毒战三国', init:true, frequent:true }, daozhiyueying:{ name:'导师月英', init:true, frequent:true }, weiwoduzun:{ name:'唯我独尊', init:true, frequent:true }, tongxingzhizheng:{ name:'同姓之争', init:true, frequent:true }, jiazuzhizheng:{ name:'家族之争', init:true, frequent:true }, tongqueduopao:{ name:'铜雀夺袍', init:true, frequent:true }, tongjiangmoshi:{ name:'同将模式', init:true, frequent:true }, baiyidujiang:{ name:'白衣渡江', init:true, frequent:true }, qianlidanji:{ name:'千里单骑', init:true, frequent:true }, liangjunduilei:{ name:'两军对垒', init:true, frequent:true }, scene:{ name:'创建场景', init:true, frequent:true } } }, stone:{ name:'炉石', config:{ // update:function(config,map){ // if(config.stone_mode=='deck'){ // // map.deck_length.show(); // // map.deck_repeat.show(); // map.random_length.hide(); // map.skill_bar.show(); // } // else{ // // map.deck_length.hide(); // // map.deck_repeat.hide(); // map.random_length.show(); // map.skill_bar.hide(); // } // }, // stone_mode:{ // name:'游戏模式', // init:'deck', // item:{ // deck:'构筑', // random:'随机' // }, // restart:true, // frequent:true, // }, // deck_length:{ // name:'卡组长度', // init:'30', // item:{ // '30':'30张', // '50':'50张', // '80':'80张', // }, // frequent:true, // }, // deck_repeat:{ // name:'重复卡牌', // init:'2', // item:{ // '2':'2张', // '3':'3张', // '5':'5张', // '80':'无限', // }, // frequent:true, // }, // random_length:{ // name:'随从牌数量', // init:'1/80', // item:{ // '1/120':'少', // '1/80':'中', // '1/50':'多', // }, // frequent:true, // }, battle_number:{ name:'出场人数', init:'1', frequent:true, item:{ '1':'一人', '2':'两人', '3':'三人', '4':'四人', '6':'六人', '8':'八人', '10':'十人', }, onclick:function(num){ game.saveConfig('battle_number',num,this._link.config.mode); if(_status.connectMode) return; if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(_status.event.getParent().changeDialog){ _status.event.getParent().changeDialog(); } }, }, mana_mode:{ name:'行动值变化', init:'inc', item:{ inf:'涨落', inc:'递增' }, frequent:true }, skill_bar:{ name:'怒气值', init:true, frequent:true, restart:true, }, double_character:{ name:'双将模式', init:false, frequent:true, restart:function(){ return _status.event.getParent().name!='chooseCharacter'||_status.event.name!='chooseButton'; } }, free_choose:{ name:'自由选将', init:true, onclick:function(bool){ game.saveConfig('free_choose',bool,this._link.config.mode); if(_status.connectMode) return; if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat2&&get.config('free_choose')) ui.create.cheat2(); else if(ui.cheat2&&!get.config('free_choose')){ ui.cheat2.close(); delete ui.cheat2; } }, }, change_choice:{ name:'开启换将卡', init:true, onclick:function(bool){ game.saveConfig('change_choice',bool,this._link.config.mode); if(_status.connectMode) return; if(!_status.event.getParent().showConfig&&!_status.event.showConfig) return; if(!ui.cheat&&get.config('change_choice')) ui.create.cheat(); else if(ui.cheat&&!get.config('change_choice')){ ui.cheat.close(); delete ui.cheat; } }, }, // ban_weak:{ // name:'屏蔽弱将', // init:true, // restart:true, // }, // ban_strong:{ // name:'屏蔽强将', // init:false, // restart:true, // }, } }, }, status:{ running:false, canvas:false, time:0, reload:0, delayed:0, frameId:0, videoId:0, globalId:0, }, help:{ '关于游戏':'
    关于无名杀
    • 无名杀官方发布地址仅有GitHub仓库!
      点击前往Github仓库
    • 无名杀基于GPLv3开源协议。
      点击查看GPLv3协议
    • 其他所有的所谓“无名杀”社群(包括但不限于绝大多数“官方”QQ群、QQ频道等)均为玩家自发组织,与无名杀官方无关!', '游戏操作':'
      • 长按/鼠标悬停/右键单击显示信息。
      • 触屏模式中,双指点击切换暂停;下划显示菜单,上划切换托管。
      • 键盘快捷键
        '+ '
        A切换托管
        W切换不询问无懈
        空格暂停
      • 编辑牌堆
        在卡牌包中修改牌堆后,将自动创建一个临时牌堆,在所有模式中共用,当保存当前牌堆后,临时牌堆被清除。每个模式可设置不同的已保存牌堆,设置的牌堆优先级大于临时牌堆。
      ', '游戏命令':'
      变量名
      • 场上角色
        game.players
      • 阵亡角色
        game.dead'+ '
      • 玩家
        game.me
      • 玩家的上/下家
        game.me.previous/next'+ '
      • 玩家的上/下家(含阵亡)
        game.me.previousSeat/
        nextSeat'+ '
      • 牌堆
        ui.cardPile
      • 弃牌堆
        ui.discardPile
      '+ '
      角色属性
      • 体力值
        player.hp'+ '
      • 体力上限
        player.maxHp
      • 身份
        player.identity
      • 手牌
        player.getCards("h")
      • 装备牌
        player.getCards("e")
      • 判定牌
        player.getCards("j")'+ '
      • 是否存活/横置/翻面
        player.isAlive()/
        isLinked()/
        isTurnedOver()
      '+ '
      角色操作
      • 受到伤害
        player.damage(source,
        num)'+ '
      • 回复体力
        player.recover(num)
      • 摸牌
        player.draw(num)
      • 获得牌
        player.gain(cards)
      • 弃牌
        player.discard(cards)'+ '
      • 使用卡牌
        player.useCard(card,
        targets)
      • 死亡
        player.die()
      • 复活
        player.revive(hp)
      '+ '
      游戏操作
      • 在命令框中输出结果
        game.print(str)
      • 清除命令框中的内容
        cls
      • 上一条/下一条输入的内容
        up/down
      • 游戏结束
        game.over(bool)'+ '
      • 角色资料
        lib.character
      • 卡牌资料
        lib.card
      ', '游戏名词':'
      • 智囊:无名杀默认为过河拆桥/无懈可击/无中生有/洞烛先机。牌堆中没有的智囊牌会被过滤。可在卡牌设置中自行增减。若没有可用的智囊,则改为随机选取的三种锦囊牌的牌名。'+ '
      • 仁库:部分武将使用的游戏外共通区域。至多包含六张牌。当有新牌注入后,若牌数超过上限,则将最早进入仁库的溢出牌置入弃牌堆。'+ '
      • 护甲:和体力类似,每点护甲可抵挡一点伤害,但不影响手牌上限。'+ '
      • 随从:通过技能获得,拥有独立的技能、手牌区和装备区(共享判定区),出场时替代主武将的位置;随从死亡时自动切换回主武将。'+ '
      • 发现:从三张随机亮出的牌中选择一张,若无特殊说明,则获得此牌。'+ '
      • 蓄能技:发动时可以增大黄色的数字。若如此做,红色数字于技能的结算过程中改为原来的两倍。'+ '
      • 施法:若技能的拥有者未拥有等待执行的同名“施法”效果,则其可以发动“施法”技能。其须选择声明一个数字X(X∈[1, 3]),在此之后的第X个回合结束时,其执行“施法”效果,且效果中的数字X视为与技能发动者声明的X相同。'+ '
      • 共同拼点:一种特殊的拼点结算。发起者与被指定的拼点目标同时亮出拼点牌,进行一次决算:其中拼点牌点数唯一最大的角色赢,其他角色均没赢;若没有点数唯一最大的拼点牌,则所有角色拼点均没赢。'+ '
      • 强令:若一名角色拥有带有“强令”的技能,则该技能的发动时机为“出牌阶段开始时”。若技能拥有者发动该技能,其须发布“强令”给一名其他角色,并在对应技能的时间节点加以判断目标角色是否成功完成该强令所要求的任务条件。成功或失败则会根据技能效果执行不同结算流程。'+ '
      • 摧坚:若一名角色拥有带有“摧坚”的技能,则该技能的发动时机为“当你使用伤害牌指定第一个目标后”。你可以对其中一个目标发动“摧坚”技能,然后执行后续效果。其中,后续效果里的X等于该目标的非charlotte技能的数量。'+ '
      • 妄行:一种特殊的选项。若一名角色拥有带有“妄行”的技能,则该技能触发时,你须选择声明一个数字X(X∈{1,2,3,4}),技能后续中的X即为你选择的数字。选择完毕后,你获得如下效果:回合结束时,你选择一项:1.弃置X张牌;2.减1点体力上限。'+ '
      • 搏击:若一名角色拥有带有“搏击”的技能,则当该搏击技能触发时,若本次技能的目标角色在你攻击范围内,且你在其攻击范围内,则你执行技能主体效果时,同时额外执行“搏击”后的额外效果。'+ '
      • 游击:若一名角色拥有带有“游击”的技能,则当该游击技能执行至“游击”处时,若本次技能的目标角色在你的攻击范围内,且你不在其攻击范围内,则你可以执行“游击”后的额外效果。'+ '' }, setIntro:function(node,func,left){ if(lib.config.touchscreen){ if(left){ node.listen(ui.click.touchintro); } else{ lib.setLongPress(node,ui.click.intro); } } else{ if(left){ node.listen(ui.click.intro); } if(lib.config.hover_all){ lib.setHover(node,ui.click.hoverplayer); } if(lib.config.right_info){ node.oncontextmenu=ui.click.rightplayer; } } // if(!left){ // lib.setPressure(node,ui.click.rightpressure); // } if(func){ node._customintro=func; } }, // setPressure:function(node,func){ // if(window.Pressure){ // window.Pressure.set(node,{change: func}, {polyfill: false}); // } // }, setPopped:function(node,func,width,height,forceclick,paused2){ node._poppedfunc=func; node._poppedwidth=width; node._poppedheight=height; if(forceclick){ node.forceclick=true; } if(lib.config.touchscreen||forceclick){ node.listen(ui.click.hoverpopped); } else{ node.addEventListener('mouseenter',ui.click.hoverpopped); // node.addEventListener('mouseleave',ui.click.hoverpopped_leave); } if(paused2){ node._paused2=true; } }, placePoppedDialog:function(dialog,e){ if(dialog._place_text){ if(dialog._place_text.firstChild.offsetWidth>=190|| dialog._place_text.firstChild.offsetHeight>=30){ dialog._place_text.style.textAlign='left'; dialog._place_text.style.marginLeft='14px'; } } if(e.touches&&e.touches[0]){ e=e.touches[0]; } var height=Math.min(ui.window.offsetHeight-20,dialog.content.scrollHeight); if(dialog._mod_height){ height+=dialog._mod_height; } dialog.style.height=height+'px'; if(e.clientX/game.documentZoomui.window.offsetHeight){ idealtop=ui.window.offsetHeight-10-dialog.offsetHeight; } dialog.style.top=idealtop+'px'; }, setHover:function(node,func,hoveration,width){ node._hoverfunc=func; if(typeof hoveration=='number'){ node._hoveration=hoveration; } if(typeof width=='number'){ node._hoverwidth=width } node.addEventListener('mouseenter',ui.click.mouseenter); node.addEventListener('mouseleave',ui.click.mouseleave); node.addEventListener('mousedown',ui.click.mousedown); node.addEventListener('mousemove',ui.click.mousemove); return node; }, setScroll:function(node){ node.ontouchstart=ui.click.touchStart; node.ontouchmove=ui.click.touchScroll; node.style.WebkitOverflowScrolling='touch'; return node; }, setMousewheel:function(node){ if(lib.config.mousewheel) node.onmousewheel=ui.click.mousewheel; }, setLongPress:function(node,func){ node.addEventListener('touchstart',ui.click.longpressdown); node.addEventListener('touchend',ui.click.longpresscancel); node._longpresscallback=func; return node; }, updateCanvas:function(time){ if(lib.canvasUpdates.length===0){ lib.status.canvas=false; return false; } ui.canvas.width=ui.arena.offsetWidth; ui.canvas.height=ui.arena.offsetHeight; var ctx=ui.ctx; ctx.shadowBlur=5; ctx.shadowColor='rgba(0,0,0,0.3)'; ctx.strokeStyle='white'; // ctx.lineCap='round'; ctx.lineWidth=3; ctx.save(); for(var i=0;i Object.keys(lib.characterPack[pack]).contains(name)); if(pack) nameinfo=lib.characterPack[pack][name]; } else if(name.indexOf('::')!=-1){ name=name.split('::'); modeimage=name[0]; name=name[1]; } } if(!modeimage&&nameinfo&&nameinfo[4]){ for(var i=0;i0) top+='+ '+position[1]+'px)'; else top+='- '+Math.abs(position[1])+'px)'; var left='calc('+position[2]+'% '; if(position[3]>0) left+='+ '+position[3]+'px)'; else left+='- '+Math.abs(position[3])+'px)'; this.style.top=top; this.style.left=left; return this; }; HTMLDivElement.prototype.css=function(style){ for(var i in style){ if(i=='innerHTML'){ this.innerHTML=style[i]; } else{ this.style[i]=style[i]; } } return this; }; HTMLTableElement.prototype.get=function(row,col){ if(rowthis.length){ num=this.length; } var arr=this.slice(0); var list=[]; for(var i=0;i>> 0; if (len === 0) { return false; } var n = fromIndex | 0; var k = Math.max(n >= 0 ? n : len - Math.abs(n), 0); function sameValueZero(x, y) { return x === y || (typeof x === 'number' && typeof y === 'number' && isNaN(x) && isNaN(y)); } while (k < len) { if (sameValueZero(o[k], searchElement)) { return true; } k++; } return false; } }); } if(!Array.from){ Object.defineProperty(Array, "from", { configurable:true, enumerable:false, writable:true, value:function(args){ var list=[]; if(args&&args.length){ for(var i=0;i.dialog.popped:not(.static)'); for(var i=0;i.framebg,#window #arena.long.mobile:not(.fewplayer) .player[data-position="0"]>.framebg{display:block;background-image:url("'+lib.assetURL+'theme/style/player/'+bstyle+'1.png")}',0); ui.css.border_stylesheet.sheet.insertRule('#window #arena.long:not(.fewplayer) .player>.framebg, #arena.oldlayout .player>.framebg{background-image:url("'+lib.assetURL+'theme/style/player/'+bstyle+'3.png")}',0); ui.css.border_stylesheet.sheet.insertRule('.player>.count{z-index: 3 !important;border-radius: 2px !important;text-align: center !important;}',0); } if(lib.config.control_style&&lib.config.control_style!='default'&&lib.config.control_style!='custom'){ var str=''; switch(lib.config.control_style){ case 'wood':str='url("'+lib.assetURL+'theme/woodden/wood.jpg")';break; case 'music':str='linear-gradient(#4b4b4b, #464646);color:white;text-shadow:black 0 0 2px';break; case 'simple':str='linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4));color:white;text-shadow:black 0 0 2px';break; } if(lib.config.control_style=='wood'){ ui.css.control_stylesheet=lib.init.sheet('#window .control,#window .menubutton,#window #system>div>div,#window #system>div>.pressdown2{background-image:'+str+'}'); } else{ ui.css.control_stylesheet=lib.init.sheet('#window .control,.menubutton:not(.active):not(.highlight):not(.red):not(.blue),#window #system>div>div{background-image:'+str+'}'); } } if(lib.config.menu_style&&lib.config.menu_style!='default'&&lib.config.menu_style!='custom'){ var str=''; switch(lib.config.menu_style){ case 'wood':str='url("'+lib.assetURL+'theme/woodden/wood2.png")';break; case 'music':str='linear-gradient(#4b4b4b, #464646);color:white;text-shadow:black 0 0 2px';break; case 'simple':str='linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4));color:white;text-shadow:black 0 0 2px';break; } ui.css.menu_stylesheet=lib.init.sheet('html #window>.dialog.popped,html .menu,html .menubg{background-image:'+str+'}'); } lib.config.duration=500; if(!lib.config.touchscreen){ document.addEventListener('mousewheel',ui.click.windowmousewheel,{passive:true}); document.addEventListener('mousemove',ui.click.windowmousemove); document.addEventListener('mousedown',ui.click.windowmousedown); document.addEventListener('mouseup',ui.click.windowmouseup); document.addEventListener('contextmenu',ui.click.right); } else{ document.addEventListener('touchstart',ui.click.touchconfirm); document.addEventListener('touchstart',ui.click.windowtouchstart); document.addEventListener('touchend',ui.click.windowtouchend); document.addEventListener('touchmove',ui.click.windowtouchmove); } }; var proceed2=function(){ if(config3){ proceed(config3); } else{ config3=true; } }; ui.css={menu:lib.init.css(lib.assetURL+'layout/default','menu',function(){ ui.css.default=lib.init.css(lib.assetURL+'layout/default','layout'); proceed2(); })}; if(lib.device){ lib.init.cordovaReady=function(){ if(lib.device=='android'){ document.addEventListener("pause", function(){ if(!_status.paused2&&(typeof _status.event.isMine=='function'&&!_status.event.isMine())){ ui.click.pause(); } if(ui.backgroundMusic){ ui.backgroundMusic.pause(); } }); document.addEventListener("resume", function(){ if(ui.backgroundMusic){ ui.backgroundMusic.play(); } }); document.addEventListener("backbutton", function(){ if(ui.arena&&ui.arena.classList.contains('menupaused')){ if(window.saveNonameInput){ window.saveNonameInput(); } else{ ui.click.configMenu(); } } else if(lib.config.confirm_exit){ navigator.notification.confirm( '是否退出游戏?', function(index){ switch(index){ case 2:game.saveConfig('null');game.reload();break; case 3:navigator.app.exitApp();break; } }, '确认退出', ['取消','重新开始','退出'] ); } else{ navigator.app.exitApp(); } }); } game.download=function(url,folder,onsuccess,onerror,dev,onprogress){ if(url.indexOf('http')!=0){ url=get.url(dev)+url; } var fileTransfer = new FileTransfer(); folder=lib.assetURL+folder; if(onprogress){ fileTransfer.onprogress=function(progressEvent){ onprogress(progressEvent.loaded,progressEvent.total); }; } lib.config.brokenFile.add(folder); game.saveConfigValue('brokenFile'); fileTransfer.download(encodeURI(url),encodeURI(folder),function(){ lib.config.brokenFile.remove(folder); game.saveConfigValue('brokenFile'); if(onsuccess){ onsuccess(); } },onerror); }; game.readFile=function(filename,callback,onerror){ window.resolveLocalFileSystemURL(lib.assetURL,function(entry){ entry.getFile(filename,{},function(fileEntry){ fileEntry.file(function(fileToLoad){ var fileReader = new FileReader(); fileReader.onload = function(e){ callback(e.target.result); }; fileReader.readAsArrayBuffer(fileToLoad, "UTF-8"); },onerror); },onerror); },onerror); }; game.readFileAsText=function(filename,callback,onerror){ window.resolveLocalFileSystemURL(lib.assetURL,function(entry){ entry.getFile(filename,{},function(fileEntry){ fileEntry.file(function(fileToLoad){ var fileReader = new FileReader(); fileReader.onload = function(e){ callback(e.target.result); }; fileReader.readAsText(fileToLoad, "UTF-8"); },onerror); },onerror); },onerror); }; game.writeFile=function(data,path,name,callback){ game.ensureDirectory(path,function(){ if(Object.prototype.toString.call(data)=='[object File]'){ var fileReader = new FileReader(); fileReader.onload = function(e){ game.writeFile(e.target.result,path,name,callback); }; fileReader.readAsArrayBuffer(data, "UTF-8"); } else{ window.resolveLocalFileSystemURL(lib.assetURL+path,function(entry){ entry.getFile(name,{create:true},function(fileEntry){ fileEntry.createWriter(function(fileWriter){ fileWriter.onwriteend=callback; fileWriter.write(data); }); }); }); } }); }; game.removeFile=function(dir,callback){ window.resolveLocalFileSystemURL(lib.assetURL,function(entry){ entry.getFile(dir,{},function(fileEntry){ fileEntry.remove(); if(callback){ callback(); } }); }); }; game.getFileList=function(dir,callback){ var files=[],folders=[]; window.resolveLocalFileSystemURL(lib.assetURL+dir,function(entry){ var dirReader=entry.createReader(); var entries=[]; var readEntries=function(){ dirReader.readEntries(function(results){ if(!results.length){ entries.sort(); for(var i=0;i 10 || Math.abs(e.touches[0].clientY/game.documentZoom - this.startY) > 10) { _status.dragged=true; } }); } if(lib.config.image_background.indexOf('custom_')==0){ ui.background.style.backgroundImage="none"; game.getDB('image',lib.config.image_background,function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent) { var data = fileLoadedEvent.target.result; ui.background.style.backgroundImage='url('+data+')'; if(lib.config.image_background_blur){ ui.background.style.filter='blur(8px)'; ui.background.style.webkitFilter='blur(8px)'; ui.background.style.transform='scale(1.05)'; } }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } if(lib.config.card_style=='custom'){ game.getDB('image','card_style',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.card_stylesheet){ ui.css.card_stylesheet.remove(); } ui.css.card_stylesheet=lib.init.sheet('.card:not(*:empty){background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } if(lib.config.cardback_style=='custom'){ game.getDB('image','cardback_style',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.cardback_stylesheet){ ui.css.cardback_stylesheet.remove(); } ui.css.cardback_stylesheet=lib.init.sheet('.card:empty,.card.infohidden{background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); game.getDB('image','cardback_style2',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.cardback_stylesheet2){ ui.css.cardback_stylesheet2.remove(); } ui.css.cardback_stylesheet2=lib.init.sheet('.card.infohidden:not(.infoflip){background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } if(lib.config.hp_style=='custom'){ game.getDB('image','hp_style1',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.hp_stylesheet1){ ui.css.hp_stylesheet1.remove(); } ui.css.hp_stylesheet1=lib.init.sheet('.hp:not(.text):not(.actcount)[data-condition="high"]>div:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); game.getDB('image','hp_style2',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.hp_stylesheet2){ ui.css.hp_stylesheet2.remove(); } ui.css.hp_stylesheet2=lib.init.sheet('.hp:not(.text):not(.actcount)[data-condition="mid"]>div:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); game.getDB('image','hp_style3',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.hp_stylesheet3){ ui.css.hp_stylesheet3.remove(); } ui.css.hp_stylesheet3=lib.init.sheet('.hp:not(.text):not(.actcount)[data-condition="low"]>div:not(.lost){background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); game.getDB('image','hp_style4',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.hp_stylesheet4){ ui.css.hp_stylesheet4.remove(); } ui.css.hp_stylesheet4=lib.init.sheet('.hp:not(.text):not(.actcount)>.lost{background-image:url('+fileLoadedEvent.target.result+')}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } if(lib.config.player_style=='custom'){ ui.css.player_stylesheet=lib.init.sheet('#window .player{background-image:none;background-size:100% 100%;}'); game.getDB('image','player_style',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.player_stylesheet){ ui.css.player_stylesheet.remove(); } ui.css.player_stylesheet=lib.init.sheet('#window .player{background-image:url("'+fileLoadedEvent.target.result+'");background-size:100% 100%;}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } if(lib.config.border_style=='custom'){ game.getDB('image','border_style',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.border_stylesheet){ ui.css.border_stylesheet.remove(); } ui.css.border_stylesheet=lib.init.sheet(); ui.css.border_stylesheet.sheet.insertRule('#window .player>.framebg{display:block;background-image:url("'+fileLoadedEvent.target.result+'")}',0); ui.css.border_stylesheet.sheet.insertRule('.player>.count{z-index: 3 !important;border-radius: 2px !important;text-align: center !important;}',0); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } if(lib.config.control_style=='custom'){ game.getDB('image','control_style',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.control_stylesheet){ ui.css.control_stylesheet.remove(); } ui.css.control_stylesheet=lib.init.sheet('#window .control,.menubutton:not(.active):not(.highlight):not(.red):not(.blue),#window #system>div>div{background-image:url("'+fileLoadedEvent.target.result+'")}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } if(lib.config.menu_style=='custom'){ game.getDB('image','menu_style',function(fileToLoad){ if(!fileToLoad) return; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent){ if(ui.css.menu_stylesheet){ ui.css.menu_stylesheet.remove(); } ui.css.menu_stylesheet=lib.init.sheet('html #window>.dialog.popped,html .menu,html .menubg{background-image:url("'+fileLoadedEvent.target.result+'");background-size:cover}'); }; fileReader.readAsDataURL(fileToLoad, "UTF-8"); }); } var proceed2=function(){ var mode=lib.imported.mode; var card=lib.imported.card; var character=lib.imported.character; var play=lib.imported.play; delete window.game; var i,j,k; for(i in mode[lib.config.mode].element){ if(!lib.element[i]) lib.element[i]=[]; for(j in mode[lib.config.mode].element[i]){ if(j=='init'){ if(!lib.element[i].inits) lib.element[i].inits=[]; lib.element[i].inits.push(mode[lib.config.mode].element[i][j]); } else{ lib.element[i][j]=mode[lib.config.mode].element[i][j]; } } } for(i in mode[lib.config.mode].ai){ if(typeof mode[lib.config.mode].ai[i]=='object'){ if(ai[i]==undefined) ai[i]={}; for(j in mode[lib.config.mode].ai[i]){ ai[i][j]=mode[lib.config.mode].ai[i][j]; } } else{ ai[i]=mode[lib.config.mode].ai[i]; } } for(i in mode[lib.config.mode].ui){ if(typeof mode[lib.config.mode].ui[i]=='object'){ if(ui[i]==undefined) ui[i]={}; for(j in mode[lib.config.mode].ui[i]){ ui[i][j]=mode[lib.config.mode].ui[i][j]; } } else{ ui[i]=mode[lib.config.mode].ui[i]; } } for(i in mode[lib.config.mode].game){ game[i]=mode[lib.config.mode].game[i]; } for(i in mode[lib.config.mode].get){ get[i]=mode[lib.config.mode].get[i]; } lib.init.start=mode[lib.config.mode].start; lib.init.startBefore=mode[lib.config.mode].startBefore; if(game.onwash){ lib.onwash.push(game.onwash); delete game.onwash; } if(game.onover){ lib.onover.push(game.onover); delete game.onover; } lib.config.banned=lib.config[lib.config.mode+'_banned']||[]; lib.config.bannedcards=lib.config[lib.config.mode+'_bannedcards']||[]; lib.rank=window.noname_character_rank; delete window.noname_character_rank; for(i in mode[lib.config.mode]){ if(i=='element') continue; if(i=='game') continue; if(i=='ai') continue; if(i=='ui') continue; if(i=='get') continue; if(i=='config') continue; if(i=='onreinit') continue; if(i=='start') continue; if(i=='startBefore') continue; if(lib[i]==undefined) lib[i]=(Array.isArray(mode[lib.config.mode][i]))?[]:{}; for(j in mode[lib.config.mode][i]){ lib[i][j]=mode[lib.config.mode][i][j]; } } if(typeof mode[lib.config.mode].init=='function'){ mode[lib.config.mode].init(); } var connectCharacterPack=[]; var connectCardPack=[]; for(i in character){ if(character[i].character){ lib.characterPack[i]=character[i].character } for(j in character[i]){ if(j=='mode'||j=='forbid') continue; if(j=='connect'){ connectCharacterPack.push(i); continue; } if(j=='character'&&!lib.config.characters.contains(i)&&lib.config.mode!='connect'){ if(lib.config.mode=='chess'&&get.config('chess_mode')=='leader'&&get.config('chess_leader_allcharacter')){ for(k in character[i][j]){ lib.hiddenCharacters.push(k); } } else if(lib.config.mode!='boss'||i!='boss'){ continue; } } if(Array.isArray(lib[j])&&Array.isArray(character[i][j])){ lib[j].addArray(character[i][j]); continue; } for(k in character[i][j]){ if(j=='character'){ if(!character[i][j][k][4]){ character[i][j][k][4]=[]; } if(character[i][j][k][4].contains('boss')|| character[i][j][k][4].contains('hiddenboss')){ lib.config.forbidai.add(k); } if(lib.config.forbidai_user&&lib.config.forbidai_user.contains(k)){ lib.config.forbidai.add(k); } for(var l=0;l.name,#arena .button.character>.name {font-family: '+(lib.config.name_font||'xinwei')+',xinwei}',0); ui.css.styles.sheet.insertRule('#arena .player .identity>div {font-family: '+(lib.config.identity_font||'huangcao')+',xinwei}',0); ui.css.styles.sheet.insertRule('.button.character.newstyle>.identity {font-family: '+(lib.config.identity_font||'huangcao')+',xinwei}',0); if(lib.config.cardtext_font&&lib.config.cardtext_font!='default'){ ui.css.styles.sheet.insertRule('.card div:not(.info):not(.background) {font-family: '+lib.config.cardtext_font+';}',0); } if(lib.config.global_font&&lib.config.global_font!='default'){ ui.css.styles.sheet.insertRule('#window {font-family: '+lib.config.global_font+',xinwei}',0); ui.css.styles.sheet.insertRule('#window #control{font-family: STHeiti,SimHei,Microsoft JhengHei,Microsoft YaHei,WenQuanYi Micro Hei,Suits,Helvetica,Arial,sans-serif}',0); } switch(lib.config.glow_phase){ case 'yellow':ui.css.styles.sheet.insertRule('#arena .player:not(.selectable):not(.selected).glow_phase {box-shadow: rgba(0, 0, 0, 0.3) 0 0 0 1px, rgb(217, 152, 62) 0 0 15px, rgb(217, 152, 62) 0 0 15px !important;}',0);break; case 'green':ui.css.styles.sheet.insertRule('#arena .player:not(.selectable):not(.selected).glow_phase {box-shadow: rgba(0, 0, 0, 0.3) 0 0 0 1px, rgba(10, 155, 67, 1) 0 0 15px, rgba(10, 155, 67, 1) 0 0 15px !important;}',0);break; case 'purple':ui.css.styles.sheet.insertRule('#arena .player:not(.selectable):not(.selected).glow_phase {box-shadow: rgba(0, 0, 0, 0.3) 0 0 0 1px, rgb(189, 62, 170) 0 0 15px, rgb(189, 62, 170) 0 0 15px !important;}',0);break; } }, layout:function(layout,nosave){ if(layout=='default') layout='mobile'; if(!nosave) game.saveConfig('layout',layout); game.layout=layout; ui.arena.hide(); setTimeout(function(){ if(game.layout=='default'){ ui.css.layout.href=''; } else{ ui.css.layout.href=lib.assetURL+'layout/'+game.layout+'/layout.css'; } if(game.layout=='mobile'||game.layout=='long'){ ui.arena.classList.add('mobile'); } else{ ui.arena.classList.remove('mobile'); } if(game.layout=='mobile'||game.layout=='long'||game.layout=='long2'||game.layout=='nova'){ if(game.me&&game.me.node.handcards2.childNodes.length){ while(game.me.node.handcards2.childNodes.length){ game.me.node.handcards1.appendChild(game.me.node.handcards2.firstChild); } } } if(game.layout=='default'){ ui.arena.classList.add('oldlayout'); } else{ ui.arena.classList.remove('oldlayout'); } if(lib.config.cardshape=='oblong'&&(game.layout=='long'||game.layout=='mobile'||game.layout=='long2'||game.layout=='nova')){ ui.arena.classList.add('oblongcard'); ui.window.classList.add('oblongcard'); } else{ ui.arena.classList.remove('oblongcard'); ui.window.classList.remove('oblongcard'); } //if(lib.config.textequip=='text'&&(game.layout=='long'||game.layout=='mobile')){ if(game.layout=='long'||game.layout=='mobile'){ ui.arena.classList.add('textequip'); } else{ ui.arena.classList.remove('textequip'); } if(get.is.phoneLayout()){ ui.css.phone.href=lib.assetURL+'layout/default/phone.css'; ui.arena.classList.add('phone'); } else{ ui.css.phone.href=''; ui.arena.classList.remove('phone'); } for(var i=0;i>6, 0x80 | cc&0x3f); }); strUtf = strUtf.replace( /[\u0800-\uffff]/g,function(c) { var cc = c.charCodeAt(0); return String.fromCharCode(0xe0 | cc>>12, 0x80 | cc>>6&0x3F, 0x80 | cc&0x3f); }); return btoa(strUtf); }, decode:function(str){ var strUtf=atob(str); var strUni = strUtf.replace( /[\u00e0-\u00ef][\u0080-\u00bf][\u0080-\u00bf]/g,function(c) { var cc = ((c.charCodeAt(0)&0x0f)<<12) | ((c.charCodeAt(1)&0x3f)<<6) | ( c.charCodeAt(2)&0x3f); return String.fromCharCode(cc); }); strUni = strUni.replace( /[\u00c0-\u00df][\u0080-\u00bf]/g,function(c){ var cc = (c.charCodeAt(0)&0x1f)<<6 | c.charCodeAt(1)&0x3f; return String.fromCharCode(cc); }); return strUni; }, stringify:function(obj){ var str='{' for(var i in obj){ str+='"'+i+'":' if(Object.prototype.toString.call(obj[i])=='[object Object]'){ str+=lib.init.stringify(obj[i]); } else if(typeof obj[i]=='function'){ str+=obj[i].toString(); } else{ str+=JSON.stringify(obj[i]); } str+=',' } str+='}'; return str; }, stringifySkill:function(obj){ var str=''; for(var i in obj){ str+=i+':' if(Object.prototype.toString.call(obj[i])=='[object Object]'){ str+='{\n'+lib.init.stringifySkill(obj[i])+'}'; } else if(typeof obj[i]=='function'){ str+=obj[i].toString().replace(/\t/g,''); } else{ str+=JSON.stringify(obj[i]); } str+=',\n' } return str; } }, cheat:{ i:function(){ window.cheat=lib.cheat; window.game=game; window.ui=ui; window.get=get; window.ai=ai; window.lib=lib; window._status=_status; }, dy:function(){ var next=game.me.next; for(var i=0;i<10;i++){ if(next.identity!='zhu'){ break; } next=next.next; } next.die(); }, x:function(){ var gl=function(dir,callback){ var files=[],folders=[]; dir='/Users/widget/Documents/extension/'+dir; lib.node.fs.readdir(dir,function(err,filelist){ for(var i=0;i1){ for(var i=0;i0&&typeof arguments[i]=='number'){ for(var j=0;j!event.cards.contains(card)); if(cards.length>0){ if(lose>=left){ event._result={bool:true,links:cards}; } else if(cards.length>(left-lose)){ var source=event.source,num=(cards.length-(left-lose)); if(!source||!source.isIn()) source=player; source.chooseButton([ '选择'+(player==source?'你':get.translation(player))+'的'+get.cnNumber(num)+'张'+get.translation(slot)+'牌置入弃牌堆', cards, ],true,[1,num]).set('filterOk',function(){ var evt=_status.event; return ui.selected.buttons.reduce(function(num,button){ return num+get.numOf(get.subtypes(button.link,false),evt.slot) },0)==evt.required; }).set('required',num).set('slot',slot) } else event.goto(3); } else event.goto(3) } 'step 2' if(result.bool) event.cards.addArray(result.links); 'step 3' event.num++; if(event.num0) player.loseToDiscardpile(cards); } }, enableEquip:function(){ if(!event.slots.length) return; var slotsx=[...new Set(event.slots)].sort(); for(var slot of slotsx){ var lost=player.countDisabledSlot(slot),gain=Math.min(lost,get.numOf(event.slots,slot)); if(lost<=0) continue; else{ game.log(player,'恢复了'+get.cnNumber(gain)+'个','#g'+get.translation(slot)+'栏'); if(!player.disabledSlots) player.disabledSlots={}; if(!player.disabledSlots[slot]) player.disabledSlots[slot]=0; player.disabledSlots[slot]-=gain; } } player.$syncDisable(); }, expandEquip:function(){ if(!event.slots.length) return; var slotsx=[...new Set(event.slots)].sort(); for(var slot of slotsx){ var expand=get.numOf(event.slots,slot); game.log(player,'获得了'+get.cnNumber(expand)+'个额外的','#g'+get.translation(slot)+'栏'); if(!player.expandedSlots) player.expandedSlots={}; if(!player.expandedSlots[slot]) player.expandedSlots[slot]=0; player.expandedSlots[slot]+=expand; } player.$syncExpand(); }, //选择顶装备要顶的牌 replaceEquip:function(){ 'step 0' event.cards=[]; var types=get.subtypes(card,false); if(types.length){ var info=get.info(card,false); if(info.customSwap){ event.cards.addArray(player.getCards('e',function(card){ return info.customSwap(card); })); event.goto(4); } else{ event.num=0; event.slots=types; event.slotsx=[...new Set(event.slots)].sort(); } } else event.goto(4); 'step 1' var slot=event.slotsx[event.num]; var left=player.countEquipableSlot(slot),lose=Math.min(left,get.numOf(event.slots,slot)); if(lose<=0) event.goto(3); else{ var cards=player.getEquips(slot).filter(card=>{ return !event.cards.contains(card)&&lib.filter.canBeReplaced(card,player); }); if(cards.length>0){ if(lose>=left){ event._result={bool:true,links:cards}; } else if(cards.length>(left-lose)){ var source=event.source,num=(cards.length-(left-lose)); if(!source||!source.isIn()) source=player; source.chooseButton([ '选择替换掉'+get.cnNumber(num)+'张'+get.translation(slot)+'牌', cards, ],true,[1,num]).set('filterOk',function(){ var evt=_status.event; return ui.selected.buttons.reduce(function(num,button){ return num+get.numOf(get.subtypes(button.link,false),evt.slot) },0)==evt.required; }).set('required',num).set('slot',slot) } else event.goto(3); } else event.goto(3) } 'step 2' if(result.bool) event.cards.addArray(result.links); 'step 3' event.num++; if(event.num0; }); if(!event.targets.length) event.result={bool:false}; else{ var next=player.chooseCardOL(event.targets,get.translation(player)+'发起了议事,请选择展示的手牌',true).set('type','debate').set('source',player).set('ai',event.ai||function(card){ return Math.random(); }).set('aiCard',event.aiCard||function(target){ var hs=target.getCards('h'); return {bool:true,cards:[hs.randomGet()]}; }); next._args.remove('glow_result'); } 'step 1' var red=[],black=[]; event.videoId=lib.status.videoId++; for(var i=0;i红色,展示了',red.map(function(i){ return i[1]; })); } else game.log('#b无人','意见为红色'); if(black.length){ game.log(black.map(function(i){ return i[0]; }),'意见为','#g黑色',',展示了',black.map(function(i){ return i[1]; })); } else game.log('#b无人','意见为','#g黑色'); game.broadcastAll(function(name,id,redArgs,blackArgs){ var dialog=ui.create.dialog(name+'发起了议事','hidden','forcebutton'); dialog.videoId=id; dialog.classList.add('scroll1'); dialog.classList.add('scroll2'); dialog.classList.add('fullwidth'); dialog.classList.add('fullheight'); dialog.buttonss=[]; var list=['意见为红色的角色','意见为黑色的角色'] for(var i=0;i'+list[i]+''); var buttons=ui.create.div('.buttons',dialog.content); dialog.buttonss.push(buttons); buttons.classList.add('popup'); buttons.classList.add('guanxing'); } var func=function(target){ if(target._tempTranslate) return target._tempTranslate; var name=target.name; if(lib.translate[name+'_ab']) return lib.translate[name+'_ab']; return get.translation(name); }; for(var i=0;ievent.black.length) opinion='red'; else if(event.red.length红色':'#g黑色'); else game.log(player,'本次发起的议事无结果'); event.result={ bool:true, opinion:opinion, red:event.red, black:event.black, targets:event.targets } 'step 3' if(event.callback){ var next=game.createEvent('debateCallback',false); next.player=player; next.debateResult=get.copy(event.result); next.setContent(event.callback); } }, delay:function(){ game[event.name].apply(game,event._args) }, chooseCooperationFor:function(){ 'step 0' var next=player.chooseButton([ '选择和'+get.translation(target)+'的协力方式', [event.cardlist,'vcard'], ],true); next.set('ai',event.ai||function(){ return Math.random(); }); 'step 1' if(result.bool){ player.cooperationWith(target,result.links[0][2].slice(12),event.reason); } }, chooseToPlayBeatmap:function(){ 'step 0' if(game.online) return; if(_status.connectMode) event.time=lib.configOL.choose_timeout; event.videoId=lib.status.videoId++; //给其他角色看的演奏框 game.broadcastAll(function(player,id,beatmap){ if(_status.connectMode) lib.configOL.choose_timeout=(Math.ceil((beatmap.timeleap[beatmap.timeleap.length-1]+beatmap.speed*100+(beatmap.current||0))/1000)+5).toString(); if(player==game.me) return; var str=get.translation(player)+'正在演奏《'+beatmap.name+'》...'; if(!_status.connectMode) str+='
        (点击屏幕可以跳过等待AI操作)'; ui.create.dialog(str).videoId=id; if(ui.backgroundMusic) ui.backgroundMusic.pause(); if(lib.config.background_audio){ if(beatmap.filename.indexOf('ext:')==0) game.playAudio('..','extension',beatmap.filename.slice(4),beatmap.name); else game.playAudio('effect',beatmap.filename); } },player,event.videoId,event.beatmap); 'step 1' var beatmap=event.beatmap; if(event.isMine()){ var timeleap=beatmap.timeleap.slice(0); var current=beatmap.current; //获取两个音符的时间间隔 var getTimeout=function(){ var time=timeleap.shift(); var out=time-current; current=time; return out; }; //初始化一堆变量 var score=0; var added=timeleap.length; var number_of_tracks=beatmap.number_of_tracks||6; var custom_mapping=Array.isArray(beatmap.mapping); var mapping=custom_mapping?beatmap.mapping.slice():beatmap.mapping; var hitsound=beatmap.hitsound||'hitsound.wav'; if(hitsound.indexOf('ext:')==0) hitsound=lib.assetURL+'extension/'+hitsound.slice(4); else hitsound=lib.assetURL+'audio/effect/'+hitsound; var hitsound_audio=new Audio(hitsound); hitsound_audio.volume=0.25; var abs=1; var node_pos=0; if(custom_mapping){ node_pos=mapping.shift(); } else if(mapping=='random'){ abs=get.rand(number_of_tracks); node_pos=abs; } var combo=0; var max_combo=0; var nodes=[]; var roundmenu=false; //隐藏菜单按钮 if(ui.roundmenu&&ui.roundmenu.display!='none'){ roundmenu=true; ui.roundmenu.style.display='none'; } if(ui.backgroundMusic) ui.backgroundMusic.pause(); var event=_status.event; event.settleed=false; //建个框框 var dialog=ui.create.dialog('forcebutton','hidden'); event.dialog=dialog; event.dialog.textPrompt=event.dialog.add('
        '+(beatmap.prompt||'在音符滑条和底部判定区重合时点击屏幕!')+'
        '); event.switchToAuto=function(){}; event.dialog.classList.add('fixed'); event.dialog.classList.add('scroll1'); event.dialog.classList.add('scroll2'); event.dialog.classList.add('fullwidth'); event.dialog.classList.add('fullheight'); event.dialog.classList.add('noupdate'); event.dialog.style.overflow='hidden'; //结束后操作 event.settle=function(){ if(event.settleed) return; event.settleed=true; //评分 var acc=Math.floor(score/(added*5)*100); if(!Array.isArray(lib.config.choose_to_play_beatmap_accuracies)) lib.config.choose_to_play_beatmap_accuracies=[]; lib.config.choose_to_play_beatmap_accuracies.push(acc); if(lib.config.choose_to_play_beatmap_accuracies.length>5) lib.config.choose_to_play_beatmap_accuracies.shift(); game.saveConfigValue("choose_to_play_beatmap_accuracies"); var rank; if(acc==100) rank=['SS','metal']; else if(acc>=94) rank=['S','orange']; else if(acc>=87) rank=['A','wood']; else if(acc>=80) rank=['B','water']; else if(acc>=65) rank=['C','thunder']; else rank=['D','fire']; event.dialog.textPrompt.innerHTML='
        演奏结束!
        最大连击数:'+max_combo+' 精准度:'+acc+'%
        '; game.me.$fullscreenpop('演奏评级:'+rank[0]+'',null,null,false); //返回结果并继续游戏 setTimeout(function(){ event._result={ bool:true, accuracy:acc, rank:rank, }; event.dialog.close(); game.resume(); _status.imchoosing=false; if(roundmenu) ui.roundmenu.style.display=''; if(ui.backgroundMusic) ui.backgroundMusic.play().catch(()=>void 0); hitsound_audio.remove(); },1000); }; event.dialog.open(); //操作容差 var height=event.dialog.offsetHeight; var width=event.dialog.offsetWidth; var range1=(beatmap.range1||[90,110]); var range2=(beatmap.range2||[93,107]); var range3=(beatmap.range3||[96,104]); var speed=(beatmap.speed||25); //初始化底部的条子 var judger=ui.create.div(''); judger.style["background-image"]=(beatmap.judgebar_color||'linear-gradient(rgba(240, 235, 3, 1), rgba(230, 225, 5, 1))'); judger.style["border-radius"]='3px'; judger.style.position='absolute'; judger.style.opacity='0.3'; var heightj=Math.ceil(height*(beatmap.judgebar_height||0.1)); judger.style.height=heightj+'px'; judger.style.width=width+'px'; judger.style.left='0px'; judger.style.top=(height-heightj)+'px'; event.dialog.appendChild(judger); //生成每个音符 var addNode=function(){ var node=ui.create.div(''); nodes.push(node); node.style["background-image"]=(beatmap.node_color||'linear-gradient(rgba(120, 120, 240, 1), rgba(100, 100, 230, 1))'); node.style["border-radius"]='3px'; node.style.position='absolute'; node.style.height=Math.ceil(height/10)+'px'; node.style.width=Math.ceil(width/number_of_tracks)-10+'px'; node._position=get.utc(); event.dialog.appendChild(node); node.style.left=Math.ceil(width*node_pos/number_of_tracks+5)+'px'; node.style.top='-'+(Math.ceil(height/10))+'px'; ui.refresh(node); node.style.transition='all '+speed*110+'ms linear'; node.style.transform='translateY('+Math.ceil(height*1.1)+'px)'; node.timeout=setTimeout(function(){ if(nodes.contains(node)){ nodes.remove(node); player.popup('Miss','fire',false); if(player.damagepopups.length) player.$damagepop(); combo=0; } },speed*110); if(custom_mapping){ node_pos=mapping.shift(); } else if(mapping=='random'){ while(node_pos==abs){ node_pos=get.rand(number_of_tracks); } abs=node_pos; } else{ node_pos+=abs; if(node_pos>number_of_tracks-1){ abs=-1; node_pos=number_of_tracks-2; } else if(node_pos<0){ abs=1; node_pos=1; } } if(timeleap.length){ setTimeout(function(){ addNode(); },getTimeout()); } else{ setTimeout(function(){ event.settle(); },speed*110+100) } } //点击时的判断操作 var click=function(){ if(!nodes.length) return; for(var node of nodes){ //用生成到点击的时间差来判断距离 var time=get.utc(); var top=(time-node._position)/speed; if(top>range1[1]) continue; else if(top=range3[0]&&top=range2[0]&&topget.rand(70,100))); var mean=Math.round(choose_to_play_beatmap_accuracies.reduce((previousValue,currentValue)=>previousValue+currentValue)/choose_to_play_beatmap_accuracies.length); var half_standard_deviation=Math.round(Math.sqrt(choose_to_play_beatmap_accuracies.reduce((previousValue,currentValue)=>previousValue+Math.pow(currentValue-mean,2),0))/2); var acc=Math.min(Math.max(get.rand.apply(get,beatmap.aiAcc||[mean-half_standard_deviation-get.rand(0,half_standard_deviation),mean+half_standard_deviation+get.rand(0,half_standard_deviation)]),0),100); var rank; if(acc==100) rank=['SS','metal']; else if(acc>=94) rank=['S','orange']; else if(acc>=87) rank=['A','green']; else if(acc>=80) rank=['B','water']; else if(acc>=65) rank=['C','thunder']; else rank=['D','fire']; event._result={ bool:true, accuracy:acc, rank:rank, }; if(event.dialog) event.dialog.close(); if(event.control) event.control.close(); game.resume(); }; var song_duration=beatmap.timeleap[beatmap.timeleap.length-1]+beatmap.speed*100+1000+(beatmap.current||0); var settle_timeout=setTimeout(settle,song_duration); if(!_status.connectMode) { var skip_timeout; var skip=()=>{ settle(); Array.from(ui.window.getElementsByTagName('audio')).forEach(value=>{ if(value.currentSrc.indexOf(beatmap.filename.indexOf('ext:')==0?beatmap.name:beatmap.filename)>-1) value.remove(); }); document.removeEventListener(lib.config.touchscreen?'touchend':'click',skip); clearTimeout(settle_timeout); clearTimeout(skip_timeout); }; document.addEventListener(lib.config.touchscreen?'touchend':'click',skip); skip_timeout=setTimeout(()=>document.removeEventListener(lib.config.touchscreen?'touchend':'click',skip),song_duration); } } 'step 2' game.broadcastAll(function(id,time){ if(_status.connectMode) lib.configOL.choose_timeout=time; var dialog=get.idDialog(id); if(dialog){ dialog.close(); } if(ui.backgroundMusic) ui.backgroundMusic.play().catch(()=>void 0); },event.videoId,event.time); var result=event.result||result; event.result=result; }, chooseToMove:function(){ 'step 0' if(event.chooseTime&&_status.connectMode&&!game.online){ event.time=lib.configOL.choose_timeout; game.broadcastAll(function(time){ lib.configOL.choose_timeout=time; },event.chooseTime); } if(event.isMine()){ delete ui.selected.guanxing_button; var list=event.list,filterMove=event.filterMove,filterOk=event.filterOk; _status.imchoosing=true; var event=_status.event; event.settleed=false; event.dialog=ui.create.dialog(event.prompt||'请选择要操作的牌','hidden','forcebutton'); event.switchToAuto=function(){ if(!filterOk(event.moved)){ if(!event.forced) event._result={bool:false}; else event._result='ai'; } else{ event._result={ bool:true, moved:event.moved, }; } event.dialog.close(); if(ui.confirm) ui.confirm.close(); game.resume(); _status.imchoosing=false; setTimeout(function(){ ui.arena.classList.remove('choose-to-move'); },500); }; event.dialog.classList.add('scroll1'); event.dialog.classList.add('scroll2'); event.dialog.classList.add('fullwidth'); if(list.length>1){ ui.arena.classList.add('choose-to-move'); event.dialog.classList.add('fullheight'); } event.moved=[]; var buttonss=[]; event.buttonss=buttonss; var updateButtons=function(){ for(var i of buttonss){ event.moved[i._link]=get.links(Array.from(i.childNodes)); if(i.textPrompt) i.previousSibling.innerHTML=('
        '+i.textPrompt(event.moved[i._link])+'
        '); } if(filterOk(event.moved)){ ui.create.confirm('o'); } else{ if(!event.forced) ui.create.confirm('c'); else if(ui.confirm) ui.confirm.close(); } }; var clickButtons=function(){ if(!ui.selected.guanxing_button) return; if(ui.selected.guanxing_button.parentNode==this) return; if(!filterMove(ui.selected.guanxing_button,this._link,event.moved)) return; ui.selected.guanxing_button.classList.remove('glow2'); this.appendChild(ui.selected.guanxing_button); delete ui.selected.guanxing_button; updateButtons(); }; for(var i=0;i'+list[i][0]+''); tex.classList.add('choosetomove'); var buttons=ui.create.div('.buttons',event.dialog.content,clickButtons); buttonss.push(buttons); buttons.classList.add('popup'); buttons.classList.add('guanxing'); buttons._link=i; if(list[i][1]){ if(get.itemtype(list[i][1])=='cards'){ var cardsb=ui.create.buttons(list[i][1],'card',buttons); if(list[i][2]&&typeof list[i][2]=='string'){ for(var ij of cardsb) ij.node.gaintag.innerHTML=get.translation(list[i][2]); } } else if(list[i][1].length==2){ ui.create.buttons(list[i][1][0],list[i][1][1],buttons); } } if(list[i][2]&&typeof list[i][2]=='function') buttons.textPrompt=list[i][2]; } var tex=event.dialog.add('
        点击两张牌以交换位置;点击一张牌并点击其他区域以移动卡牌
        '); tex.classList.add('choosetomove'); event.dialog.open(); updateButtons(); event.custom.replace.button=function(button){ var node=button.parentNode; if(!buttonss.contains(node)) return; if(!ui.selected.guanxing_button){ ui.selected.guanxing_button=button; button.classList.add('glow2'); return; } if(ui.selected.guanxing_button==button){ button.classList.remove('glow2'); delete ui.selected.guanxing_button; return; } if(!filterMove(button,ui.selected.guanxing_button,event.moved)) return; var par1=ui.selected.guanxing_button.parentNode,ind1=ui.selected.guanxing_button.nextSibling,par2=button.parentNode,ind2=button.nextSibling; ui.selected.guanxing_button.classList.remove('glow2'); par1.insertBefore(button,ind1); par2.insertBefore(ui.selected.guanxing_button,ind2); delete ui.selected.guanxing_button; updateButtons(); } event.custom.replace.confirm=function(bool){ if(bool) event._result={ bool:true, moved:event.moved, }; else event._result={bool:false}; event.dialog.close(); if(ui.confirm) ui.confirm.close(); game.resume(); _status.imchoosing=false; setTimeout(function(){ ui.arena.classList.remove('choose-to-move'); },500); }; game.pause(); game.countChoose(); event.choosing=true; } else if(event.isOnline()){ event.send(); } else{ event.result='ai'; } "step 1" if(event.time) game.broadcastAll(function(time){ lib.configOL.choose_timeout=time; },event.time); var result=event.result||result; if((!result||result=='ai'||(event.forced&&!result.bool))&&event.processAI){ var moved=event.processAI(event.list); if(moved) result={ bool:true, moved:moved, } else result={bool:false}; } event.result=result; }, showCharacter:function(){ 'step 0' event.trigger('showCharacterEnd'); 'step 1' event.trigger('showCharacterAfter'); if(get.mode()=='identity'&&player.isZhu) event.trigger('zhuUpdate'); }, removeCharacter:function(){ player.$removeCharacter(event.num); }, chooseUseTarget:function(){ 'step 0' if(get.is.object(card)&&!event.viewAs) card.isCard=true; if(cards&&get.itemtype(card)!='card'){ card=get.copy(card); card.cards=cards.slice(0); event.card=card; } if(!lib.filter.cardEnabled(card,player)||(event.addCount!==false&&!lib.filter.cardUsable(card,player))){ event.result={bool:false}; event.finish(); return; } var info=get.info(card); var range; if(!info.notarget){ var select=get.copy(info.selectTarget); if(select==undefined){ range=[1,1]; } else if(typeof select=='number') range=[select,select]; else if(get.itemtype(select)=='select') range=select; else if(typeof select=='function') range=select(card,player); game.checkMod(card,player,range,'selectTarget',player); } if(info.notarget||range[1]<=-1){ if(!info.notarget&&range[1]<=-1){ for(var i=0;i0; }; } } else{ if(event.filterTarget){ var targets=game.filterPlayer(function(current){ return event.filterTarget(card,player,current); }); if(targets.length6){ var cards=_status.renku.splice(0,_status.renku.length-6); game.log(cards,'从仁库进入了弃牌堆'); game.cardsDiscard(cards).set('outRange',true).fromRenku=true; } game.updateRenku(); } }, chooseToEnable:function(){ 'step 0' var list=[]; for(var i=1;i<=5;i++){ if(player.hasDisabledSlot(i)) list.push('equip'+i); } if(!list.length) event.finish(); else if(list.length==1){ event.list=list; event._result={control:list[0]}; } else{ var next=player.chooseControl(list); next.set('prompt','请选择恢复一个装备栏'); if(!event.ai) event.ai=function(event,player,list){ return list.randomGet(); } event.ai=event.ai(event.getParent(),player,list); next.ai=function(){ return event.ai; }; } 'step 1' event.result={control:result.control}; player.enableEquip(result.control); }, chooseToDisable:function(){ 'step 0' var list=[]; for(var i=1;i<=5;i++){ if(player.hasEnabledSlot(i)) list.push('equip'+i); } if(event.horse){ if(list.contains('equip3')&&list.contains('equip4')) list.push('equip3_4'); list.remove('equip3'); list.remove('equip4'); } if(!list.length) event.finish(); else if(list.length==1){ event.list=list; event._result={control:list[0]}; } else{ list.sort(); event.list=list; var next=player.chooseControl(list); next.set('prompt','请选择废除一个装备栏'); if(!event.ai) event.ai=function(event,player,list){ return list.randomGet(); } event.ai=event.ai(event.getParent(),player,list); next.ai=function(){ return event.ai; }; } 'step 1' event.result={control:result.control}; if(result.control=='equip3_4'){ player.disableEquip(3,4); } else player.disableEquip(result.control); }, swapEquip:function(){ "step 0" game.log(player,'和',target,'交换了装备区中的牌') event.cards=[player.getCards('e'),target.getCards('e')]; game.loseAsync({ player:player, target:target, cards1:event.cards[0], cards2:event.cards[1], }).setContent('swapHandcardsx'); "step 1" for(var i=0;igame.players.length*num&&game.showIdentity){ if(!_status.video) player.popup('显示身份'); _status.identityShown=true; game.showIdentity(false); } } player.ai.tempIgnore=[]; if(ui.land&&ui.land.player==player){ game.addVideo('destroyLand'); ui.land.destroy(); } 'step 1' event.trigger('phaseBeginStart'); }, toggleSubPlayer:function(){ 'step 0' var list=event.list||player.storage.subplayer.skills.slice(0); list.remove(player.storage.subplayer.name2); event.list=list; if(!event.directresult){ if(list.length>1){ var dialog=ui.create.dialog('更换一个随从','hidden'); dialog.add([list,'character']); player.chooseButton(dialog,true); } else if(list.length==1){ event.directresult=list[0]; } else{ event.finish(); } } else{ if(!list.contains(event.directresult)){ event.finish(); } } 'step 1' if(!event.directresult){ if(result&&result.bool&&result.links[0]){ event.directresult=result.links[0]; } else{ event.finish(); return; } } if(player.storage.subplayer){ var current=player.storage.subplayer.name2; if(event.directresult==current){ event.finish(); return; } player.storage[current].hp=player.hp; player.storage[current].maxHp=player.maxHp; player.storage[current].hs=player.getCards('h'); player.storage[current].es=player.getCards('e'); player.lose(player.getCards('he'),ui.special)._triggered=null; var cfg=player.storage[event.directresult]; player.storage.subplayer.name2=event.directresult; player.reinit(current,event.directresult,[ cfg.hp, cfg.maxHp ]); if(cfg.hs.length) player.directgain(cfg.hs); if(cfg.es.length) player.directequip(cfg.es); } }, exitSubPlayer:function(){ 'step 0' if(player.storage.subplayer){ var current=player.storage.subplayer.name2; if(event.remove){ player.lose(player.getCards('he'),ui.discardPile)._triggered=null; } else{ player.storage[current].hp=player.hp; player.storage[current].maxHp=player.maxHp; player.storage[current].hs=player.getCards('h'); player.storage[current].es=player.getCards('e'); player.lose(player.getCards('he'),ui.special)._triggered=null; } player.reinit(current,player.storage.subplayer.name,[ player.storage.subplayer.hp, player.storage.subplayer.maxHp ]); player.update(); if(event.remove){ if(player.storage[current].onremove){ player.storage[current].onremove(player); } delete player.storage[current]; player.storage.subplayer.skills.remove(current); game.log(player,'牺牲了随从','#g'+current); } else{ game.log(player,'收回了随从','#g'+current); } player.addSkill(player.storage.subplayer.skills); } 'step 1' if(player.storage.subplayer){ player.directgain(player.storage.subplayer.hs); player.directequip(player.storage.subplayer.es); } player.removeSkill('subplayer'); 'step 2' if(event.remove){ event.trigger('subPlayerDie'); } }, callSubPlayer:function(){ 'step 0' var list=player.getSubPlayers(event.tag); event.list=list; if(!event.directresult){ if(list.length>1){ var dialog=ui.create.dialog('调遣一个随从','hidden'); dialog.add([list,'character']); player.chooseButton(dialog,true); } else if(list.length==1){ event.directresult=list[0]; } else{ event.finish(); } } else{ if(!list.contains(event.directresult)){ event.finish(); } } 'step 1' if(!event.directresult){ if(result&&result.bool&&result.links[0]){ event.directresult=result.links[0]; } else{ event.finish(); return; } } if(event.directresult){ var cfg=player.storage[event.directresult]; var source=cfg.source||player.name; var name=event.directresult; game.log(player,'调遣了随从','#g'+name); player.storage.subplayer={ name:source, name2:event.directresult, hp:player.hp, maxHp:player.maxHp, skills:event.list.slice(0), hs:player.getCards('h'), es:player.getCards('e'), intro2:cfg.intro2 } player.removeSkill(event.list); player.reinit(source,name,[cfg.hp,cfg.maxHp]); player.addSkill('subplayer'); player.lose(player.getCards('he'),ui.special)._triggered=null; if(cfg.hs.length) player.directgain(cfg.hs); if(cfg.es.length) player.directequip(cfg.es); } 'step 2' game.delay(); }, addExtraTarget:function(){ "step 0" event.num=0; "step 1" var target=targets[num],info=get.info(card); if(target==event.target&&event.addedTarget){ event.addedTargets[num]=event.addedTarget; event._result={bool:false}; } else if(game.hasPlayer(function(current){ return info.filterAddedTarget(card,player,current,target) })){ var next=player.chooseTarget(get.translation(event.card)+':选择'+get.translation(targets[num])+'对应的指向目标',function(card,player,target){ var card=get.card(),info=get.info(card); return info.filterAddedTarget(card,player,target,_status.event.preTarget) },true); next.set('_get_card',card); next.set('preTarget',targets[num]); } else{ event.addedTargets[num]=false; event._result={bool:false}; } "step 2" if(result.bool){ event.addedTargets[num]=result.targets[0]; player.line2([targets[num],result.targets[0]]); } event.num++; if(event.numpriority){ event.doing.list.splice(i--,1); event.num--; } } event.choice=[]; if(event.num
      • '+get.translation(key)+'栏:'+num+'个
        ' } } if(str.length) return str.slice(0,str.length-4); return '当前没有扩展装备栏'; }, }, }, charge:{ markimage:'image/card/charge.png', intro:{ content:'当前蓄力点数:#', }, }, cooperation:{ charlotte:true, trigger:{ global:['phaseAfter','dieAfter'], }, forced:true, lastDo:true, filter:function(event,player){ if(event.name=='die'&&event.player.isAlive()) return false; var storage=player.getStorage('cooperation'); for(var info of storage){ if(info.target==event.player) return true; } return false; }, content:function(){ for(var i=0;i(info.damage&&info.damage>3), content:function(){ var source=trigger.source; var storage=player.getStorage('cooperation'); for(var info of storage){ if(info.type=='damage'&&(source==player||source==info.target)){ if(!info.damage) info.damage=0; info.damage+=trigger.num; } } player.markSkill('cooperation_damage'); }, marktext:'仇', intro:{ name:'协力 - 同仇', markcount:function(storage,player){ return Math.max.apply(Math,player.getStorage('cooperation').map(function(info){ return info.damage||0; })); }, content:function(storage,player){ var str='',storage=player.getStorage('cooperation'); for(var info of storage){ if(info.type=='damage'){ str+='
      • 协力角色:'+get.translation(info.target); str+='
      • 协力原因:'+get.translation(info.reason); str+='
      • 协力进度:' var num=(info.damage||0); str+=num; str+='/4'; str+=(num>3?' (已完成)':' (未完成)'); str+='
          '; } } return str.slice(4,str.length-6); }, }, }, draw:{ mark:true, trigger:{global:'gainAfter'}, forced:true, charlotte:true, popup:false, firstDo:true, filter:function(event,player){ if(event.getParent().name!='draw') return false; var storage=player.getStorage('cooperation'); for(var info of storage){ if(info.type=='draw'&&(event.player==player||event.player==info.target)) return true; } return false; }, checkx:(info)=>(info.draw&&info.draw>7), content:function(){ var source=trigger.player; var storage=player.getStorage('cooperation'); for(var info of storage){ if(info.type=='draw'&&(source==player||source==info.target)){ if(!info.draw) info.draw=0; info.draw+=trigger.cards.length; } } player.markSkill('cooperation_draw'); }, marktext:'进', intro:{ name:'协力 - 并进', markcount:function(storage,player){ return Math.max.apply(Math,player.getStorage('cooperation').map(function(info){ return info.draw||0; })); }, content:function(storage,player){ var str='',storage=player.getStorage('cooperation'); for(var info of storage){ if(info.type=='draw'){ str+='
      • 协力角色:'+get.translation(info.target); str+='
      • 协力原因:'+get.translation(info.reason); str+='
      • 协力进度:' var num=(info.draw||0); str+=num; str+='/8'; str+=(num>7?' (已完成)':' (未完成)'); str+='
          '; } } return str.slice(4,str.length-6); }, }, }, discard:{ mark:true, trigger:{global:'loseAfter'}, forced:true, charlotte:true, popup:false, firstDo:true, filter:function(event,player){ if(event.type!='discard') return false; var storage=player.getStorage('cooperation'); for(var info of storage){ if(info.type=='discard'&&(event.player==player||event.player==info.target)) return true; } return false; }, checkx:(info)=>(info.discard&&info.discard.length>3), content:function(){ var source=trigger.player; var storage=player.getStorage('cooperation'); for(var info of storage){ if(info.type=='discard'&&(source==player||source==info.target)){ if(!info.discard) info.discard=[]; for(var i of trigger.cards2){ var suit=get.suit(i,player); if(lib.suit.contains(suit)) info.discard.add(suit); } } } player.markSkill('cooperation_discard'); }, marktext:'财', intro:{ name:'协力 - 疏财', markcount:function(storage,player){ return Math.max.apply(Math,player.getStorage('cooperation').map(function(info){ return info.discard?info.discard.length:0; })); }, content:function(storage,player){ var str='',storage=player.getStorage('cooperation'); for(var info of storage){ if(info.type=='discard'){ str+='
      • 协力角色:'+get.translation(info.target); str+='
      • 协力原因:'+get.translation(info.reason); str+='
      • 进度:'; var suits=info.discard||[]; var suits2=[['spade','♠','♤'],['heart','♥','♡'],['club','♣','♧'],['diamond','♦','♢']]; for(var i of suits2){ str+=(suits.contains(i[0])?i[1]:i[2]); } str+=(suits.length>3?' (已完成)':' (未完成)'); str+='
          '; } } return str.slice(4,str.length-6); }, }, }, use:{ mark:true, trigger:{global:'useCard1'}, forced:true, charlotte:true, popup:false, firstDo:true, filter:function(event,player){ var suit=get.suit(event.card); if(!lib.suit.contains(suit)) return false; var storage=player.getStorage('cooperation'); for(var info of storage){ if(info.type=='use' &&(event.player==player||event.player==info.target)&& (!info.used||!info.used.contains(suit))) return true; } return false; }, checkx:(info)=>(info.used&&info.used.length>3), content:function(){ var source=trigger.player,suit=get.suit(trigger.card); var storage=player.getStorage('cooperation'); for(var info of storage){ if(info.type=='use'&&(source==player||source==info.target)){ if(!info.used) info.used=[]; info.used.add(suit); } } player.markSkill('cooperation_use'); }, marktext:'戮', intro:{ name:'协力 - 戮力', markcount:function(storage,player){ return Math.max.apply(Math,player.getStorage('cooperation').map(function(info){ return info.used?info.used.length:0; })); }, content:function(storage,player){ var str='',storage=player.getStorage('cooperation'); for(var info of storage){ if(info.type=='use'){ str+='
      • 协力角色:'+get.translation(info.target); str+='
      • 协力原因:'+get.translation(info.reason); str+='
      • 进度:'; var suits=info.used||[]; var suits2=[['spade','♠','♤'],['heart','♥','♡'],['club','♣','♧'],['diamond','♦','♢']]; for(var i of suits2){ str+=(suits.contains(i[0])?i[1]:i[2]); } str+=(suits.length>3?' (已完成)':' (未完成)'); str+='
          '; } } return str.slice(4,str.length-6); }, }, }, }, }, zhengsu:{ trigger:{player:'phaseDiscardEnd'}, forced:true, charlotte:true, filter:function(event,player){ return (player.storage.zhengsu_leijin||player.storage.zhengsu_bianzhen||player.storage.zhengsu_mingzhi); }, content:function(){ player.chooseDrawRecover(2,'整肃奖励:摸两张牌或回复1点体力'); }, subSkill:{ leijin:{ mark:true, trigger:{player:'useCard1'}, lastDo:true, charlotte:true, forced:true, popup:false, onremove:true, filter:function(event,player){ return player.isPhaseUsing()&&player.storage.zhengsu_leijin!==false; }, content:function(){ var list=player.getHistory('useCard',function(evt){ return evt.isPhaseUsing(player); }); var goon=true; for(var i=0;i0){ var num2=get.number(list[i-1].card); if(typeof num2!='number'||num2>=num){ goon=false; break; } } } if(!goon){ game.broadcastAll(function(player){ player.storage.zhengsu_leijin=false; if(player.marks.zhengsu_leijin) player.marks.zhengsu_leijin.firstChild.innerHTML='╳'; delete player.storage.zhengsu_leijin_markcount; },player); } else{ if(list.length>2){ game.broadcastAll(function(player,num){ if(player.marks.zhengsu_leijin) player.marks.zhengsu_leijin.firstChild.innerHTML='○'; player.storage.zhengsu_leijin=true; player.storage.zhengsu_leijin_markcount=num; },player,num); } else game.broadcastAll(function(player,num){ player.storage.zhengsu_leijin_markcount=num; },player,num); } player.markSkill('zhengsu_leijin'); }, intro:{ content:'
      • 条件:回合内所有于出牌阶段使用的牌点数递增且不少于三张。', }, }, bianzhen:{ mark:true, trigger:{player:'useCard1'}, firstDo:true, charlotte:true, forced:true, popup:false, onremove:true, filter:function(event,player){ return player.isPhaseUsing()&&player.storage.zhengsu_bianzhen!==false; }, content:function(){ var list=player.getHistory('useCard',function(evt){ return evt.isPhaseUsing(); }); var goon=true,suit=get.suit(list[0].card,false); if(suit=='none'){ goon=false; } else{ for(var i=1;i1){ game.broadcastAll(function(player){ if(player.marks.zhengsu_bianzhen) player.marks.zhengsu_bianzhen.firstChild.innerHTML='○'; player.storage.zhengsu_bianzhen=true; },player); } else game.broadcastAll(function(player,suit){ if(player.marks.zhengsu_bianzhen) player.marks.zhengsu_bianzhen.firstChild.innerHTML=get.translation(suit); },player,suit); } player.markSkill('zhengsu_bianzhen'); }, intro:{ content:'
      • 条件:回合内所有于出牌阶段使用的牌花色相同且不少于两张。', }, }, mingzhi:{ mark:true, trigger:{player:'loseAfter'}, firstDo:true, charlotte:true, forced:true, popup:false, onremove:true, filter:function(event,player){ if(player.storage.zhengsu_mingzhi===false||event.type!='discard') return false; var evt=event.getParent('phaseDiscard'); return evt&&evt.player==player; }, content:function(){ var goon=true,list=[]; player.getHistory('lose',function(event){ if(!goon||event.type!='discard') return false; var evt=event.getParent('phaseDiscard'); if(evt&&evt.player==player){ for(var i of event.cards2){ var suit=get.suit(i,player); if(list.contains(suit)){ goon=false; break; } else list.push(suit); } } }); if(!goon){ game.broadcastAll(function(player){ player.storage.zhengsu_mingzhi=false; if(player.marks.zhengsu_mingzhi) player.marks.zhengsu_mingzhi.firstChild.innerHTML='╳'; delete player.storage.zhengsu_mingzhi_list; },player); } else{ if(list.length>1){ game.broadcastAll(function(player,list){ if(player.marks.zhengsu_mingzhi) player.marks.zhengsu_mingzhi.firstChild.innerHTML='○'; player.storage.zhengsu_mingzhi=true; player.storage.zhengsu_mingzhi_list=list; player.storage.zhengsu_mingzhi_markcount=list.length; },player,list); } else game.broadcastAll(function(player,list){ player.storage.zhengsu_mingzhi_list=list; player.storage.zhengsu_mingzhi_markcount=list.length; },player,list); } player.markSkill('zhengsu_mingzhi'); }, intro:{ content:'
      • 条件:回合内所有于弃牌阶段弃置的牌花色均不相同且不少于两张。', }, }, }, }, renku:{ intro:{ markcount:function(){ return _status.renku.length; }, mark:function(dialog,content,player){ if(!_status.renku.length) return '仁库中没有牌'; else dialog.addAuto(_status.renku); }, content:function(){ if(!_status.renku.length) return '仁库中没有牌'; return get.translation(_status.renku); }, }, }, _showHiddenCharacter:{ trigger:{player:['changeHp','phaseBeginStart','loseMaxHpBegin','gainMaxHpBegin']}, firstDo:true, forced:true, popup:false, priority:25, filter:function(event,player,name){ return player.isUnseen(2)&&get.mode()!='guozhan'; }, content:function(){ player.showCharacter(2); player.removeSkill('g_hidden_ai'); }, }, _kamisha:{ trigger:{source:'damageBegin2'}, //forced:true, popup:false, prompt:function(event,player){ return '是否防止即将对'+get.translation(event.player)+'造成的伤害,改为令其减少'+get.cnNumber(event.num)+'点体力上限?'; }, filter:function(event,player){ return event.nature=='kami'&&event.num>0; }, ruleSkill:true, check:function(event,player){ var att=get.attitude(player,event.player); if(event.player.hp==event.player.maxHp) return att<0; if(event.player.hp==event.player.maxHp-1&& (event.player.maxHp<=3||event.player.hasSkillTag('maixie'))) return att<0; return att>0; }, content:function(){ trigger.cancel(); trigger.player.loseMaxHp(trigger.num).source=player; }, }, aozhan:{ charlotte:true, mod:{ targetEnabled:function(card){ if(card.name=='tao'&&(card.isCard&&card.cardid||get.itemtype(card)=='card')) return false; }, cardSavable:function(card){ if(card.name=='tao'&&(card.isCard&&card.cardid||get.itemtype(card)=='card')) return false; }, }, group:["aozhan_sha","aozhan_shan"], subSkill:{ sha:{ enable:["chooseToUse","chooseToRespond"], filterCard:{ name:"tao", }, viewAs:{ name:"sha", isCard:true, }, viewAsFilter:function (player){ if(!player.countCards('hs','tao')) return false; }, position:'hs', prompt:"将一张桃当杀使用或打出", check:function (){return 1}, ai:{ respondSha:true, skillTagFilter:function(player){ if(!player.countCards('hs','tao')) return false; }, order:function(){ return get.order({name:'sha'})-0.1; }, }, sub:true, }, shan:{ enable:["chooseToRespond","chooseToUse"], filterCard:{ name:"tao", }, viewAs:{ name:"shan", isCard:true, }, prompt:"将一张桃当闪打出", check:function (){return 1}, viewAsFilter:function (player){ if(!player.countCards('hs','tao')) return false; }, position:'hs', ai:{ respondShan:true, skillTagFilter:function(player){ if(!player.countCards('hs','tao')) return false; }, }, sub:true, }, }, }, global:[], globalmap:{}, storage:{}, undist:{}, others:{}, zhu:{}, zhuSkill:{}, land_used:{}, unequip:{ai:{unequip:true}}, subplayer:{ trigger:{player:'dieBefore'}, forced:true, priority:-9, onremove:true, mark:'character', intro:{ content:function(storage,player){ if(typeof storage.intro2=='string') return storage.intro2; if(typeof storage.intro2=='function') return storage.intro2(storage,player); return '死亡前切换回主武将' }, name:function(storage){ return get.rawName(storage.name); } }, content:function(){ trigger.cancel(); var evt=trigger.getParent('damage'); if(evt.player==player){ evt.untrigger(false,player); } player.exitSubPlayer(true); }, ai:{ nosave:true } }, autoswap:{ firstDo:true, trigger:{player:['playercontrol','chooseToUseBegin','chooseToRespondBegin','chooseToDiscardBegin','chooseToCompareBegin', 'chooseButtonBegin','chooseCardBegin','chooseTargetBegin','chooseCardTargetBegin','chooseControlBegin', 'chooseBoolBegin','choosePlayerCardBegin','discardPlayerCardBegin','gainPlayerCardBegin','chooseToMoveBegin','chooseToPlayBeatmapBegin']}, forced:true, priority:100, forceDie:true, popup:false, filter:function(event,player){ if(event.autochoose&&event.autochoose()) return false; if(lib.filter.wuxieSwap(event)) return false; if(_status.auto||!player.isUnderControl()) return false; return true; }, content:function(){ game.swapPlayerAuto(player); }, }, dualside:{ charlotte:true, subSkill:{ turn:{ trigger:{player:['turnOverAfter','dieBefore']}, silent:true, filter:function(event,player){ if(player.storage.dualside_over) return false; return Array.isArray(player.storage.dualside); }, content:function(){ var cfg=player.storage.dualside; var bool=player.isTurnedOver(); if(trigger.name=='die'){ bool=!bool; } if(bool){ cfg[1]=player.hp; cfg[2]=player.maxHp; player.reinit(cfg[0],cfg[3],[cfg[4],cfg[5]]); player.unmarkSkill('dualside'); player.markSkillCharacter('dualside',{name:cfg[0]},'正面','当前体力:'+cfg[1]+'/'+cfg[2]); } else{ cfg[4]=player.hp; cfg[5]=player.maxHp; player.reinit(cfg[3],cfg[0],[cfg[1],cfg[2]]); player.unmarkSkill('dualside'); player.markSkillCharacter('dualside',{name:cfg[3]},'背面','当前体力:'+cfg[4]+'/'+cfg[5]); } if(trigger.name=='die'){ trigger.cancel(); delete player.storage.dualside; player.storage.dualside_over=true; player.unmarkSkill('dualside'); } } }, init:{ trigger:{global:'gameStart',player:'enterGame'}, silent:true, content:function(){ var list=[player.name,player.name1,player.name2]; for(var i=0;i=player.maxHp; }, content:function(){ trigger.cancel(); }, }, _turnover:{ trigger:{player:'phaseBefore'}, forced:true, forceOut:true, priority:100, popup:false, firstDo:true, content:function(){ if(player.isTurnedOver()&&!trigger._noTurnOver){ trigger.cancel(); player.turnOver(); player.phaseSkipped=true; } else{ player.phaseSkipped=false; } var isRound=false; if(!trigger.skill){ isRound=_status.roundSkipped; if(_status.seatNumSettled){ var seatNum=player.getSeatNum(); if(seatNum!=0){ if(typeof _status.lastSeatNum!='number'||seatNum<_status.lastSeatNum) isRound=true; _status.lastSeatNum=seatNum; } } else if(player==_status.roundStart) isRound=true; if(isRound){ delete _status.roundSkipped; game.roundNumber++; trigger._roundStart=true; game.updateRoundNumber(); for(var i=0;i0){ game.players[i].outCount--; if(game.players[i].outCount==0&&!game.players[i].outSkills){ game.players[i].in(); } } } event.trigger('roundStart'); } } _status.globalHistory.push({ cardMove:[], custom:[], useCard:[], changeHp:[], }); var players=game.players.slice(0).concat(game.dead); for(var i=0;i=parseInt(lib.configOL.number)){ this.send('denied','number'); lib.node.clients.remove(this); this.closed=true; } else{ if(config){ this.avatar=config.avatar; this.nickname=config.nickname; } for(var i=0;i0){ n--; if(findRoom(id)){ clearInterval(interval); game.send('server','enter',id,get.connectNickname(),lib.config.connect_avatar); } } else{ ui.create.connecting(true); clearInterval(interval); } },500); }()); } } game.saveConfig('tmp_user_roomId'); } if(window.isNonameServer){ var cfg='pagecfg'+window.isNonameServer; if(lib.config[cfg]){ lib.configOL=lib.config[cfg][0]; game.send('server','server',lib.config[cfg].slice(1)); game.saveConfig(cfg); _status.protectingroom=true; setTimeout(function(){ _status.protectingroom=false; if(!lib.node||!lib.node.clients||!lib.node.clients.length){ game.reload(); } },15000); } else{ game.send('server','server'); } } else if(typeof game.roomId=='string'){ var room=findRoom(game.roomId); if(game.roomIdServer&&room&&(room.serving||!room.version)){ console.log(); if(lib.config.reconnect_info){ lib.config.reconnect_info[2]=null; game.saveConfig('reconnect_info',lib.config.reconnect_info); } } else{ ui.create.connecting(); game.send('server',(game.roomId==game.onlineKey)?'create':'enter',game.roomId,get.connectNickname(),lib.config.connect_avatar); } } lib.init.onfree(); } if(_status.event.parent){ game.forceOver('noover',proceed); } else{ proceed(); } }, updaterooms:function(list,clients){ if(ui.rooms){ var map={},map2={}; for(var i of ui.rooms) map2[i.key]=true; for(var i of list){ if(!i) continue; map[i[4]]=i; } ui.window.classList.add('more_room'); for(var i=0;i空房间'); player.roomindex=i; player.initRoom=lib.element.player.initRoom; player.addEventListener(lib.config.touchscreen?'touchend':'click',ui.click.connectroom); player.initRoom(i); ui.rooms.push(player); } } } lib.message.client.updateclients(clients,true); }, updateclients:function(clients,bool){ if(clients&&ui.connectClients){ ui.connectClients.info=clients; ui.connectClientsCount.innerHTML=clients.length; } if(_status.connectClientsCallback){ _status.connectClientsCallback(); } }, updateevents:function(events){ if(events&&ui.connectEvents){ ui.connectEvents.info=events; var num=events.filter(function(evt){ return typeof evt.creator=='string'&&(evt.creator==game.onlineKey||!get.is.banWords(evt.content)) }).length; if(num){ ui.connectEventsCount.innerHTML=num; ui.connectEventsCount.show(); } else{ ui.connectEventsCount.hide(); } if(_status.connectEventsCallback){ _status.connectEventsCallback(); } } }, eventsdenied:function(reason){ var str='创建约战失败'; if(reason=='total'){ str+=',约战总数不能超过20'; } else if(reason=='time'){ str+=',时间已过'; } else if(reason=='ban'){ str+=',请注意文明发言'; } alert(str); }, init:function(id,config,ip,servermode,roomId){ game.online=true; game.onlineID=id; game.ip=ip; game.servermode=servermode; game.roomId=roomId; if(game.servermode){ game.saveConfig('reconnect_info',[_status.ip,id,game.roomId]); } else{ game.saveConfig('reconnect_info',[_status.ip,id]); game.saveConfig('tmp_user_roomId',roomId); } lib.config.recentIP.remove(_status.ip); lib.config.recentIP.unshift(_status.ip); lib.config.recentIP.splice(5); game.saveConfig('recentIP',lib.config.recentIP); _status.connectMode=true; lib.configOL=config; lib.playerOL={}; lib.cardOL={}; game.clearArena(); game.finishCards(); ui.create.roomInfo(); ui.create.chat(); if(game.servermode){ ui.create.connectPlayers(get.modetrans(config,true)); } else{ ui.create.connectPlayers(ip); } ui.pause.hide(); ui.auto.hide(); game.clearConnect(); clearTimeout(_status.createNodeTimeout); var proceed=function(){ game.loadModeAsync(config.mode,function(mode){ for(var i in mode.ai){ if(typeof mode.ai[i]=='object'){ if(ai[i]==undefined) ai[i]={}; for(var j in mode.ai[i]){ ai[i][j]=mode.ai[i][j]; } } else{ ai[i]=mode.ai[i]; } } for(var i in mode.get){ if(typeof mode.get[i]=='object'){ if(get[i]==undefined) get[i]={}; for(var j in mode.get[i]){ get[i][j]=mode.get[i][j]; } } else{ get[i]=mode.get[i]; } } for(var i in mode.translate){ lib.translate[i]=mode.translate[i]; } if(mode.game){ game.getIdentityList=mode.game.getIdentityList; game.updateState=mode.game.updateState; game.getRoomInfo=mode.game.getRoomInfo; } if(mode.element&&mode.element.player){ for(var i in mode.element.player){ lib.element.player[i]=mode.element.player[i]; } } if(mode.skill){ for(var i in mode.skill){ lib.skill[i]=mode.skill[i]; } } if(mode.card){ for(var i in mode.card){ lib.card[i]=mode.card[i]; } } game.finishCards(); if(mode.characterPack){ for(var i in mode.characterPack){ lib.characterPack[i]=mode.characterPack[i]; } } _status.event={ finished:true, next:[], after:[] }; _status.paused=false; game.createEvent('game',false).setContent(lib.init.startOnline); game.loop(); game.send('inited'); ui.create.connecting(true); }); } if(_status.event.parent){ game.forceOver('noover',proceed); } else{ proceed(); } for(var i in lib.characterPack){ for(var j in lib.characterPack[i]){ lib.character[j]=lib.character[j]||lib.characterPack[i][j]; } } }, reinit:function(config,state,state2,ip,observe,onreconnect,cardtag,postReconnect){ ui.auto.show(); ui.pause.show(); game.clearConnect(); clearTimeout(_status.createNodeTimeout); game.online=true; game.ip=ip; game.servermode=state.servermode; game.roomId=state.roomId; if(state.over){ _status.over=true; } if(observe){ game.observe=true; game.onlineID=null; game.roomId=null; } if(game.servermode&&!observe){ game.saveConfig('reconnect_info',[_status.ip,game.onlineID,game.roomId]); } else{ game.saveConfig('reconnect_info',[_status.ip,game.onlineID]); if(!observe){ game.saveConfig('tmp_user_roomId',game.roomId); } } _status.connectMode=true; lib.configOL=config; lib.playerOL={}; lib.cardOL={}; game.loadModeAsync(config.mode,function(mode){ for(var i in mode.ai){ if(typeof mode.ai[i]=='object'){ if(ai[i]==undefined) ai[i]={}; for(var j in mode.ai[i]){ ai[i][j]=mode.ai[i][j]; } } else{ ai[i]=mode.ai[i]; } } for(var i in mode.get){ if(typeof mode.get[i]=='object'){ if(get[i]==undefined) get[i]={}; for(var j in mode.get[i]){ get[i][j]=mode.get[i][j]; } } else{ get[i]=mode.get[i]; } } for(var i in mode.translate){ lib.translate[i]=mode.translate[i]; } if(mode.game){ game.getIdentityList=mode.game.getIdentityList; game.getIdentityList2=mode.game.getIdentityList2; game.updateState=mode.game.updateState; game.showIdentity=mode.game.showIdentity; } if(mode.element&&mode.element.player){ for(var i in mode.element.player){ lib.element.player[i]=mode.element.player[i]; } } if(mode.skill){ for(var i in mode.skill){ lib.skill[i]=mode.skill[i]; } } if(mode.card){ for(var i in mode.card){ lib.card[i]=mode.card[i]; } } game.finishCards(); if(mode.characterPack){ for(var i in mode.characterPack){ lib.characterPack[i]=mode.characterPack[i]; } } if(mode.onreinit){ mode.onreinit(); } _status.cardtag=get.parsedResult(cardtag); game.players=[]; game.dead=[]; for(var i in lib.characterPack){ for(var j in lib.characterPack[i]){ lib.character[j]=lib.character[j]||lib.characterPack[i][j]; } } game.clearArena(); game.finishCards(); if(!observe){ ui.create.chat(); if(ui.exitroom){ ui.exitroom.remove(); delete ui.exitroom; } } else{ if(!ui.exitroom){ ui.create.system('退出旁观',function(){ game.saveConfig('reconnect_info'); game.reload(); },true); } if(!lib.configOL.observe_handcard){ ui.arena.classList.add('observe'); } } postReconnect=get.parsedResult(postReconnect); for(var i in postReconnect){ if(Array.isArray(postReconnect[i])){ postReconnect[i].shift().apply(this,postReconnect[i]); } } state=get.parsedResult(state); ui.arena.setNumber(state.number); _status.mode=state.mode; _status.renku=state.renku; lib.inpile=state.inpile; lib.inpile_nature=state.inpile_nature; var pos=state.players[observe||game.onlineID].position; for(var i in state.players){ var info=state.players[i]; var player=ui.create.player(ui.arena).animate('start'); player.dataset.position=(info.positionbeats.map(value=>Math.round(value*60000/bpm+(offset||0))), updateRenku:function(){ game.broadcast(function(renku){ _status.renku=renku; },_status.renku); for(var i of game.players){ if(i.storage.renku) i.markSkill('renku'); } }, loseAsync:function(arg){ var next=game.createEvent('loseAsync'); next.forceDie=true; next.getd=function(player,key,position){ if(!position) position=ui.discardPile; if(!key) key='cards'; var cards=[],event=this; game.getGlobalHistory('cardMove',function(evt){ if(evt.name!='lose'||evt.position!=position||evt.getParent()!=event) return; if(player&&player!=evt.player) return; cards.addArray(evt[key]); }); return cards; }; next.getl=function(player){ var that=this; var map={ player:player, hs:[], es:[], js:[], ss:[], xs:[], cards:[], cards2:[], }; player.getHistory('lose',function(evt){ if(evt.parent==that){ map.hs.addArray(evt.hs); map.es.addArray(evt.es); map.js.addArray(evt.js); map.ss.addArray(evt.ss); map.xs.addArray(evt.xs); map.cards.addArray(evt.cards); map.cards2.addArray(evt.cards2); } }); return map; }; next.getg=function(player){ var that=this; var cards=[]; player.getHistory('gain',function(evt){ if(evt.parent==that){ cards.addArray(evt.cards); } }); return cards; }; if(arg&&get.is.object(arg)){ for(var i in arg) next[i]=arg[i]; } return next; }, getRarity:function(name){ var rank=lib.rank.rarity; if(rank.legend.contains(name)) return 'legend'; if(rank.epic.contains(name)) return 'epic'; if(rank.rare.contains(name)) return 'rare'; if(get.mode()!='chess'&&rank.junk.contains(name)) return 'junk'; return 'common'; }, getGlobalHistory:function(key,filter){ if(!key) return _status.globalHistory[_status.globalHistory.length-1]; if(!filter) return _status.globalHistory[_status.globalHistory.length-1][key]; else{ var history=game.getGlobalHistory(key).slice(0); for(var i=0;i'+lib.translate[skill+'_info']+''); uiintro.add(ui.create.div('.placeholder.slim')); return uiintro; },200); game.addGlobalSkill(skill); } }, checkFileList:function(updates,proceed){ var n=updates.length; if(!n){ proceed(n); } for(var i=0;i确认删除'){ var prefix='extension_'+obj.name; var page=this.parentNode; var start=page.parentNode.previousSibling; page.remove(); if(start){ for(var i=0;i=80&&pkgjs[j]==','&&pkgjs[j-1]=='"'){ pkgfrag+='\n\t\t'; pkgbuffer=0; } } } else{ pkgfrag=JSON.stringify(pkg[i]); } pkgstr+='\t'+i+':'+pkgfrag+',\n' } pkgstr=pkgstr.slice(0,pkgstr.length-2); pkgstr+='\n};'; zip.file('package.js',pkgstr); } var blob = zip.generate({type:"blob"}); var fileNameToSaveAs = exportext; fileNameToSaveAs=fileNameToSaveAs.replace(/\\|\/|\:|\?|\"|\*|<|>|\|/g,'.'); fileNameToSaveAs+='.zip'; if(lib.device){ var directory; if(lib.device=='android'){ directory=cordova.file.externalDataDirectory; } else{ directory=cordova.file.documentsDirectory; } window.resolveLocalFileSystemURL(directory,function(entry){ entry.getFile(fileNameToSaveAs,{create:true},function(fileEntry){ fileEntry.createWriter(function(fileWriter){ fileWriter.onwriteend=function(){ alert('文件已导出至'+directory+fileNameToSaveAs); } fileWriter.write(blob) }); }); }); } else{ var downloadLink = document.createElement("a"); downloadLink.download = fileNameToSaveAs; downloadLink.innerHTML = "Download File"; downloadLink.href = window.URL.createObjectURL(blob); downloadLink.click(); } if(typeof finishLoad=='function'){ finishLoad(); } } else{ game.importExtension.apply(this,[zip.generate({type:'arraybuffer'}),finishLoad]); } } else{ //导入 function UHP(){ alert("导入失败"); }; var zip=new JSZip(); try{ zip.load(data); // alert(zip.file('文件夹/加扩展.js').asText()) var str=zip.file('extension.js').asText(); if(str===""||undefined) throw('你导入的不是扩展!请选择正确的文件'); _status.importingExtension=true; eval(str); _status.importingExtension=false; if(!game.importedPack) throw('err'); var extname=game.importedPack.name; if(lib.config.all.plays.contains(extname)){ throw('禁止安装游戏原生扩展'); } if(lib.config.extensions.contains(extname)){ game.removeExtension(extname,true); } lib.config.extensions.add(extname); game.saveConfig('extensions',lib.config.extensions); game.saveConfig('extension_'+extname+'_enable',true); for(var i in game.importedPack.config){ if(game.importedPack.config[i]&&game.importedPack.config[i].hasOwnProperty('init')){ game.saveConfig('extension_'+extname+'_'+i,game.importedPack.config[i].init); } } if(game.download){ var filelist=[]; for(var i in zip.files){ //alert(zip.files[i].dir+i) if(!zip.files[i].dir&&i[0]!='.'&&i[0]!='_'){ filelist.push(i); } } //alert(filelist) if(lib.node&&lib.node.fs){ //电脑端 //具备nodeJS环境 game.ensureDirectory('extension/'+extname,function(){ var writeFile=function(e){ if(e){ finishLoad(); UHP(); return; } if(filelist.length){ var filename=filelist.shift(); //filename 数组 ...dir+/+file var zipdir=filename; filename=filename.split("/"); var name=filename.pop(); if(filename.length) game.createDir('extension/'+extname+"/"+filename.join("/"),function(){ //这里需要个创文件夹的函数 Letgo(filename.join("/")+"/"+name); },UHP); else Letgo(name); function Letgo(name){ lib.node.fs.writeFile(__dirname+'/extension/'+extname+"/"+name,zip.file(zipdir).asNodeBuffer(),null,writeFile); } } else{ finishLoad(); } } writeFile(); }); } else{ window.resolveLocalFileSystemURL(lib.assetURL,function(entry){ entry.getDirectory('extension/'+extname,{create:true},function(dirEntry){ //扩展文件夹 writeFile(); function writeFile(){ if(filelist.length){ var filename=filelist.shift(); //filename 数组 ...dir+/+file var zipdir=filename; filename=filename.split("/"); var name=filename.pop(); if(filename.length) game.createDir('extension/'+extname+"/"+filename.join("/"),function(){ Letgo(filename.join("/")+"/"+name); },UHP); else Letgo(name); function Letgo(name){ dirEntry.getFile(name,{create:true},function(fileEntry){ fileEntry.createWriter(function(fileWriter){ fileWriter.onwriteend=writeFile; fileWriter.write(zip.file(zipdir).asArrayBuffer()); }); },UHP); } } else{ finishLoad(); } }; }); }); } } else{ localStorage.setItem(lib.configprefix+'extension_'+extname,str); var imglist=[]; for(var i in zip.files){ if(i[0]!='.'&&i[0]!='_'){ if(i.indexOf('.jpg')!=-1||i.indexOf('.png')!=-1){ imglist.push(i); } } } if(imglist.length&&lib.db){ lib.config.extensionInfo[extname]={ image:imglist } game.saveConfig('extensionInfo',lib.config.extensionInfo); for(var i=0;i|\|/g,'.'); if(lib.device){ var directory; if(lib.device=='android'){ directory=cordova.file.externalDataDirectory; } else{ directory=cordova.file.documentsDirectory; } window.resolveLocalFileSystemURL(directory,function(entry){ entry.getFile(fileNameToSaveAs,{create:true},function(fileEntry){ fileEntry.createWriter(function(fileWriter){ fileWriter.onwriteend=function(){ alert('文件已导出至'+directory+fileNameToSaveAs); } fileWriter.write(textFileAsBlob) }); }); }); } else{ var downloadLink = document.createElement("a"); downloadLink.download = fileNameToSaveAs; downloadLink.innerHTML = "Download File"; downloadLink.href = window.URL.createObjectURL(textFileAsBlob); downloadLink.click(); } }, multiDownload2:function(list,onsuccess,onerror,onfinish,process,dev){ list=list.slice(0); var download=function(){ if(list.length){ var current=list.shift(); var current2; if(typeof process=='function'){ current2=process(current); } else{ current2=current; } if(current.indexOf('theme')==0){ game.print(current.slice(6)); } else if(current.indexOf('image/skin')==0){ game.print(current.slice(11)); } else{ game.print(current.slice(current.lastIndexOf('/')+1)); } game.download(current,current2,function(){ if(onsuccess) onsuccess(list.length); download(); },function(){ if(onerror) onerror(list.length); download(); },dev); } else{ if(onfinish) onfinish(); } } download(); }, multiDownload:function(list,onsuccess,onerror,onfinish,process,dev){ if(lib.config.dev) game.print(get.url()); var args=Array.from(arguments); if(list.length<=3){ game.multiDownload2.apply(this,args); } else{ var num=Math.round(list.length/3); var left=3; args[3]=function(){ left--; if(left==0){ onfinish(); } }; setTimeout(function(){ args[0]=list.slice(0,num);game.multiDownload2.apply(game,args); }); setTimeout(function(){ args[0]=list.slice(num,2*num);game.multiDownload2.apply(this,args); },200); setTimeout(function(){ args[0]=list.slice(2*num);game.multiDownload2.apply(this,args); },400); } }, fetch:function(url,onload,onerror,onprogress){ var tmpName='~tmp'+get.id(); game.download(encodeURI(url),tmpName,function(){ game.readFile(tmpName,function(data){ onload(data); game.removeFile(tmpName); },onerror); },onerror,null,onprogress); }, playVideo:function(time,mode){ if(!_status.replayvideo){ localStorage.setItem(lib.configprefix+'playbackmode',lib.config.mode); } game.saveConfig('mode',mode); localStorage.setItem(lib.configprefix+'playback',time); game.reload(); }, playVideoContent:function(video){ var next=game.createEvent('video',false); next.video=video; ui.system.style.display='none'; ui.system.hide(); ui.arena.style.display='none'; ui.arena.hide(); ui.window.classList.remove('leftbar'); ui.window.classList.remove('rightbar'); ui.historybar.style.display='none'; _status.event=next; _status.paused=false; _status.paused2=false; _status.over=false; _status.video=true; clearTimeout(_status.timeout); for(var i in lib.characterPack){ for(var j in lib.characterPack[i]){ lib.character[j]=lib.character[j]||lib.characterPack[i][j]; } } next.setContent('playVideoContent'); game.loop(); }, videoContent:{ arrangeLib:function(content){ for(var i in content){ for(var j in content[i]){ lib[i][j]=content[i][j]; } } }, $syncDisable:function(player,map){ player.disabledSlots=map; player.$syncDisable(map) }, $syncExpand:function(player,map){ player.expandedSlots=map; player.$syncExpand(map) }, $disableJudge:function(player,map){ player.$disableJudge() }, $enableJudge:function(player,map){ player.$enableJudge() }, jiuNode:function(player,bool){ //Powered by 升麻 if(bool){ if(!player.node.jiu&&lib.config.jiu_effect){ player.node.jiu=ui.create.div('.playerjiu',player.node.avatar); player.node.jiu2=ui.create.div('.playerjiu',player.node.avatar2); } } else{ if(player.node.jiu){ player.node.jiu.delete(); player.node.jiu2.delete(); delete player.node.jiu; delete player.node.jiu2; } } }, init:function(players){ if(game.chess) return; if(lib.config.mode=='versus'){ players.bool=players.pop(); } ui.arena.setNumber(players.length); ui.arena.classList.add('video'); game.players.length=0; game.dead.length=0; ui.create.players(players.length); game.me=game.players[0]; ui.handcards1=game.me.node.handcards1; ui.handcards2=game.me.node.handcards2; ui.handcards1Container.appendChild(ui.handcards1); ui.handcards2Container.appendChild(ui.handcards2); if(lib.config.mode=='versus'){ if(players.bool){ ui.arena.setNumber(parseInt(ui.arena.dataset.number)+1); for(var i=0;i.card,#chess>.card'); var nodes=[]; for(var i=0;i.card,#chess>.card'); var nodes=[]; for(var i=0;i.card,#chess>.card'); var nodes=[]; for(var i=0;i=0;j--){ if(card[2]==nodes[j].name&&card[0]==nodes[j].suit&&card[1]==nodes[j].number){ nodes[j].classList.add('thrownhighlight'); break; } } } else{ console.log(player,cards); } }, uiClear:function(){ ui.clear(); }, judge1:function(player,content){ if(player&&content){ var judging=get.infoCard(content[0]); if(game.chess){ judging.copy('thrown','center','thrownhighlight',ui.arena).animate('start'); } else{ player.$throwordered(judging.copy('thrownhighlight'),true); } ui.create.dialog(content[1]).videoId=content[2]; ui.arena.classList.add('thrownhighlight'); } else{ console.log(player); } }, centernode:function(content){ get.infoCard(content).copy('thrown','center','thrownhighlight',ui.arena).animate('start'); }, judge2:function(videoId){ for(var i=0;i1){ player.node.marks.lastChild.remove(); } player.classList.add('dead'); player.classList.remove('turnedover'); player.classList.remove('out'); player.node.count.innerHTML='0'; player.node.hp.hide(); player.node.equips.hide(); player.node.count.hide(); player.previous.next=player.next; player.next.previous=player.previous; game.players.remove(player); game.dead.push(player); if(lib.config.mode=='stone'){ setTimeout(function(){ player.delete(); },500); } }, tafangMe:function(player){ if(player){ game.me=player; ui.me.lastChild.show(); ui.create.fakeme(); ui.handcards1=player.node.handcards1.animate('start').fix(); ui.handcards2=player.node.handcards2.animate('start').fix(); ui.handcards1Container.appendChild(ui.handcards1); ui.handcards2Container.appendChild(ui.handcards2); ui.updatehl(); game.setChessInfo(); } }, deleteChessPlayer:function(player){ if(player){ player.delete(); delete game.playerMap[player.dataset.position]; game.players.remove(player); for(var i=0;i=14){ remote=require('@electron/remote'); }else{ remote=require('electron').remote; } var thisWindow=remote.getCurrentWindow(); thisWindow.destroy(); window.process.exit(); } // android-cordova环境 else if(lib.device==='android'){ if(navigator.app&&navigator.app.exitApp){ navigator.app.exitApp(); } } //ios-cordova环境或ios浏览器环境 else if(lib.device==='ios'||!lib.device&&ios){ game.saveConfig('mode'); if(_status){ if(_status.reloading)return; _status.reloading=true; } if(_status.video&&!_status.replayvideo) { localStorage.removeItem(lib.configprefix+'playbackmode'); } window.location.reload(); } //非ios的网页版 else if(!ios){ window.onbeforeunload = null; window.close(); } }, open:function(url){ if(lib.device){ if(cordova.InAppBrowser){ cordova.InAppBrowser.open(url,'_system'); } else{ ui.create.iframe(url); } } else{ window.open(url); } }, reloadCurrent:function(){ game.saveConfig('continue_name',[game.me.name1||game.me.name,game.me.name2]); game.saveConfig('mode',lib.config.mode); localStorage.setItem(lib.configprefix+'directstart',true); game.reload(); }, update:function(func){ lib.updates.push(func); if(lib.updates.length===1){ game.run(); } return func; }, unupdate:function(func){ lib.updates.remove(func); }, stop:function(){ cancelAnimationFrame(lib.status.frameId); }, run:function(){ if(lib.updates.length){ cancelAnimationFrame(lib.status.frameId); lib.status.frameId=requestAnimationFrame(function(time){ if(lib.status.time!==0){ lib.status.delayed+=time-lib.status.time; } lib.status.frameId=requestAnimationFrame(lib.run); }); } }, addVideo:function(type,player,content){ if(_status.video||game.online) return; if(!_status.videoInited){ if(type=='arrangeLib'){ lib.video.push({ type:type, player:player, content:content, delay:0 }); } return; } if(type=='storage'&&player&&player.updateMarks){ player.updateMarks(); } if(game.getVideoName){ var time=get.time(); if(!_status.lastVideoLog){ _status.lastVideoLog=time; } if(get.itemtype(player)=='player'){ player=player.dataset.position; } lib.video.push({ type:type, player:player, content:content, delay:time-_status.lastVideoLog }); _status.lastVideoLog=time; } }, draw:function(func){ lib.canvasUpdates.push(func); if(!lib.status.canvas){ lib.status.canvas=true; game.update(lib.updateCanvas); } }, vibrate:function(time){ if(typeof navigator.vibrate=='function'){ navigator.vibrate(time||500); } }, prompt:function(){ var str,forced,callback,noinput=false,str2=''; for(var i=0;ix){ this.speed.x=Math.abs(this.speed.x); } this.life*=1.3; this.death*=1.3; break; } case 'dust':{ this.r = Math.round(Math.random()*55)+105; this.g = Math.round(Math.random()*55)+150; this.b = 255; this.location.x+=Math.round(Math.random()*60)-30; this.location.y+=Math.round(Math.random()*40)-20; if(this.location.xx){ this.speed.x=Math.abs(this.speed.x); } this.life*=1.3; this.death*=1.3; break; } case 'legend':{ this.r = 255; this.g = Math.round(Math.random()*100+155); this.b = Math.round(Math.random()*100+50); this.location.x+=Math.round(Math.random()*60)-30; this.location.y+=Math.round(Math.random()*40)-20; if(this.location.xx){ this.speed.x=Math.abs(this.speed.x); } this.speed.x/=2; this.speed.y/=2; this.life*=2; this.death*=2; break; } case 'epic':{ this.r = Math.round(Math.random()*55)+200; this.g = Math.round(Math.random()*100)+55; this.b = 255; this.location.x+=Math.round(Math.random()*60)-30; this.location.y+=Math.round(Math.random()*40)-20; if(this.location.xx){ this.speed.x=Math.abs(this.speed.x); } this.speed.x/=2; this.speed.y/=2; this.life*=2; this.death*=2; break; } case 'rare':{ this.r = Math.round(Math.random()*55)+105; this.g = Math.round(Math.random()*55)+150; this.b = 255; this.location.x+=Math.round(Math.random()*60)-30; this.location.y+=Math.round(Math.random()*40)-20; if(this.location.xx){ this.speed.x=Math.abs(this.speed.x); } this.speed.x/=2; this.speed.y/=2; this.life*=2; this.death*=2; break; } case 'recover':{ this.g = 255; this.r = Math.round(Math.random()*200+55); this.b = Math.round(Math.random()*155+55); this.location.x+=Math.round(Math.random()*60)-30; this.location.y+=Math.round(Math.random()*40)-20; if(this.location.xx){ this.speed.x=Math.abs(this.speed.x); } this.speed.x/=2; this.speed.y/=2; this.life*=2; this.death*=2; break; } default:{ this.r = 255; this.g = Math.round(Math.random()*155); this.b = 0; } } } game.draw(function(time,surface){ surface.globalCompositeOperation = "source-over"; surface.globalCompositeOperation = "lighter"; for(var i = 0; i < particles.length; i++) { var p = particles[i]; surface.beginPath(); var middle=0.5; var radius=p.radius; if(type=='recover'||type=='legend'||type=='rare'|| type=='epic'||type=='coin'||type=='dust'){ middle=0.7; radius/=3; } p.opacity = Math.round(p.death/p.life*100)/100 var gradient = surface.createRadialGradient(p.location.x, p.location.y, 0, p.location.x, p.location.y, p.radius); gradient.addColorStop(0, "rgba("+p.r+", "+p.g+", "+p.b+", "+p.opacity+")"); gradient.addColorStop(middle, "rgba("+p.r+", "+p.g+", "+p.b+", "+p.opacity+")"); gradient.addColorStop(1, "rgba("+p.r+", "+p.g+", "+p.b+", 0)"); surface.fillStyle = gradient; surface.arc(p.location.x, p.location.y, radius, Math.PI*2, false); surface.fill(); p.death--; if(type=='recover'){ p.radius+=0.5; } else if(type=='coin'||type=='dust'){ p.radius+=0.7; } else if(type=='legend'||type=='rare'||type=='epic'){ p.radius+=0.5; } else { p.radius++; } p.location.x += (p.speed.x); p.location.y += (p.speed.y); if(p.death < 0 || p.radius < 0){ if(typeof duration=='number'&&time+500>=duration){ particles.splice(i--,1); } else{ particles[i] = new particle(); } } } if(particles.length==0){ return false; } }); } }, linexy:function(path){ var from=[path[0],path[1]]; var to=[path[2],path[3]]; var total=typeof arguments[1]==='number'?arguments[1]:lib.config.duration*2; var opacity=1; var color=[255,255,255]; var dashed=false; var drag=false; if(typeof arguments[1]=='object'){ for(var i in arguments[1]){ switch(i){ case 'opacity':opacity=arguments[1][i];break; case 'color':color=arguments[1][i];break; case 'dashed':dashed=arguments[1][i];break; case 'duration':total=arguments[1][i];break; } } } else if(arguments[1]=='fire'||arguments[1]=='thunder'||arguments[1]=='green'){ color=arguments[1]; } if(color=='fire'){ color=[255, 146, 68]; } else if(color=='thunder'){ color=[141, 216, 255]; } else if(color=='green'){ color=[141, 255, 216]; } var node; if(arguments[1]=='drag'){ color=[236, 201, 71]; drag=true; if(arguments[2]){ node=arguments[2] } else{ node=ui.create.div('.linexy.drag'); node.style.left=from[0]+'px'; node.style.top=from[1]+'px'; node.style.background='linear-gradient(transparent,rgba('+color.toString()+','+opacity+'),rgba('+color.toString()+','+opacity+'))'; if(game.chess){ ui.chess.appendChild(node); } else{ ui.arena.appendChild(node); } } } else{ node=ui.create.div('.linexy.hidden'); node.style.left=from[0]+'px'; node.style.top=from[1]+'px'; node.style.background='linear-gradient(transparent,rgba('+color.toString()+','+opacity+'),rgba('+color.toString()+','+opacity+'))'; node.style.transitionDuration=(total/3000)+'s'; } var dy=to[1]-from[1]; var dx=to[0]-from[0]; var deg=Math.atan(Math.abs(dy)/Math.abs(dx))/Math.PI*180; if(dx>=0){ if(dy<=0){ deg+=90; } else{ deg=90-deg; } } else{ if(dy<=0){ deg=270-deg; } else{ deg+=270; } } if(drag){ node.style.transform='rotate('+(-deg)+'deg)'; node.style.height=get.xyDistance(from,to)+'px'; } else{ node.style.transform='rotate('+(-deg)+'deg) scaleY(0)'; node.style.height=get.xyDistance(from,to)+'px'; if(get.objtype(arguments[1])=='div'){ arguments[1].appendChild(node); } else if(game.chess){ ui.chess.appendChild(node); } else{ ui.arena.appendChild(node); } ui.refresh(node); node.show(); node.style.transform='rotate('+(-deg)+'deg) scaleY(1)'; node.listenTransition(function(){ setTimeout(function(){ if(node.classList.contains('removing')) return; node.delete(); },total/3); }); } return node; }, _linexy:function(path){ var from=[path[0],path[1]]; var to=[path[2],path[3]]; var total=typeof arguments[1]==='number'?arguments[1]:lib.config.duration*2; var opacity=1; var color=[255,255,255]; var dashed=false; if(typeof arguments[1]=='object'){ for(var i in arguments[1]){ switch(i){ case 'opacity':opacity=arguments[1][i];break; case 'color':color=arguments[1][i];break; case 'dashed':dashed=arguments[1][i];break; case 'duration':total=arguments[1][i];break; } } } else if(arguments[1]=='fire'||arguments[1]=='thunder'||arguments[1]=='green'){ color=arguments[1]; } if(color=='fire'){ color=[255, 146, 68]; } else if(color=='thunder'){ color=[141, 216, 255]; } else if(color=='green'){ color=[141, 255, 216]; } var drawfunc=function(time,ctx){ var current; if(timetotal/1.5){ ctx.strokeStyle='rgba('+color.toString()+','+opacity*(1-(time-total/1.5)/(total-total/1.5))+')'; } else{ ctx.strokeStyle='rgba('+color.toString()+','+opacity+')'; } } else{ return false; } ctx.beginPath(); if(dashed){ ctx.lineCap='butt'; ctx.setLineDash([8,2]); } else{ ctx.lineCap='round'; } ctx.moveTo(from[0],from[1]); ctx.lineTo(current[0],current[1]); ctx.stroke(); }; if(arguments[2]&&game.chess){ game.draw2(drawfunc); } else{ game.draw(drawfunc); } }, createTrigger:function(name,skill,player,event){ var info=get.info(skill); if(!info) return false; if((player.isOut()||player.removed)&&!info.forceOut) return; if(player.isDead()&&!info.forceDie) return; var next=game.createEvent('trigger',false); next.skill=skill; next.player=player; next.triggername=name; next.forceDie=true; next.includeOut=true; next._trigger=event; next.setContent('createTrigger'); }, createEvent:function(name,trigger,triggerevent){ var next={ name:name, step:0, finished:false, next:[], after:[], custom:{ add:{}, replace:{} }, _aiexclude:[], _notrigger:[], _result:{}, _set:[], } if(trigger!==false&&!game.online) next._triggered=0; for(var i in lib.element.event){ next[i]=lib.element.event[i]; } (triggerevent||_status.event).next.push(next); return next; }, addCharacter:function(name,info){ var extname=(_status.extension||info.extension); var imgsrc; if(_status.evaluatingExtension){ imgsrc='db:extension-'+extname+':'+name+'.jpg'; } else{ imgsrc='ext:'+extname+'/'+name+'.jpg'; } var character=[info.sex,info.group,info.hp,info.skills||[],[imgsrc]]; if(info.tags){ character[4]=character[4].concat(info.tags); } lib.character[name]=character; var packname='mode_extension_'+extname; if(!lib.characterPack[packname]){ lib.characterPack[packname]={}; } lib.translate[name]=info.translate; lib.characterPack[packname][name]=character; lib.translate[packname+'_character_config']=extname; }, addCharacterPack:function(pack,packagename){ var extname=_status.extension||'扩展'; packagename=packagename||extname; for(var i in pack){ if(i=='mode'||i=='forbid') continue; for(var j in pack[i]){ if(i=='character'){ if(!pack[i][j][4]){ pack[i][j][4]=[]; } var imgsrc; if(_status.evaluatingExtension){ imgsrc='db:extension-'+extname+':'+j+'.jpg'; } else{ imgsrc='ext:'+extname+'/'+j+'.jpg'; } pack[i][j][4].push(imgsrc); if(pack[i][j][4].contains('boss')|| pack[i][j][4].contains('hiddenboss')){ lib.config.forbidai.add(j); } if(lib.config.forbidai_user&&lib.config.forbidai_user.contains(j)){ lib.config.forbidai.add(j); } for(var l=0;lnum){ list.splice(num); } game.saveConfig('recentCharacter',list,true); }, createCard:function(name,suit,number,nature){ if(typeof name=='object'){ nature=name.nature; number=name.number; suit=name.suit; name=name.name; } if(typeof name!='string'){ name='sha'; } var noclick=false; if(suit=='noclick'){ noclick=true; suit=null; } if(!suit&&lib.card[name].cardcolor){ suit=lib.card[name].cardcolor; } if(!nature&&lib.card[name].cardnature){ nature=lib.card[name].cardnature; } if(typeof suit!='string'){ suit=['heart','diamond','club','spade'].randomGet(); } else if(suit=='black'){ suit=Math.random()<0.5?'club':'spade'; } else if(suit=='red'){ suit=Math.random()<0.5?'diamond':'heart'; } if(typeof number!='number'&&typeof number!='string'){ number=Math.ceil(Math.random()*13); } var card; if(noclick){ card=ui.create.card(ui.special,'noclick',true); } else{ card=ui.create.card(ui.special); } card.storage.vanish=true; return card.init([suit,number,name,nature]); }, createCard2:function(){ var card=game.createCard.apply(this,arguments); delete card.storage.vanish; return card; }, forceOver:function(bool,callback){ _status.event.next.length=0; var next=game.createEvent('finish_game'); next.bool=bool; next.callback=callback; next.setContent('forceOver'); if(_status.paused){ game.uncheck(); game.resume(); } }, over:function(result){ if(_status.over) return; if(game.me._trueMe) game.swapPlayer(game.me._trueMe); var i,j,k,num,table,tr,td,dialog; _status.over=true; ui.control.show(); ui.clear(); game.stopCountChoose(); if(ui.time3){ clearInterval(ui.time3.interval); } if((game.layout=='long2'||game.layout=='nova')&&!game.chess){ ui.arena.classList.add('choose-character'); ui.me.hide(); ui.mebg.hide() ui.autonode.hide(); if(lib.config.radius_size!='off'){ ui.historybar.style.borderRadius='0 0 0 4px'; } } if(game.online){ var dialog=ui.create.dialog(); dialog.noforcebutton=true; dialog.content.innerHTML=result; dialog.forcebutton=true; var result2=arguments[1]; if(result2==true){ dialog.content.firstChild.innerHTML='战斗胜利'; } else if(result2==false){ dialog.content.firstChild.innerHTML='战斗失败'; } ui.update(); dialog.add(ui.create.div('.placeholder')); for(var i=0;i'+get.translation(game.players[i])+''); dialog.addSmall(hs); } } for(var j=0;j'+get.translation(game.dead[j])+''); dialog.addSmall(hs); } } dialog.add(ui.create.div('.placeholder.slim')); if(lib.config.background_audio){ if(result2===true){ game.playAudio('effect','win'); } else if(result2===false){ game.playAudio('effect','lose'); } else{ game.playAudio('effect','tie'); } } if(!ui.exit){ ui.create.exit(); } if(ui.giveup){ ui.giveup.remove(); delete ui.giveup; } if(game.servermode){ ui.exit.firstChild.innerHTML='返回房间'; setTimeout(function(){ ui.exit.firstChild.innerHTML='退出房间'; _status.roomtimeout=true; lib.config.reconnect_info[2]=null; game.saveConfig('reconnect_info',lib.config.reconnect_info); },10000); } if(ui.tempnowuxie){ ui.tempnowuxie.close(); delete ui.tempnowuxie; } if(ui.auto) ui.auto.hide(); if(ui.wuxie) ui.wuxie.hide(); if(game.getIdentityList){ for(var i=0;i40){ mmr=40; } else if(mmr<10){ mmr=10; } dialog.add(ui.create.div('','获得 '+mmr+' 积分')); } else{ mmr=-30+Math.round(mmr/2); if(mmr>-20){ mmr=-20; } else if(mmr<-35){ mmr=-35; } if(lib.storage.ladder.current<900){ mmr=Math.round(mmr/4); } else if(lib.storage.ladder.current<1400){ mmr=Math.round(mmr/2); } else if(lib.storage.ladder.current<2000){ mmr=Math.round(mmr/1.5); } else if(lib.storage.ladder.current>2500){ mmr=Math.round(mmr*1.5); } dialog.add(ui.create.div('','失去 '+(-mmr)+' 积分')); } if(_status.ladder_tmp){ lib.storage.ladder.current+=40; delete _status.ladder_tmp; } lib.storage.ladder.current+=mmr; if(lib.storage.ladder.top'+get.translation(game.players[i])+''); dialog.addSmall(hs); } } for(var i=0;i'+get.translation(game.dead[i])+''); dialog.addSmall(hs); } } dialog.add(ui.create.div('.placeholder.slim')); game.addVideo('over',null,dialog.content.innerHTML); var vinum=parseInt(lib.config.video); if(!_status.video&&vinum&&game.getVideoName&&window.indexedDB&&_status.videoInited){ var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); var videos=lib.videos.slice(0); for(var i=0;i=vinum){ var toremove=videos.pop(); lib.videos.remove(toremove); store.delete(toremove.time); } else{ break; } } var me=game.me||game.players[0]; if(!me) return; var newvid={ name:game.getVideoName(), mode:lib.config.mode, video:lib.video, win:result=='战斗胜利', name1:me.name1||me.name, name2:me.name2, time:lib.getUTC(new Date()) }; var modecharacters=lib.characterPack['mode_'+get.mode()]; if(modecharacters){ if(get.mode()=='guozhan'){ if(modecharacters[newvid.name1]){ if(newvid.name1.indexOf('gz_shibing')==0){ newvid.name1=newvid.name1.slice(3,11); } else{ newvid.name1=newvid.name1.slice(3); } } if(modecharacters[newvid.name2]){ if(newvid.name2.indexOf('gz_shibing')==0){ newvid.name2=newvid.name2.slice(3,11); } else{ newvid.name2=newvid.name2.slice(3); } } } else{ if(modecharacters[newvid.name1]){ newvid.name1=get.mode()+'::'+newvid.name1; } if(modecharacters[newvid.name2]){ newvid.name2=get.mode()+'::'+newvid.name2; } } } if(newvid.name1&&newvid.name1.indexOf('subplayer_')==0){ newvid.name1=newvid.name1.slice(10,newvid.name1.lastIndexOf('_')); } if(newvid.name2&&newvid.name2.indexOf('subplayer_')==0){ newvid.name1=newvid.name2.slice(10,newvid.name1.lastIndexOf('_')); } lib.videos.unshift(newvid); store.put(newvid); ui.create.videoNode(newvid,true); } // _status.auto=false; if(ui.auto){ // ui.auto.classList.remove('glow'); ui.auto.hide(); } if(ui.wuxie) ui.wuxie.hide(); if(ui.giveup){ ui.giveup.remove(); delete ui.giveup; } if(lib.config.test_game&&!_status.connectMode){ if(typeof lib.config.test_game!=='string'){ switch(lib.config.mode){ case 'identity':game.saveConfig('mode','guozhan');break; case 'guozhan':game.saveConfig('mode','versus');break; case 'versus':game.saveConfig('mode','boss');break; case 'boss':game.saveConfig('mode','chess');break; case 'chess':game.saveConfig('mode','stone');break; case 'stone':game.saveConfig('mode','identity');break; } } setTimeout(game.reload,500); } if(game.controlOver){ game.controlOver();return; } if(!_status.brawl){ if(lib.config.mode=='boss'){ ui.create.control('再战',function(){ var pointer=game.boss; var map={boss:game.me==game.boss,links:[]}; for(var iwhile=0;iwhile<10;iwhile++){ pointer=pointer.nextSeat; if(pointer==game.boss){ break; } if(!pointer.side){ map.links.push(pointer.name); } } game.saveConfig('continue_name_boss',map); game.saveConfig('mode',lib.config.mode); localStorage.setItem(lib.configprefix+'directstart',true); game.reload(); }); } else if(lib.config.mode=='versus'){ if(_status.mode=='standard'||_status.mode=='three'){ ui.create.control('再战',function(){ game.saveConfig('continue_name_versus'+(_status.mode=='three'?'_three':''),{ friend:_status.friendBackup, enemy:_status.enemyBackup, color:_status.color }); game.saveConfig('mode',lib.config.mode); localStorage.setItem(lib.configprefix+'directstart',true); game.reload(); }); } } else if(!_status.connectMode&&get.config('continue_game')&&!ui.continue_game&&!_status.brawl&&!game.no_continue_game){ ui.continue_game=ui.create.control('再战',game.reloadCurrent); } } if(!ui.restart){ if(game.onlineroom&&typeof game.roomId=='string'){ ui.restart=ui.create.control('restart',function(){ game.broadcastAll(function(){ if(ui.exit){ ui.exit.stay=true; ui.exit.firstChild.innerHTML='返回房间'; } }); game.saveConfig('tmp_owner_roomId',game.roomId); setTimeout(game.reload,100); }); } else{ ui.restart=ui.create.control('restart',game.reload); } } if(ui.tempnowuxie){ ui.tempnowuxie.close(); delete ui.tempnowuxie; } if(ui.revive){ ui.revive.close(); delete ui.revive; } if(ui.swap){ ui.swap.close(); delete ui.swap; } for(var i=0;i0){ var next=event.next.shift(); if(next.player&&next.player.skipList.contains(next.name)){ event.trigger(next.name+'Skipped'); next.player.skipList.remove(next.name); if(lib.phaseName.contains(next.name)) next.player.getHistory('skipped').add(next.name); } else{ next.parent=event; _status.event=next; } } else if(event.finished){ if(event._triggered==1){ if(event.type=='card') event.trigger('useCardToOmitted'); event.trigger(event.name+'Omitted'); event._triggered=4; } else if(event._triggered==2){ if(event.type=='card') event.trigger('useCardToEnd'); event.trigger(event.name+'End'); event._triggered=3; } else if(event._triggered==3){ if(event.type=='card') event.trigger('useCardToAfter'); event.trigger(event.name+'After'); event._triggered++; } else if(event.after&&event.after.length){ var next=event.after.shift(); if(next.player&&next.player.skipList.contains(next.name)){ event.trigger(next.name+'Skipped'); next.player.skipList.remove(next.name); if(lib.phaseName.contains(next.name)) next.player.getHistory('skipped').add(next.name) } else{ next.parent=event; _status.event=next; } } else{ if(event.parent){ if(event.result){ event.parent._result=event.result; } _status.event=event.parent; } else{ return; } } } else{ if(event._triggered==0){ if(event.type=='card') event.trigger('useCardToBefore'); event.trigger(event.name+'Before'); event._triggered++; } else if(event._triggered==1){ if(event.type=='card') event.trigger('useCardToBegin'); if(event.name=='phase'&&!event._begun){ var next=game.createEvent('phasing',false,event); next.player=event.player; next.skill=event.skill; next.setContent('phasing'); event._begun=true; } else{ event.trigger(event.name+'Begin'); event._triggered++; } } else{ if(player&&player.classList.contains('dead')&&!event.forceDie&&event.name!='phaseLoop'){ game.broadcastAll(function(){ while(_status.dieClose.length){ _status.dieClose.shift().close(); } }); if(event._oncancel){ event._oncancel(); } event.finish(); } else if(player&&player.removed&&event.name!='phaseLoop'){ event.finish(); } else if(player&&player.isOut()&&event.name!='phaseLoop'&&!event.includeOut){ if(event.name=='phase'&&player==_status.roundStart&&!event.skill){ _status.roundSkipped=true; } event.finish(); } else{ if(_status.withError||lib.config.compatiblemode||(_status.connectMode&&!lib.config.debug)){ try{ event.content(event,step,source,player,target,targets, card,cards,skill,forced,num,trigger,result, _status,lib,game,ui,get,ai); } catch(e){ game.print('游戏出错:'+event.name); game.print(e.toString()); console.log(e); } } else{ event.content(event,step,source,player,target,targets, card,cards,skill,forced,num,trigger,result, _status,lib,game,ui,get,ai); } } event.step++; } } } }, pause:function(){ clearTimeout(_status.timeout); _status.paused=true; }, pause2:function(){ if(_status.connectMode) return; _status.paused2=true; }, resume:function(){ if(_status.paused){ if(!_status.noclearcountdown){ game.stopCountChoose(); } _status.paused=false; delete _status.waitingForTransition; game.loop(); } }, resume2:function(){ if(_status.connectMode) return; if(_status.paused2){ _status.paused2=false; game.loop(); } }, delaye:function(){ var next=game.createEvent('delay',false); next.setContent('delay'); next._args=Array.from(arguments); return next; }, delayex:function(){ var next=game.createEvent('delayx',false); next.setContent('delay'); next._args=Array.from(arguments); return next; }, delay:function(time,time2){ if(_status.paused) return; game.pause(); if(typeof time!='number') time=1; if(typeof time2!='number') time2=0; time=time*lib.config.duration+time2; if(lib.config.speed=='vvfast') time/=3; _status.timeout=setTimeout(game.resume,time); }, delayx:function(time,time2){ if(typeof time!='number') time=1; switch(lib.config.game_speed){ case 'vslow':time*=2.5;break; case 'slow':time*=1.5;break; case 'fast':time*=0.7;break; case 'vfast':time*=0.4;break; case 'vvfast':time*=0.2;break; } return game.delay(time,time2); }, check:function(event){ var i,j,range; if(event==undefined) event=_status.event; event._checked=true; var custom=event.custom||{}; var ok=true,auto=true; var player=event.player; var auto_confirm=lib.config.auto_confirm; var players=game.players.slice(0); if(event.deadTarget) players.addArray(game.dead); if(!event.filterButton&&!event.filterCard&&!event.filterTarget&&(!event.skill||!event._backup)){ if(event.choosing){ _status.imchoosing=true; } return; } player.node.equips.classList.remove('popequip'); if(event.filterButton){ var dialog=event.dialog; range=get.select(event.selectButton); var selectableButtons=false; if(event.forceAuto&&ui.selected.buttons.length==range[1]) auto=true; else if(range[0]!=range[1]||range[0]>1) auto=false; for(i=0;i-1&&!lib.config.compatiblemode){ event._cardChoice=[]; firstCheck=true; } if(event.isMine()&&event.name=='chooseToUse'&&event.parent.name=='phaseUse'&&!event.skill&& !event._targetChoice&&!firstCheck&&window.Map&&!lib.config.compatiblemode){ event._targetChoice=new Map(); for(var i=0;i1) auto=false; for(i=0;i1) auto=false; for(i=0;i7){ nochess=false; } else if(players[i].isOut()){ nochess=false; } else if(event._targetChoice&&event._targetChoice.has(card)){ var targetChoice=event._targetChoice.get(card); if(!Array.isArray(targetChoice)||!targetChoice.contains(players[i])){ nochess=false; } } else if(!event.filterTarget(card,player,players[i])){ nochess=false; } if(nochess){ if(ui.selected.targets.length=info.usable) enable=false; if(info.chooseButton&&_status.event.noButton) enable=false; if(info.round&&(info.round-(game.roundNumber-player.storage[skills2[i]+'_roundcount'])>0)) enable=false; } if(enable){ if(event.isMine()||!event._aiexclude.contains(skills2[i])){ skills.add(skills2[i]); } event._skillChoice.add(skills2[i]); } } } var globalskills=[]; var globallist=lib.skill.global.slice(0); game.expandSkills(globallist); for(var i=0;i7){ players[i].node.action.classList.add('thunder'); } else{ players[i].node.action.classList.remove('thunder'); } } } } if(ok&&(!event.filterOk||event.filterOk())&&auto&&(auto_confirm||(skillinfo&&skillinfo.direct))&&(!_status.mousedragging||!_status.mouseleft)&& !_status.mousedown&&!_status.touchnocheck){ if(ui.confirm){ if(!skillinfo||!skillinfo.preservecancel){ ui.confirm.close(); } } if(skillinfo&&skillinfo.preservecancel&&!ui.confirm){ ui.create.confirm('c'); } if(event.skillDialog==true) event.skillDialog=false; ui.click.ok(); _status.mousedragging=null; } else{ ui.arena.classList.add('selecting'); if(event.filterTarget&&(!event.filterCard||!event.position||(typeof event.position=='string'&&event.position.indexOf('e')==-1))){ ui.arena.classList.add('tempnoe'); } game.countChoose(); if(!_status.noconfirm&&!_status.event.noconfirm){ if(!_status.mousedown||_status.mouseleft){ var str=''; if(ok&&(!event.filterOk||event.filterOk())) str+='o'; if(!event.forced&&!event.fakeforce&&get.noSelected()) str+='c'; ui.create.confirm(str); } } } if(ui.confirm&&ui.confirm.lastChild.link=='cancel'){ if(_status.event.type=='phase'&&!_status.event.skill){ ui.confirm.lastChild.innerHTML='结束'; } else{ ui.confirm.lastChild.innerHTML='取消'; } } } return ok; }, uncheck:function(){ var i,j; if(game.chess){ var shadows=ui.chessContainer.getElementsByClassName('playergrid temp'); while(shadows.length){ shadows[0].remove(); } } var argc=arguments.length; var args=new Array(argc); for(var i=0;i=position){ return players[i]; } } return players[0]; }, loadModeAsync:function(name,callback){ window.game=game; var script=lib.init.js(lib.assetURL+'mode',name,function(){ if(!lib.config.dev) delete window.game; script.remove(); var content=lib.imported.mode[name]; delete lib.imported.mode[name]; if(get.is.empty(lib.imported.mode)){ delete lib.imported.mode; } callback(content); }); }, switchMode:function(name,configx){ if(!lib.layoutfixed.contains(name)){ if(lib.config.layout!=game.layout){ lib.init.layout(lib.config.layout); } else if(lib.config.mode=='brawl'){ if(lib.config.player_border=='normal'&&(game.layout=='long'||game.layout=='long2')){ ui.arena.classList.add('lslim_player'); } } } window.game=game; var script=lib.init.js(lib.assetURL+'mode',name,function(){ if(!lib.config.dev) delete window.game; script.remove(); var mode=lib.imported.mode; _status.sourcemode=lib.config.mode; lib.config.mode=name; var i,j,k; for(i in mode[lib.config.mode].element){ if(!lib.element[i]) lib.element[i]=[]; for(j in mode[lib.config.mode].element[i]){ if(j=='init'){ if(!lib.element[i].inits) lib.element[i].inits=[]; lib.element[i].inits.push(mode[lib.config.mode].element[i][j]); } else{ lib.element[i][j]=mode[lib.config.mode].element[i][j]; } } } for(i in mode[lib.config.mode].ai){ if(typeof mode[lib.config.mode].ai[i]=='object'){ if(ai[i]==undefined) ai[i]={}; for(j in mode[lib.config.mode].ai[i]){ ai[i][j]=mode[lib.config.mode].ai[i][j]; } } else{ ai[i]=mode[lib.config.mode].ai[i]; } } for(i in mode[lib.config.mode].ui){ if(typeof mode[lib.config.mode].ui[i]=='object'){ if(ui[i]==undefined) ui[i]={}; for(j in mode[lib.config.mode].ui[i]){ ui[i][j]=mode[lib.config.mode].ui[i][j]; } } else{ ui[i]=mode[lib.config.mode].ui[i]; } } for(i in mode[lib.config.mode].game){ game[i]=mode[lib.config.mode].game[i]; } for(i in mode[lib.config.mode].get){ get[i]=mode[lib.config.mode].get[i]; } if(game.onwash){ lib.onwash.push(game.onwash); delete game.onwash; } if(game.onover){ lib.onover.push(game.onover); delete game.onover; } lib.config.banned=lib.config[lib.config.mode+'_banned']||[]; lib.config.bannedcards=lib.config[lib.config.mode+'_bannedcards']||[]; for(i in mode[lib.config.mode]){ if(i=='element') continue; if(i=='game') continue; if(i=='ai') continue; if(i=='ui') continue; if(i=='get') continue; if(i=='config') continue; if(i=='start') continue; if(i=='startBefore') continue; if(lib[i]==undefined) lib[i]=(Array.isArray(mode[lib.config.mode][i]))?[]:{}; for(j in mode[lib.config.mode][i]){ lib[i][j]=mode[lib.config.mode][i][j]; } } // var pilecfg=lib.config.customcardpile[get.config('cardpilename')]; // if(pilecfg){ // lib.config.bannedpile=pilecfg[0]||{}; // lib.config.addedpile=pilecfg[1]||{}; // } _status.event={ finished:true, next:[], after:[] }; _status.paused=false; if(_status.connectMode&&lib.mode[name].connect){ game.saveConfig('connect_mode',name); game.clearConnect(); lib.configOL.mode=name; if(configx){ for(var i in configx){ lib.configOL[i]=configx[i]; } } else{ for(var i in lib.mode[name].connect){ if(i=='update') continue; lib.configOL[i.slice(8)]=get.config(i); } lib.configOL.zhinang_tricks=lib.config.connect_zhinang_tricks; lib.configOL.characterPack=lib.connectCharacterPack.slice(0); lib.configOL.cardPack=lib.connectCardPack.slice(0); for(var i=0;i3){ event.side=0; } event.goto(2); } else{ event.promptbar.hide(); event.side++; if(event.side>3){ event.side=0; } if(event.side>=2){ game.delay() } } 'step 4' if(event.checkredo()) return; if(event.skipnode) event.skipnode.delete(); if(event.replacenode) event.replacenode.delete(); if(event.reselectnode) event.reselectnode.delete(); if(event.freechoosenode) event.freechoosenode.delete(); for(var i=0;ievent.config.width){ event.avatars[i].classList.add('selecting'); } } var rand=[]; for(var i=0;i0){ str+=get.cnNumber(num)+'轮后'+(info.roundtext||'技能重置'); } else{ str+='技能可发动'; } return str; }, markcount:function(storage,player){ var num=round-(game.roundNumber-storage); if(num>0){ return num; } return 0; } }, trigger:{global:'roundStart'}, forced:true, popup:false, silent:true, content:function(){ var skill=event.name.slice(0,event.name.indexOf('_roundcount')); if(lib.skill[skill].round-(game.roundNumber-player.storage[event.name])>0){ player.updateMarks(); } else{ player.unmarkSkill(event.name); } } }; }(info.round,k)); lib.translate[k]=lib.translate[i]||''; lib.translate[k+'_bg']=lib.translate[i+'_bg']||lib.translate[k][0]; } if(info.marktext){ lib.translate[i+'_bg']=info.marktext; } if(info.silent){ if(!info.hasOwnProperty('forced')) info.forced=true; if(!info.hasOwnProperty('popup')) info.popup=false; } if(i[0]=='_'){ game.addGlobalSkill(i); } }, finishCards:function(){ _status.cardsFinished=true; var i,j,k; var mode=get.mode(); for(i in lib.card){ if(lib.translate[i+'_info_'+mode]){ lib.translate[i+'_info']=lib.translate[i+'_info_'+mode]; } else if(lib.translate[i+'_info_zhu']&&(mode=='identity'||(mode=='guozhan'&&_status.mode=='four'))){ lib.translate[i+'_info']=lib.translate[i+'_info_zhu']; } else if(lib.translate[i+'_info_combat']&&get.is.versus()){ lib.translate[i+'_info']=lib.translate[i+'_info_combat']; } var card=lib.card[i]; if(card.filterTarget&&card.selectTarget==undefined){ card.selectTarget=1; } if(card.autoViewAs){ if(!card.ai){ card.ai={}; } if(!card.ai.order){ card.ai.order=lib.card[card.autoViewAs].ai.order; if(!card.ai.order&&lib.card[card.autoViewAs].ai.basic){ card.ai.order=lib.card[card.autoViewAs].ai.basic.order; } } } if(card.type=='equip'){ if(card.enable==undefined) card.enable=true; if(card.selectTarget==undefined) card.selectTarget=-1; if(card.filterTarget==undefined) card.filterTarget=function(card,player,target){ if(player!=target) return false; return target.canEquip(card,true); }; if(card.modTarget==undefined) card.modTarget=true; if(card.allowMultiple==undefined) card.allowMultiple=false; if(card.content==undefined) card.content=lib.element.content.equipCard; if(card.toself==undefined) card.toself=true; if(card.ai==undefined) card.ai={basic:{}}; if(card.ai.basic==undefined) card.ai.basic={}; if(card.ai.result==undefined) card.ai.result={target:1.5}; if(card.ai.basic.order==undefined) card.ai.basic.order=function(card,player){ if(player&&player.hasSkillTag('reverseEquip')){ return 8.5-get.equipValue(card,player)/20; } else{ return 8+get.equipValue(card,player)/20; } }; if(card.ai.basic.useful==undefined) card.ai.basic.useful=2; if(card.subtype=='equip3'){ if(card.ai.basic.equipValue==undefined) card.ai.basic.equipValue=7; } else if(card.subtype=='equip4'){ if(card.ai.basic.equipValue==undefined) card.ai.basic.equipValue=4; } else{ if(card.ai.basic.equipValue==undefined) card.ai.basic.equipValue=1; } if(card.ai.basic.value==undefined) card.ai.basic.value=function(card,player,index,method){ if(!player.canEquip(card)) return 0.01; var value=0; var info=get.info(card); var current=player.getEquip(info.subtype); if(current&&card!=current){ value=get.value(current,player); } var equipValue=info.ai.equipValue; if(equipValue==undefined){ equipValue=info.ai.basic.equipValue; } if(typeof equipValue=='function'){ if(method=='raw') return equipValue(card,player); if(method=='raw2') return equipValue(card,player)-value; return Math.max(0.1,equipValue(card,player)-value); } if(typeof equipValue!='number') equipValue=0; if(method=='raw') return equipValue; if(method=='raw2') return equipValue-value; return Math.max(0.1,equipValue-value); } if(!card.ai.result.keepAI) card.ai.result.target=function(player,target,card){ return get.equipResult(player,target,card.name); }; } else if(card.type=='delay'){ if(card.enable==undefined) card.enable=true; if(card.filterTarget==undefined) card.filterTarget=lib.filter.judge; if(card.content==undefined) card.content=lib.element.content.addJudgeCard; if(card.allowMultiple==undefined) card.allowMultiple=false; } } for(i in lib.skill){ game.finishSkill(i); } }, checkMod:function(){ var name=arguments[arguments.length-2]; var skills=arguments[arguments.length-1]; if(skills.getSkills){ //if(name!='cardname') skills=skills.getSkills(); //else skills=skills.getSkills(null,false); skills=skills.getSkills(); } skills=skills.concat(lib.skill.global); game.expandSkills(skills); var arg=[],i,info; for(i=0;i'; str2+=get.translation(arguments[i]); } else if(itemtype=='cards'||itemtype=='card'||(typeof arguments[i]=='object'&&arguments[i]&&arguments[i].name)){ str+=''+get.translation(arguments[i])+''; str2+=get.translation(arguments[i]); } else if(typeof arguments[i]=='object'){ if(arguments[i]){ if(arguments[i].parentNode==ui.historybar){ logvid=arguments[i].logvid; } else{ str+=get.translation(arguments[i]); str2+=get.translation(arguments[i]); } } } else if(typeof arguments[i]=='string'){ if(arguments[i][0]=='【'&&arguments[i][arguments[i].length-1]=='】'){ str+=''+get.translation(arguments[i])+''; str2+=get.translation(arguments[i]); } else if(arguments[i][0]=='#'){ var color=''; switch(arguments[i][1]){ case 'b':color='blue';break; case 'y':color='yellow';break; case 'g':color='green';break; } str+=''+get.translation(arguments[i].slice(2))+''; str2+=get.translation(arguments[i].slice(2)); } else{ str+=get.translation(arguments[i]); str2+=get.translation(arguments[i]); } } else{ str+=arguments[i]; str2+=arguments[i]; } } var node=ui.create.div(); node.innerHTML=lib.config.log_highlight?str:str2; ui.sidebar.insertBefore(node,ui.sidebar.firstChild); game.addVideo('log',null,lib.config.log_highlight?str:str2); game.broadcast(function(str,str2){ game.log(lib.config.log_highlight?str:str2); },str,str2); if(!_status.video&&!game.online){ if(!logvid){ logvid=_status.event.getLogv(); } if(logvid){ game.logv(logvid,'
        '+lib.config.log_highlight?str:str2+'
        '); } } // if(lib.config.title) document.title=lib.config.log_highlight?str:str2; if(lib.config.show_log!='off'&&!game.chess){ var nodeentry=node.cloneNode(true); ui.arenalog.insertBefore(nodeentry,ui.arenalog.firstChild); if(!lib.config.clear_log){ while(ui.arenalog.childNodes.length&&ui.arenalog.scrollHeight>ui.arenalog.offsetHeight){ ui.arenalog.lastChild.remove(); } } if(!lib.config.low_performance){ nodeentry.style.transition='all 0s'; nodeentry.style.marginBottom=(-nodeentry.offsetHeight)+'px'; ui.refresh(nodeentry); nodeentry.style.transition=''; nodeentry.style.marginBottom=''; } if(lib.config.clear_log){ nodeentry.timeout=setTimeout(function(){ nodeentry.delete(); },1000); for(var i=0;i
      "\n}\n帮助内容将显示在菜单-选项-帮助中\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'; } }; var dashes={}; var createCode=function(str1,str2,sub,func,link,str){ var dash=ui.create.div('.menubutton.large.dashboard'); dashes[link]=dash; sub.appendChild(dash); dash.listen(func); dash.link=link; ui.create.div('',str1,dash); ui.create.div('',str2,dash); var container=ui.create.div('.popup-container.editor'); var editorpage=ui.create.div(container); var discardConfig=ui.create.div('.editbutton','取消',editorpage,function(){ ui.window.classList.remove('shortcutpaused'); ui.window.classList.remove('systempaused'); container.delete(null); delete window.saveNonameInput; }); var saveInput=function(){ var code; if(container.editor){ code=container.editor.getValue(); } else if(container.textarea){ code=container.textarea.value; } try{ if(link=='content'||link=='precontent'){ var func=null; eval('func='+code); if(typeof func!='function'){ throw('err'); } } else if(link=='config'){ var config=null; eval(code); if(config==null||typeof config!='object'){ throw('err'); } } else if(link=='help'){ var help=null; eval(code); if(help==null||typeof help!='object'){ throw('err'); } } } catch(e){ if(e=='err'){ alert('代码格式有错误,请对比示例代码仔细检查'); } else{ alert('代码语法有错误,请仔细检查('+e+')') } return; } dash4.link.classList.add('active'); ui.window.classList.remove('shortcutpaused'); ui.window.classList.remove('systempaused'); container.delete(); container.code=code; page.content[link]=code; delete window.saveNonameInput; }; var saveConfig=ui.create.div('.editbutton','保存',editorpage,saveInput); var editor=ui.create.div(editorpage); container.code=str; dash.editor=editor; dash.node=container; dash.saveInput=saveInput; page.content[link]=str; }; var clickCode=function(){ var node=this.node; ui.window.classList.add('shortcutpaused'); ui.window.classList.add('systempaused'); window.saveNonameInput=this.saveInput; if(node.aced){ ui.window.appendChild(node); node.editor.setValue(node.code,1); } else if(lib.device=='ios'){ ui.window.appendChild(node); if(!node.textarea){ var textarea=document.createElement('textarea'); this.editor.appendChild(textarea); node.textarea=textarea; lib.setScroll(textarea); } node.textarea.value=node.code; } else{ var editor=this.editor; var aceReady=function(){ ui.window.appendChild(node); var mirror = window.CodeMirror(editor, { value:node.code, mode:"javascript", lineWrapping:!lib.config.touchscreen&&lib.config.mousewheel, lineNumbers:true, indentUnit:4, autoCloseBrackets:true, theme:'mdn-like' }); lib.setScroll(editor.querySelector('.CodeMirror-scroll')); node.aced=true; node.editor=mirror; } if(!window.ace){ lib.init.js(lib.assetURL+'game','codemirror',aceReady); lib.init.css(lib.assetURL+'layout/default','codemirror'); } else{ aceReady(); } } }; page.content={} createCode('主','主代码',page,clickCode,'content','function(config,pack){\n \n}\n\n\/*\n函数执行时机为游戏数据加载之后、界面加载之前\n参数1扩展选项(见选项代码);参数2为扩展定义的武将、卡牌和技能等(可在此函数中修改)\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'); createCode('启','启动代码',page,clickCode,'precontent','function(){\n \n}\n\n\/*\n函数执行时机为游戏数据加载之前,且不受禁用扩展的限制\n除添加模式外请慎用\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'); createCode('选','选项代码',page,clickCode,'config','config={\n \n}\n\n\/*\n示例:\nconfig={\n switcher_example:{\n name:"示例列表选项",\n init:"3",\n item:{"1":"一","2":"二","3":"三"}\n },\n toggle_example:{\n name:"示例开关选项",\n init:true\n }\n}\n此例中传入的主代码函数的默认参数为{switcher_example:"3",toggle_example:true}\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'); createCode('帮','帮助代码',page,clickCode,'help','help={\n \n}\n\n\/*\n示例:\nhelp={\n "帮助条目":"
      • 列表1-条目1
      • 列表1-条目2
      1. 列表2-条目1
      2. 列表2-条目2
    "\n}\n帮助内容将显示在菜单-选项-帮助中\n导出时本段代码中的换行、缩进以及注释将被清除\n*\/'); return page; }()); createDash('将','编辑武将',dash1); createDash('卡','编辑卡牌',dash2); createDash('技','编辑技能',dash3); createDash('码','编辑代码',dash4); }()); (function(){ var page=ui.create.div(''); var node=ui.create.div('.menubutton.large','获取扩展',start.firstChild,clickMode); node.link=page; node.mode='get'; page.listen(function(){ if(!page.currenttimeout){ var active=page.querySelector('.videonode.current'); if(active){ active.classList.remove('current'); } } }); var importextensionexpanded=false; page.style.paddingBottom='10px'; var importExtension; var extensionnode=ui.create.div('.config.more','导入扩展
    >
    ',page,function(){ if(importextensionexpanded){ this.classList.remove('on'); importExtension.style.display='none'; } else{ this.classList.add('on'); importExtension.style.display=''; } importextensionexpanded=!importextensionexpanded; }); importExtension=ui.create.div('.new_character.export.import',page); importExtension.style.marginLeft='5px'; importExtension.style.marginTop='5px'; importExtension.style.marginBottom='5px'; importExtension.style.display='none'; importExtension.style.width='100%'; importExtension.style.textAlign='left'; ui.create.div('','',importExtension); ui.create.div('.config','修改下载地址',page,function(){ alert('您可以在“设置→通用→获取扩展地址”中,修改下载扩展时所采用的地址。') }) var extensionURL; var source=lib.config.extension_sources,index=lib.config.extension_source; if(source&&source[index]) extensionURL=source[index]; else extensionURL=lib.updateURL.replace(/noname/g,'noname-extension')+'/master/'; var reloadnode=ui.create.div('.config.toggle.pointerdiv','重新启动',page,game.reload); reloadnode.style.display='none'; var placeholder=ui.create.div('.config.toggle',page); placeholder.style.height=0; placeholder.style.marginTop='5px'; importExtension.firstChild.lastChild.onclick=function(){ var fileToLoad=this.previousSibling.files[0]; if(fileToLoad){ var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent) { var finishLoad=function(){ extensionnode.innerHTML='导入成功,3秒后将重启'; setTimeout(function(){ extensionnode.innerHTML='导入成功,2秒后将重启'; setTimeout(function(){ extensionnode.innerHTML='导入成功,1秒后将重启'; setTimeout(game.reload,1000); },1000); },1000); }; var data = fileLoadedEvent.target.result; if(game.importExtension(data,finishLoad)!==false){ importExtension.style.display='none'; } }; fileReader.readAsArrayBuffer(fileToLoad, "UTF-8"); } } var clickExtension=function(){ var active=this.parentNode.querySelector('.videonode.current'); if(active&&active!=this){ active.classList.remove('current'); } this.classList.add('current'); clearTimeout(page.currenttimeout); page.currenttimeout=setTimeout(function(){ delete page.currenttimeout; },200); }; var downloadExtension=function(e){ if((this.innerHTML!='下载扩展'&&this.innerHTML!='更新扩展')||!window.JSZip) return; this.classList.remove('update'); if(e){ e.stopPropagation(); } node.updated=true; var that=this; var list=[]; var size=parseFloat(this.info.size)||0; if(size){ if(this.info.size.indexOf('MB')!=-1){ size*=1024*1024; } else if(this.info.size.indexOf('KB')!=-1){ size*=1024; } } this.innerHTML='正在下载
    正在下载
    '; this.classList.add('nopointer'); this.classList.add('button-downloading'); var progress=ui.create.div('.button-progress',this); ui.create.div(progress); var url=extensionURL+this.info.name+'.zip'; var onprogress=function(byte,total){ if(total){ size=total; } if(byte==-1){ byte=size; } progress.firstChild.style.width=Math.round(100*byte/size)+'%'; }; var files=this.info.files||[]; for(var i=0;i('+list[i].size+')',node); ui.create.div('.text',list[i].intro,node); var download=ui.create.div('.menubutton.text.active','下载扩展',node.firstChild); if(game.download){ if(list[i].netdisk){ var linknode=ui.create.div('.text',node); ui.create.node('span.hrefnode','网盘链接',function(){ game.open(this.link); },linknode).link=list[i].netdisk; if(list[i].forum){ ui.create.node('span',linknode).style.marginRight='10px'; ui.create.node('span.hrefnode','参与讨论',function(){ game.open(this.link); },linknode).link=list[i].forum; } } else if(list[i].forum){ var linknode=ui.create.div('.text',node); ui.create.node('span.hrefnode','参与讨论',function(){ game.open(this.link); },linknode).link=list[i].forum; } download.listen(downloadExtension); if(lib.config.extensions.contains(list[i].name)){ download.classList.remove('active'); if(lib.extensionPack[list[i].name]&&lib.extensionPack[list[i].name].version==list[i].version){ download.classList.add('transparent2'); download.classList.remove('active'); download.innerHTML='已安装'; } else if(lib.config['extension_'+list[i].name+'_version']!=list[i].version){ download.innerHTML='更新扩展'; download.classList.add('highlight'); download.classList.add('update'); } else{ download.classList.add('transparent2'); download.classList.remove('active'); download.innerHTML='已安装'; } } download.info=list[i]; } else{ if(list[i].forum){ var linknode=ui.create.div('.text',node); ui.create.node('span',linknode); ui.create.node('span.hrefnode','参与讨论',function(){ game.open(this.link); },linknode).link=list[i].forum; } download.listen(function(){ game.open(this.link); }); download.link=list[i].netdisk; } } }; window.extension={}; if(game.download){ lib.init.req(extensionURL+'catalog.js',function(){ try{ eval(this.responseText); // if(!window.noname_extension_list){ // throw('err'); // } } catch(e){ delete window.extension; loading.innerHTML='连接失败'; return; } loaded(); },function(){ delete window.extension; loading.innerHTML='连接失败'; }); } else{ lib.init.req(extensionURL.replace(/raw\.githubusercontent\.com/,'rawgit.com')+'catalog.js',function(){ try{ eval(this.responseText); } catch(e){ delete window.extension; loading.innerHTML='连接失败'; return; } loaded(); },function(){ delete window.extension; loading.innerHTML='连接失败'; }); } }; }()); var active=start.firstChild.querySelector('.active'); if(!active){ active=start.firstChild.firstChild; active.classList.add('active'); } rightPane.appendChild(active.link); updateNodes(); }()); (function(){ if(connectMenu) return; var start=menuxpages.shift(); var rightPane=start.lastChild; var cheatButton=ui.create.div('.menubutton.round.highlight','作',start); cheatButton.style.display='none'; var runButton=ui.create.div('.menubutton.round.highlight','执',start); runButton.style.display='none'; var clearButton=ui.create.div('.menubutton.round.highlight','清',start); clearButton.style.display='none'; clearButton.style.left='275px'; var playButton=ui.create.div('.menubutton.round.highlight.hidden','播',start); playButton.style.display='none'; playButton.style.left='215px'; playButton.style.transition='opacity 0.3s'; var deleteButton=ui.create.div('.menubutton.round.highlight.hidden','删',start); deleteButton.style.display='none'; deleteButton.style.left='275px'; deleteButton.style.transition='opacity 0.3s'; var saveButton=ui.create.div('.menubutton.round.highlight.hidden','存',start); saveButton.style.display='none'; saveButton.style.transition='opacity 0.3s'; var clickMode=function(){ if(this.classList.contains('off')) return; var active=this.parentNode.querySelector('.active'); if(active===this){ return; } if(active){ active.classList.remove('active'); active.link.remove(); } active=this; this.classList.add('active'); rightPane.appendChild(this.link); if(this.type=='cheat'){ cheatButton.style.display=''; } else{ cheatButton.style.display='none'; } if(this.type=='cmd'){ runButton.style.display=''; clearButton.style.display=''; } else{ runButton.style.display='none'; clearButton.style.display='none'; } if(this.type=='video'){ playButton.style.display=''; saveButton.style.display=''; deleteButton.style.display=''; } else{ playButton.style.display='none'; saveButton.style.display='none'; deleteButton.style.display='none'; } }; ui.click.consoleMenu=function(){ ui.click.menuTab('其它'); clickMode.call(ui.commandnode); }; (function(){ var page=ui.create.div(''); var node=ui.create.div('.menubutton.large','更新',start.firstChild,clickMode); node.link=page; page.classList.add('menu-help'); var ul=document.createElement('ul'); var li1=document.createElement('li'); var li2=document.createElement('li'); var li3=document.createElement('li'); var trimurl=function(str){ if(str==lib.updateURLS.github){ return 'GitHub'; } if(str==lib.updateURLS.coding){ return 'Coding'; } var index; index=str.indexOf('://'); if(index!=-1){ str=str.slice(index+3); } index=str.indexOf('/'); if(index!=-1){ str=str.slice(0,index); } if(str.length>15){ var list=str.split('.'); if(list.length>1){ list.shift(); } str=list[0]; for(var i=1;i15){ var list=str.split('.'); if(list.length>1){ list.pop(); } str=list[0]; for(var i=1;i

    '; li2.innerHTML='素材版本:'+(lib.config.asset_version||'无')+'

    '; li3.innerHTML='更新地址:'+trimurl(lib.config.updateURL||lib.updateURL)+'

    '; li3.style.whiteSpace='nowrap'; li3.style.display='none';// coding var button1,button2,button3,button4,button5; game.checkForUpdate=function(forcecheck,dev){ if(!dev&&button1.disabled){ return; } else if(dev&&button3.disabled){ return; } else if(!game.download){ alert('此版本不支持游戏内更新,请手动更新'); return; } else{ if(dev){ button3.innerHTML='正在检查更新'; } else{ button1.innerHTML='正在检查更新'; } button3.disabled=true; button1.disabled=true; var goupdate=function(files,update){ lib.version=update.version; if(update.dev&&!lib.config.debug){ dev='nodev'; } lib.init.req('game/source.js',function(){ try{ eval(this.responseText); if(!window.noname_source_list){ throw('err'); } } catch(e){ alert('更新地址有误'); console.log(e); return; } var updates=window.noname_source_list; delete window.noname_source_list; if(Array.isArray(files)){ files.add('game/update.js'); var files2=[]; for(var i=0;iversion1[i]){ files=false;break; } else if(version1[i]>version2[i]){ files=update.files.slice(0);break; } } if(files===null){ if(version1.length>=version2.length){ files=update.files.slice(0); } } } var str; if(dev){ str='开发版仅供测试使用,可能存在风险,是否确定更新?' } else{ str='有新版本'+update.version+'可用,是否下载?'; } if(navigator.notification&&navigator.notification.confirm){ var str2; if(dev){ str2=str; str='更新到开发版'; } else{ str2=update.changeLog[0]; for(var i=1;i>'); span1.style.fontSize='small'; span1.style.display='inline'; span1.toggle=function(){ if(!this.classList.toggle('on')){ game.saveConfig('asset_toggle_off',true); span2.style.display='none'; span2_br.style.display='none'; span2_check.style.display='none'; span3.style.display='none'; span3_br.style.display='none'; span3_check.style.display='none'; span4.style.display='none'; span4_br.style.display='none'; span4_check.style.display='none'; span5.style.display='none'; span5_br.style.display='none'; span5_check.style.display='none'; span6.style.display='none'; span6_br.style.display='none'; span6_check.style.display='none'; } else{ game.saveConfig('asset_toggle_off'); span2.style.display=''; span2_br.style.display=''; span2_check.style.display=''; span3.style.display=''; span3_br.style.display=''; span3_check.style.display=''; span4.style.display=''; span4_br.style.display=''; span4_check.style.display=''; span5.style.display=''; span5_br.style.display=''; span5_check.style.display=''; span6.style.display=''; span6_br.style.display=''; span6_check.style.display=''; } }; span1.listen(span1.toggle); li2.lastChild.appendChild(span1); var span6_br=ui.create.node('br'); li2.lastChild.appendChild(span6_br); var span5=ui.create.div('','图片素材(精简,126MB)'); span5.style.fontSize='small'; span5.style.lineHeight='16px'; var span5_check=document.createElement('input'); span5_check.type='checkbox'; span5_check.style.marginLeft='5px'; if(lib.config.asset_image){ span5_check.checked=true; } span5_check.onchange=function(){ game.saveConfig('asset_image',this.checked); } var span2_br=ui.create.node('br'); var span4=ui.create.div('','字体素材(48MB)'); span4.style.fontSize='small'; span4.style.lineHeight='16px'; li2.lastChild.appendChild(span4); var span4_check=document.createElement('input'); span4_check.type='checkbox'; span4_check.style.marginLeft='5px'; if(lib.config.asset_font){ span4_check.checked=true; } span4_check.onchange=function(){ game.saveConfig('asset_font',this.checked); } li2.lastChild.appendChild(span4_check); var span3_br=ui.create.node('br'); li2.lastChild.appendChild(span3_br); var span3=ui.create.div('','音效素材(125MB)'); span3.style.fontSize='small'; span3.style.lineHeight='16px'; li2.lastChild.appendChild(span3); var span3_check=document.createElement('input'); span3_check.type='checkbox'; span3_check.style.marginLeft='5px'; if(lib.config.asset_audio){ span3_check.checked=true; } span3_check.onchange=function(){ game.saveConfig('asset_audio',this.checked); } li2.lastChild.appendChild(span3_check); var span4_br=ui.create.node('br'); li2.lastChild.appendChild(span4_br); var span2=ui.create.div('','皮肤素材(351MB)'); span2.style.fontSize='small'; span2.style.lineHeight='16px'; li2.lastChild.appendChild(span2); var span2_check=document.createElement('input'); span2_check.type='checkbox'; span2_check.style.marginLeft='5px'; if(lib.config.asset_skin){ span2_check.checked=true; } span2_check.onchange=function(){ game.saveConfig('asset_skin',this.checked); } li2.lastChild.appendChild(span2_check); var span5_br=ui.create.node('br'); li2.lastChild.appendChild(span5_br); li2.lastChild.appendChild(span5); li2.lastChild.appendChild(span5_check); li2.lastChild.appendChild(span2_br); var span6=ui.create.div('','图片素材(完整,203MB)'); span6.style.fontSize='small'; span6.style.lineHeight='16px'; li2.lastChild.appendChild(span6); var span6_check=document.createElement('input'); span6_check.type='checkbox'; span6_check.style.marginLeft='5px'; if(lib.config.asset_full){ span6_check.checked=true; } span6_check.onchange=function(){ game.saveConfig('asset_full',this.checked); } li2.lastChild.appendChild(span6_check); span2.style.display='none'; span2_br.style.display='none'; span2_check.style.display='none'; span3.style.display='none'; span3_br.style.display='none'; span3_check.style.display='none'; span4.style.display='none'; span4_br.style.display='none'; span4_check.style.display='none'; span5.style.display='none'; span5_br.style.display='none'; span5_check.style.display='none'; span6.style.display='none'; span6_br.style.display='none'; span6_check.style.display='none'; ul.appendChild(li1); ul.appendChild(li2); ul.appendChild(li3); page.appendChild(ul); if(!lib.config.asset_toggle_off){ span1.toggle(); } }()); (function(){ var norow2=function(){ var node=currentrow1; if(!node) return false; return node.innerHTML=='横置'||node.innerHTML=='翻面'||node.innerHTML=='换人'||node.innerHTML=='复活'; }; var checkCheat=function(){ if(norow2()){ for(var i=0;i=0){ logindex--; if(logindex<0){ text2.value=''; } else{ text2.value=logs[logindex]; } } else{ text2.value=''; } } else if(text2.value.indexOf('无天使')!=-1&&(text2.value.indexOf('无神佛')!=-1||text2.value.indexOf('无神')!=-1&&text2.value.indexOf('无佛')!=-1)){ game.print('密码正确!欢迎来到死后世界战线!'); _status.keyVerified=true; text2.value=''; } else{ if(!game.observe&&!game.online){ try{ var value=text2.value.trim(); if(value.endsWith(";")) value=value.slice(0,-1).trim(); var result=fun(reg,value,_status,lib,game,ui,get,ai); game.print(result); } catch(e){ game.print(e); } } text2.value=''; } } text2.addEventListener('keydown',function(e){ if(e.keyCode==13){ runCommand(); } else if(e.keyCode==38){ if(logindex+1=0){ logindex--; if(logindex<0){ text2.value=''; } else{ text2.value=logs[logindex]; } } } }); page.appendChild(text2); game.print=function(){ var args=[].slice.call(arguments); var printResult=args.map(arg=>{ if(get.is.object(arg)||typeof arg=='function'){ var argi=get.stringify(arg); if(argi/*&&argi.length<5000*/){ return argi.replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); } else return arg.toString(); }else{ var str=String(arg); if (!/<[a-zA-Z]+[^>]*?\/?>.*?(?=<\/[a-zA-Z]+[^>]*?>|$)/.exec(str)) return String(arg) .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/'/g, '''); else return str; } }).join(' '); pre.innerHTML+=printResult+'
    '; text.scrollTop=text.scrollHeight; } if(_status.toprint){ for(var i=0;i<_status.toprint.length;i++){ game.print.apply(this,_status.toprint[i]); } delete _status.toprint; } runButton.listen(runCommand); clearButton.listen(function(){ pre.innerHTML=''; }); }()); (function(){ var page=ui.create.div(''); var node=ui.create.div('.menubutton.large','战绩',start.firstChild,clickMode); node.type='rec'; node.link=page; page.style.paddingBottom='10px'; var reset=function(){ if(this.innerHTML=='重置'){ this.innerHTML='确定'; var that=this; setTimeout(function(){ that.innerHTML='重置'; },1000); } else{ this.parentNode.previousSibling.remove(); this.parentNode.remove(); lib.config.gameRecord[this.parentNode.link]={data:{}}; game.saveConfig('gameRecord',lib.config.gameRecord); } } for(var i=0;i重置',page); item.style.height='auto'; item.lastChild.addEventListener('click',reset); item.lastChild.classList.add('pointerdiv'); item.link=lib.config.all.mode[i]; } } }()); (function(){ if(!window.indexedDB||window.nodb) return; var page=ui.create.div(''); var node=ui.create.div('.menubutton.large','录像',start.firstChild,clickMode); node.type='video'; node.link=page; var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); lib.videos=[]; store.openCursor().onsuccess=function(e){ var cursor=e.target.result; if(cursor){ lib.videos.push(cursor.value); cursor.continue(); } else{ lib.videos.sort(function(a,b){ return parseInt(b.time)-parseInt(a.time); }); var clickcapt=function(){ var current=this.parentNode.querySelector('.videonode.active'); if(current&¤t!=this){ current.classList.remove('active'); } if(this.classList.toggle('active')){ playButton.show(); deleteButton.show(); saveButton.show(); } else{ playButton.hide(); deleteButton.hide(); saveButton.hide(); } }; var staritem=function(){ this.parentNode.classList.toggle('starred'); var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); if(this.parentNode.classList.contains('starred')){ this.parentNode.link.starred=true; } else{ this.parentNode.link.starred=false; } store.put(this.parentNode.link); } var createNode=function(video,before){ var node=ui.create.div('.videonode.menubutton.large',clickcapt); node.link=video; var nodename1=ui.create.div('.menubutton.videoavatar',node); nodename1.setBackground(video.name1,'character'); if(video.name2){ var nodename2=ui.create.div('.menubutton.videoavatar2',node); nodename2.setBackground(video.name2,'character'); } var date=new Date(video.time); var str=date.getFullYear()+'.'+(date.getMonth()+1)+'.'+(date.getDate())+' '+ date.getHours()+':'; var minutes=date.getMinutes(); if(minutes<10){ str+='0'; } str+=minutes; ui.create.div('.caption',video.name[0],node); ui.create.div('.text',str+'
    '+video.name[1],node); if(video.win){ ui.create.div('.victory','胜',node); } if(before){ page.insertBefore(node,page.firstChild); } else{ page.appendChild(node); } ui.create.div('.video_star','★',node,staritem); if(video.starred){ node.classList.add('starred'); } } for(var i=0;i导入录像...',function(){ this.nextSibling.classList.toggle('hidden'); },page); importVideoNode.style.marginLeft='12px'; importVideoNode.style.marginTop='3px'; var importVideo=ui.create.div('.config.hidden',page); importVideo.style.whiteSpace='nowrap'; importVideo.style.marginBottom='80px'; importVideo.style.marginLeft='13px'; importVideo.style.width='calc(100% - 30px)'; importVideo.innerHTML=''+ ''; importVideo.lastChild.onclick=function(){ var fileToLoad = importVideo.firstChild.files[0]; var fileReader = new FileReader(); fileReader.onload = function(fileLoadedEvent) { var data = fileLoadedEvent.target.result; if(!data) return; try{ data=JSON.parse(lib.init.decode(data)); } catch(e){ console.log(e); alert('导入失败'); return; } var store=lib.db.transaction(['video'],'readwrite').objectStore('video'); var videos=lib.videos.slice(0); for(var i=0;i=parseInt(lib.config.video)&&videos.length){ var toremove=videos.pop(); lib.videos.remove(toremove); store.delete(toremove.time); for(var i=0;iposition2){ position.insertBefore(node,position.childNodes[position2]); } else{ position.appendChild(node); } } return node; }, giveup:function(){ if(ui.giveup) return; if(!lib.config.show_giveup) return; ui.giveup=ui.create.system('投降',function(){ var player=game.me; this.remove(); if(game.online){ game.send('giveup',player); } else{ _status.event.next.length=0; game.createEvent('giveup',false).set('includeOut',true).setContent(function(){ game.log(player,'投降'); player.popup('投降'); player.die('nosource').includeOut=true; }).player=player; } if(_status.paused&&_status.imchoosing&&!_status.auto){ ui.click.auto(); } },true,true); }, groupControl:function(dialog){ return ui.create.control('wei','shu','wu','qun','jin','western','key',function(link,node){ if(link=='全部'){ dialog.currentcapt=''; dialog.currentgroup=''; for(var i=0;ib?1:-1; }); if(!thisiscard){ namecapt.remove('自定义'); namecapt.push('newline'); for(var i in lib.characterDialogGroup){ namecapt.push(i); } } var newlined=false; var newlined2; var packsource; var clickCapt=function(e){ if(_status.dragged) return; if(dialog.currentcapt2=='最近'&&dialog.currentcaptnode2!=this&&!dialog.currentcaptnode2.inited){ dialog.currentcapt2=null; dialog.currentcaptnode2.classList.remove('thundertext'); dialog.currentcaptnode2.inited=true; dialog.currentcaptnode2=null; } if(this.alphabet){ if(this.classList.contains('thundertext')){ dialog.currentcapt=null; dialog.currentcaptnode=null; this.classList.remove('thundertext'); if(this.touchlink){ this.touchlink.classList.remove('active'); } for(var i=0;i0){ filternode.firstChild.style.top=(dh/2)+'px'; } else{ filternode.firstChild.style.top=''; } } else{ if(newlined2.style.display=='none'){ newlined2.style.display='block'; } else{ newlined2.style.display='none'; } } }); var packlist=[]; for(var i=0;ib?1:-1; } return aa>bb?1:-1; }); dialog=ui.create.dialog('hidden'); dialog.classList.add('noupdate'); dialog.classList.add('scroll1'); dialog.classList.add('scroll2'); dialog.classList.add('scroll3'); dialog.addEventListener(lib.config.touchscreen?'touchend':'mouseup',function(){ _status.clicked2=true; }); if(heightset){ dialog.style.height=((game.layout=='long2'||game.layout=='nova')?380:350)+'px'; dialog._scrollset=true; } dialog.getCurrentCapt=function(link,capt,noalph){ var currentcapt=noalph?this.currentcapt2:this.currentcapt; if(this.seperatelist&&noalph){ if(this.seperatelist[currentcapt].contains(link)) return capt; return null; } if(lib.characterDialogGroup[currentcapt]){ return lib.characterDialogGroup[currentcapt](link,capt); } if(lib.characterPack[currentcapt]){ if(lib.characterPack[currentcapt][link]){ return capt; } return null; } return this.currentcapt; } if(str){ dialog.add(str); } dialog.add(node); if(thisiscard){ if(seperate){ seperate=seperate(list); dialog.seperate=[]; dialog.seperatelist=seperate.list; if(dialog.seperatelist){ newlined=document.createElement('div'); newlined.style.marginTop='5px'; newlined.style.display='block'; newlined.style.fontFamily='xinwei'; if(get.is.phoneLayout()){ newlined.style.fontSize='32px'; } else{ newlined.style.fontSize='22px'; } newlined.style.textAlign='center'; node.appendChild(newlined); for(var i in dialog.seperatelist){ var span=document.createElement('span'); span.style.margin='3px'; span.innerHTML=i; span.link=i; span.seperate=true; span.addEventListener(lib.config.touchscreen?'touchend':'click',clickCapt); newlined.appendChild(span); } } for(var i in seperate){ if(i=='list') continue; var link=''; var linkcontent=seperate[i]; if(i.indexOf('_link:')!=-1){ link=i.slice(i.indexOf('_link:')+6); i=i.slice(0,i.indexOf('_link:')); } var nodesep=dialog.add(i); nodesep.link=link; dialog.seperate.push(nodesep); dialog.add([linkcontent,'vcard'],noclick); } } else{ dialog.add([list,'vcard'],noclick); } } else{ if(precharacter){ dialog.add([list,'precharacter'],noclick); } else if(characterx){ dialog.add([list,'characterx'],noclick); } else{ dialog.add([list,'character'],noclick); } } dialog.add(ui.create.div('.placeholder')); for(i=0;i