"use strict";
(function(){
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:[],
}],
};
var lib={
configprefix:'noname_0.9_',
versionOL:27,
updateURLS:{
coding:'https://nakamurayuri.coding.net/p/noname/d/noname/git/raw',
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:{},
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:[],
extensions:[],
extensionPack:{},
cardType:{},
hook:{globaltrigger:{},globalskill:{}},
hookmap:{},
imported:{},
layoutfixed:['chess','tafang','stone'],
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,
},
errstop:{
name:'出错时停止游戏',
init:false,
unfrequent:true
},
update_link:{
name:'更新地址',
init:'coding',
unfrequent:true,
item:{
coding:'Coding',
github:'GitHub',
},
onclick:function(item){
game.saveConfig('update_link',item);
lib.updateURL=lib.updateURLS[item]||lib.updateURLS.coding;
},
},
update:function(config,map){
if('ontouchstart' in document){
map.touchscreen.show();
}
else{
map.touchscreen.hide();
}
if(lib.device||lib.node){
map.auto_check_update.show();
}
else{
map.auto_check_update.hide();
}
if(lib.device){
map.enable_vibrate.show();
map.keep_awake.show();
}
else{
map.enable_vibrate.hide();
map.keep_awake.hide();
}
// if(config.enable_pressure){
// map.pressure_click.show();
// if(lib.device){
// map.pressure_taptic.show();
// }
// else{
// map.pressure_taptic.hide();
// }
// }
// else{
// map.pressure_click.hide();
// map.pressure_taptic.hide();
// }
if(lib.config.touchscreen){
map.mousewheel.hide();
map.hover_all.hide();
map.hover_handcard.hide();
map.hoveration.hide();
map.right_info.hide();
map.right_click.hide();
map.longpress_info.show();
map.swipe.show();
if(lib.config.swipe){
map.swipe_up.show();
map.swipe_down.show();
map.swipe_left.show();
map.swipe_right.show();
}
else{
map.swipe_up.hide();
map.swipe_down.hide();
map.swipe_left.hide();
map.swipe_right.hide();
}
}
else{
map.mousewheel.show();
map.hover_all.show();
map.right_info.show();
map.right_click.show();
map.longpress_info.hide();
if(!config.hover_all){
map.hover_handcard.hide();
map.hoveration.hide();
}
else{
map.hover_handcard.show();
map.hoveration.show();
}
map.swipe.hide();
map.swipe_up.hide();
map.swipe_down.hide();
map.swipe_left.hide();
map.swipe_right.hide();
}
if(lib.config.enable_drag){
if(lib.config.touchscreen){
map.enable_dragline.hide();
map.enable_touchdragline.show();
}
else{
map.enable_dragline.show();
map.enable_touchdragline.hide();
}
}
else{
map.enable_dragline.hide();
map.enable_touchdragline.hide();
}
if(!get.is.phoneLayout()){
map.round_menu_func.hide();
}
else{
map.round_menu_func.show();
}
if(!lib.node&&lib.device!='ios'){
map.confirm_exit.show();
}
else{
map.confirm_exit.hide();
}
if(config.dev){
map.errstop.show();
}
else{
map.errstop.hide();
}
}
}
},
appearence:{
name:'外观',
config:{
theme:{
name:'主题',
init:'woodden',
item:{},
visualMenu:function(node,link){
if(!node.menu){
node.className='button character themebutton '+link;
node.menu=ui.create.div(node,'','
');
}
},
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%',
},
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;
default:zoom=1;
}
game.documentZoom=game.deviceZoom*zoom;
ui.updatez();
}
},
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(!_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){
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;
}
}
},
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':'十',
},
},
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:{
update:function(config,map){
if(config.connect_onlyguozhan){
map.connect_junzhu.show();
}
else{
map.connect_junzhu.hide();
}
},
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:'潮鸣',
},
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(!_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(!_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:true,
intro:'游戏结束后可选择用相同的武将再进行一局游戏',
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){
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')){
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;
}
}
},
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'||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,
},
}
},
connect:{
name:'联机',
config:{
connect_nickname:{
name:'联机昵称',
input:true,
frequent:true,
},
connect_avatar:{
name:'联机头像',
init:'caocao',
item:{},
frequent:true,
onclick:function(item){
game.saveConfig('connect_avatar',item);
game.saveConfig('connect_avatar',item,'connect');
}
},
hall_ip:{
name:'联机大厅',
input:true,
frequent:true,
},
hall_button:{
name:'联机大厅按钮',
init:true,
frequent:true,
onclick:function(bool){
game.saveConfig('hall_button',bool,'connect');
if(ui.hall_button){
if(bool){
ui.hall_button.style.display='';
}
else{
ui.hall_button.style.display='none';
}
}
}
},
room_button:{
name:'创建服务器按钮',
init:false,
frequent:true,
intro:'开启后可创建一个空房间但不加入游戏',
onclick:function(bool){
game.saveConfig('room_button',bool,'connect');
if(ui.connectRoom){
if(bool){
ui.connectRoom.style.display='';
}
else{
ui.connectRoom.style.display='none';
}
}
}
}
}
},
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=='kaihei'||config.connect_doudizhu_mode=='huanle'){
map.connect_double_character.hide();
}
else{
map.connect_double_character.show();
}
},
connect_doudizhu_mode:{
name:'游戏模式',
init:'normal',
item:{
normal:'休闲',
kaihei:'开黑',
huanle:'欢乐',
},
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=='kaihei'||config.doudizhu_mode=='huanle'){
map.double_character.hide();
}
else{
map.double_character.show();
}
if(config.double_character&&config.doudizhu_mode!='kaihei'&&config.doudizhu_mode!='huanle'){
map.double_hp.show();
}
else{
map.double_hp.hide();
}
},
doudizhu_mode:{
name:'游戏模式',
init:'normal',
item:{
normal:'休闲',
kaihei:'开黑',
huanle:'欢乐',
},
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){
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':'十',
},
},
}
},
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
},
duzhansanguo:{
name:'毒战三国',
init:true,
frequent:true
},
daozhiyueying:{
name:'导师月英',
init:true,
frequent:true
},
weiwoduzun:{
name:'唯我独尊',
init:true,
frequent:true
},
tongxingzhizheng:{
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:{
'游戏操作':'长按/鼠标悬停/右键单击显示信息 触屏模式中,双指点击切换暂停;下划显示菜单,上划切换托管 键盘快捷键 '+
' 编辑牌堆 在卡牌包中修改牌堆后,将自动创建一个临时牌堆,在所有模式中共用,当保存当前牌堆后,临时牌堆被清除。每个模式可设置不同的已保存牌堆,设置的牌堆优先级大于临时牌堆 ',
'游戏命令':'变量名
场上角色 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 ',
'游戏名词':'护甲:和体力类似,每点护甲可抵挡一点伤害,但不影响手牌上限'+
' 随从:通过技能获得,拥有独立的技能、手牌区和装备区(共享判定区),出场时替代主武将的位置;随从死亡时自动切换回主武将'+
' 发现:从三张随机亮出的牌中选择一张,若无特殊说明,则获得此牌'+
' 蓄力技:发动时可以增大黄色的数字。若如此做,红色数字于技能的结算过程中改为原来的两倍'
},
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;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.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&&!_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.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,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(!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')){
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;j0;
};
}
}
else{
var next=player.chooseTarget();
next.set('_get_card',card);
next.set('filterTarget',function(card,player,target){
if(!_status.event.targets.contains(target)) return false;
if(!_status.event.nodistance&&!lib.filter.targetInRange(card,player,target)) return false;
return lib.filter.targetEnabledx(card,player,target);
});
next.set('ai',event.ai||get.effect_use);
next.set('selectTarget',event.selectTarget||lib.filter.selectTarget);
if(event.nodistance) next.set('nodistance',true);
if(event.forced) next.set('forced',true);
if(event.addCount!==false) next.set('addCount_extra',true);
next.set('targets',targets);
next.set('prompt',event.prompt||('选择'+get.translation(card)+'的目标'));
if(event.prompt2) next.set('prompt2',event.prompt2);
}
'step 1'
if(result.bool){
event.result={
bool:true,
targets:event.targets2||result.targets,
};
if(event.logSkill){
if(typeof event.logSkill=='string'){
player.logSkill(event.logSkill);
}
else if(Array.isArray(event.logSkill)){
player.logSkill.apply(player,event.logSkill);
}
}
var next=player.useCard(card,event.targets2||result.targets);
if(cards) next.cards=cards.slice(0);
if(event.nopopup) next.nopopup=true;
if(event.animate===false) next.animate=false;
if(event.throw===false) next.throw=false;
if(event.addCount===false) next.addCount=false;
if(event.noTargetDelay) next.targetDelay=false;
if(event.nodelayx) next.delayx=false;
}
else event.result={bool:false};
},
chooseToDuiben:function(){
'step 0'
game.log(player,'对',target,'发起了','#y对策');
if(_status.connectMode){
player.chooseButtonOL([
[player,['对策:请选择一种防御对策',[[['','','db_def2'],['','','db_def1']],'vcard']],true],
[target,['对策:请选择一种进攻之策',[[['','','db_atk1'],['','','db_atk2']],'vcard']],true]
],function(){},function(){return 1+Math.random()}).set('switchToAuto',function(){
_status.event.result='ai';
}).set('processAI',function(){
var buttons=_status.event.dialog.buttons;
return {
bool:true,
links:[buttons.randomGet().link],
}
});
}
'step 1'
if(_status.connectMode){
event.mes=result[player.playerid].links[0][2];
event.tes=result[target.playerid].links[0][2];
event.goto(4);
}
else{
player.chooseButton(['对策:请选择一种防御对策',[[['','','db_def2'],['','','db_def1']],'vcard']],true).ai=function(){return 1+Math.random()};
}
'step 2'
event.mes=result.links[0][2];
target.chooseButton(['对策:请选择一种进攻之策',[[['','','db_atk1'],['','','db_atk2']],'vcard']],true).ai=function(){return 1+Math.random()};
'step 3'
event.tes=result.links[0][2];
'step 4'
game.broadcast(function(){
ui.arena.classList.add('thrownhighlight');
});
ui.arena.classList.add('thrownhighlight');
game.addVideo('thrownhighlight1');
target.$compare(game.createCard(event.tes,'',''),player,game.createCard(event.mes,'',''));
game.log(target,'选择的进攻之策为','#g'+get.translation(event.tes));
game.log(player,'选择的防御对策为','#g'+get.translation(event.mes));
game.delay(0,1500);
'step 5'
var mes=event.mes.slice(6);
var tes=event.tes.slice(6);
var str;
if(mes==tes){
str=get.translation(player)+'对策成功';
player.popup('胜','wood');
target.popup('负','fire');
game.log(player,'#g胜');
event.result={bool:true};
}
else{
str=get.translation(player)+'对策失败';
target.popup('胜','wood');
player.popup('负','fire');
game.log(target,'#g胜');
event.result={bool:false};
}
game.broadcastAll(function(str){
var dialog=ui.create.dialog(str);
dialog.classList.add('center');
setTimeout(function(){
dialog.close();
},1000);
},str);
game.delay(2);
'step 6'
game.broadcastAll(function(){
ui.arena.classList.remove('thrownhighlight');
});
game.addVideo('thrownhighlight2');
if(event.clear!==false){
game.broadcastAll(ui.clear);
}
},
chooseToPSS:function(){
'step 0'
game.log(player,'对',target,'发起了猜拳');
if(_status.connectMode){
player.chooseButtonOL([
[player,['猜拳:请选择一种手势',[[['','','pss_stone'],['','','pss_scissor'],['','','pss_paper']],'vcard']],true],
[target,['猜拳:请选择一种手势',[[['','','pss_stone'],['','','pss_scissor'],['','','pss_paper']],'vcard']],true]
],function(){},function(){return 1+Math.random()}).set('switchToAuto',function(){
_status.event.result='ai';
}).set('processAI',function(){
var buttons=_status.event.dialog.buttons;
return {
bool:true,
links:[buttons.randomGet().link],
}
});
}
'step 1'
if(_status.connectMode){
event.mes=result[player.playerid].links[0][2];
event.tes=result[target.playerid].links[0][2];
event.goto(4);
}
else{
player.chooseButton(['猜拳:请选择一种手势',[[['','','pss_stone'],['','','pss_scissor'],['','','pss_paper']],'vcard']],true).ai=function(){return 1+Math.random()};
}
'step 2'
event.mes=result.links[0][2];
target.chooseButton(['猜拳:请选择一种手势',[[['','','pss_stone'],['','','pss_scissor'],['','','pss_paper']],'vcard']],true).ai=function(){return 1+Math.random()};
'step 3'
event.tes=result.links[0][2];
'step 4'
game.broadcast(function(){
ui.arena.classList.add('thrownhighlight');
});
ui.arena.classList.add('thrownhighlight');
game.addVideo('thrownhighlight1');
player.$compare(game.createCard(event.mes,'',''),target,game.createCard(event.tes,'',''));
game.log(player,'选择的手势为','#g'+get.translation(event.mes));
game.log(target,'选择的手势为','#g'+get.translation(event.tes));
game.delay(0,1500);
'step 5'
var mes=event.mes.slice(4);
var tes=event.tes.slice(4);
var str;
if(mes==tes){
str='二人平局';
player.popup('平','metal');
target.popup('平','metal');
game.log('猜拳的结果为','#g平局');
event.result={tie:true};
}
else{
if({paper:'stone',scissor:'paper',stone:'scissor'}[mes]==tes){
str=get.translation(player)+'胜利';
player.popup('胜','wood');
target.popup('负','fire');
game.log(player,'#g胜');
event.result={bool:true};
}
else{
str=get.translation(target)+'胜利';
target.popup('胜','wood');
player.popup('负','fire');
game.log(target,'#g胜');
event.result={bool:false};
}
}
game.broadcastAll(function(str){
var dialog=ui.create.dialog(str);
dialog.classList.add('center');
setTimeout(function(){
dialog.close();
},1000);
},str);
game.delay(2);
'step 6'
game.broadcastAll(function(){
ui.arena.classList.remove('thrownhighlight');
});
game.addVideo('thrownhighlight2');
if(event.clear!==false){
game.broadcastAll(ui.clear);
}
},
cardsDiscard:function(){
game.getGlobalHistory().cardMove.push(event);
for(var i=0;igame.players.length*num&&game.showIdentity){
if(!_status.video) player.popup('显示身份');
_status.identityShown=true;
game.showIdentity(false);
}
}
player.ai.tempIgnore=[];
_status.globalHistory.push({
cardMove:[],
custom:[],
});
game.countPlayer2(function(current){
current.actionHistory.push({useCard:[],respond:[],skipped:[],lose:[],gain:[],sourceDamage:[],damage:[],custom:[]});
current.stat.push({card:{},skill:{}});
if(event.parent._roundStart){
current.getHistory().isRound=true;
current.getStat().isRound=true;
}
});
player.getHistory().isMe=true;
player.getStat().isMe=true;
if(event.parent._roundStart){
game.getGlobalHistory().isRound=true;
}
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();
},
reverseOrder:function(){
"step 0"
game.delay();
"step 1"
var choice;
if(get.tag(card,'multineg')){
choice=(player.previous.side==player.side)?'逆时针':'顺时针';
}
else{
choice=(player.next.side==player.side)?'逆时针':'顺时针';
}
player.chooseControl('顺时针','逆时针',function(event,player){
return _status.event.choice||'逆时针';
}).set('prompt','选择'+get.translation(card)+'的结算方向').set('choice',choice).set('forceDie',true);
"step 2"
if(result&&result.control=='顺时针'){
var evt=event.getParent();
evt.fixedSeat=true;
evt.targets.sortBySeat();
evt.targets.reverse();
if(evt.targets[evt.targets.length-1]==player){
evt.targets.unshift(evt.targets.pop());
}
}
},
addJudgeCard:function(){
if(lib.filter.judge(card,player,target)&&cards.length&&get.position(cards[0],true)=='o') target.addJudge(card,cards);
},
equipCard:function(){
if(cards.length&&get.position(cards[0],true)=='o') target.equip(cards[0]);
},
gameDraw:function(){
"step 0"
if(_status.brawl&&_status.brawl.noGameDraw){
event.finish();
return;
}
var end=player;
var numx=num;
do{
if(typeof num=='function'){
numx=num(player);
}
player.directgain(get.cards(numx));
if(player.singleHp===true&&get.mode()!='guozhan'){
player.doubleDraw();
}
player=player.next;
}
while(player!=end);
event.changeCard=get.config('change_card');
if(_status.connectMode||lib.config.mode!='identity'&&lib.config.mode!='guozhan'&&lib.config.mode!='doudizhu'){
event.changeCard='disabled';
}
"step 1"
if(event.changeCard!='disabled'&&!_status.auto){
event.dialog=ui.create.dialog('是否使用手气卡?');
ui.create.confirm('oc');
event.custom.replace.confirm=function(bool){
_status.event.bool=bool;
game.resume();
}
}
else{
event.finish();
}
"step 2"
if(event.changeCard=='once'){
event.changeCard='disabled';
}
else if(event.changeCard=='twice'){
event.changeCard='once';
}
else if(event.changeCard=='disabled'){
event.bool=false;
return;
}
_status.imchoosing=true;
event.switchToAuto=function(){
_status.event.bool=false;
game.resume();
}
game.pause();
"step 3"
_status.imchoosing=false;
if(event.bool){
if(game.changeCoin){
game.changeCoin(-3);
}
var hs=game.me.getCards('h');
game.addVideo('lose',game.me,[get.cardsInfo(hs),[],[]]);
for(var i=0;ipriority){
event.doing.list.splice(i--,1);
event.num--;
}
}
event.choice=[];
if(event.num'+trigger.skillwarn+'。'+next.prompt2);
}
else{
next.set('prompt2',trigger.skillwarn);
}
}
}
}
"step 2"
var info=get.info(event.skill);
if(result&&result.bool!=false){
var autodelay=info.autodelay;
if(typeof autodelay=='function'){
autodelay=autodelay(trigger,player);
}
if(autodelay&&(info.forced||!event.isMine())){
if(typeof autodelay=='number'){
game.delayx(autodelay);
}
else{
game.delayx();
}
}
}
"step 3"
var info=get.info(event.skill);
if(result&&result.bool==false){
if(info.oncancel) info.oncancel(trigger,player);
event.finish();
return;
}
var next=game.createEvent(event.skill);
if(typeof info.usable=='number'){
player.addSkill('counttrigger');
if(!player.storage.counttrigger){
player.storage.counttrigger={};
}
if(!player.storage.counttrigger[event.skill]){
player.storage.counttrigger[event.skill]=1;
}
else{
player.storage.counttrigger[event.skill]++;
}
}
next.player=player;
next._trigger=trigger;
next.triggername=event.triggername;
next.setContent(info.content);
next.skillHidden=event.skillHidden;
if(info.forceDie) next.forceDie=true;
if(info.popup!=false&&!info.direct){
if(info.popup){
player.popup(info.popup);
game.log(player,'发动了','【'+get.skillTranslation(event.skill,player)+'】');
}
else{
if(info.logTarget&&info.logLine!==false){
if(typeof info.logTarget=='string'){
player.logSkill(event.skill,trigger[info.logTarget],info.line);
}
else if(typeof info.logTarget=='function'){
player.logSkill(event.skill,info.logTarget(trigger,player),info.line);
}
}
else{
player.logSkill(event.skill,false,info.line);
}
}
}
"step 4"
if(player._hookTrigger){
for(var i=0;i1){
slow.classList.add('glow');
}
else{
slow.classList.remove('glow');
}
if(_status.videoDuration<1){
fast.classList.add('glow');
}
else{
fast.classList.remove('glow');
}
}
ui.system.style.display='';
ui.refresh(ui.system);
ui.system.show();
ui.window.show();
if(lib.config.mode!='versus'&&lib.config.mode!='boss'){
ui.arena.style.display='';
ui.refresh(ui.arena);
ui.arena.show();
}
if(!game.chess){
game.playerMap={};
}
game.finishCards();
'step 2'
if(event.video.length){
var content=event.video.shift();
// console.log(content);
if(content.type=='delay'){
game.delay(content.content);
}
else if(content.type=='play'){
window.play={};
if(!event.playtoload){
event.playtoload=1;
}
else{
event.playtoload++;
}
var script=lib.init.js(lib.assetURL+'play',content.name);
script.addEventListener('load',function(){
var play=window.play[content.name]
if(play&&play.video){
play.video(content.init);
}
event.playtoload--;
if(event.playtoload==0){
delete window.play;
}
});
}
else if(typeof content.player=='string'&&game.playerMap[content.player]&&
game.playerMap[content.player].classList&&
!game.playerMap[content.player].classList.contains('obstacle')){
game.videoContent[content.type](game.playerMap[content.player],content.content);
}
else{
game.videoContent[content.type](content.content);
}
if(event.video.length){
game.delay(0,_status.videoDuration*Math.min(2000,event.video[0].delay));
}
event.redo();
}
else{
_status.over=true;
ui.system.lastChild.hide();
setTimeout(function(){
ui.system.lastChild.innerHTML='';
},500);
}
},
waitForPlayer:function(){
'step 0'
ui.auto.hide();
ui.pause.hide();
game.createServer();
if(!lib.translate.zhu){
lib.translate.zhu='主';
}
if(event.func){
event.func();
}
if(!lib.configOL.number){
lib.configOL.number=parseInt(lib.configOL.player_number);
}
if(game.onlineroom){
game.send('server','config',lib.configOL);
}
ui.create.connectPlayers(game.ip);
if(!window.isNonameServer){
var me=game.connectPlayers[0];
me.setIdentity('zhu');
me.initOL(lib.config.connect_nickname,lib.config.connect_avatar);
me.playerid='1';
game.onlinezhu='1';
}
_status.waitingForPlayer=true;
if(window.isNonameServer){
document.querySelector('#server_status').innerHTML='等待中';
}
game.pause();
'step 1'
_status.waitingForPlayer=false;
lib.configOL.gameStarted=true;
if(window.isNonameServer){
document.querySelector('#server_status').innerHTML='游戏中';
}
if(game.onlineroom){
game.send('server','config',lib.configOL);
}
for(var i=0;i0){
var num=event.num;
if(event.attachDraw){
for(var i=0;i1&&typeof event.selectCard!='function'){
event.promptdiscard=ui.create.control('提示',function(){
ai.basic.chooseCard(event.ai);
if(_status.event.custom.add.card){
_status.event.custom.add.card();
}
for(var i=0;ievent.num2){
str=get.translation(player)+'拼点成功';
player.popup('胜');
target.popup('负');
}
else{
str=get.translation(player)+'拼点失败';
if(event.num1==event.num2){
player.popup('平');
target.popup('平');
}
else{
player.popup('负');
target.popup('胜');
}
}
game.broadcastAll(function(str){
var dialog=ui.create.dialog(str);
dialog.classList.add('center');
setTimeout(function(){
dialog.close();
},1000);
},str);
game.delay(2);
"step 5"
if(event.callback){
game.broadcastAll(function(card1,card2){
if(card1.clone) card1.clone.style.opacity=0.5;
if(card2.clone) card2.clone.style.opacity=0.5;
},event.card1,event.card2);
var next=game.createEvent('compareMultiple');
next.player=player;
next.target=event.target;
next.card1=event.card1;
next.card2=event.card2;
next.num1=event.num1;
next.num2=event.num2;
next.setContent(event.callback);
}
"step 6"
game.broadcastAll(ui.clear);
event.iwhile++;
event.goto(3);
"step 7"
event.cards.add(event.card1);
},
chooseToCompare:function(){
"step 0"
if(player.countCards('h')==0||target.countCards('h')==0){
event.result={cancelled:true,bool:false}
event.finish();
return;
}
game.log(player,'对',target,'发起拼点');
"step 1"
var sendback=function(){
if(_status.event!=event){
return function(){
event.resultOL=_status.event.resultOL;
};
}
};
if(event.fixedResult&&event.fixedResult[player.playerid]) event.card1=event.fixedResult[player.playerid];
else if(player.isOnline()){
player.wait(sendback);
event.ol=true;
player.send(function(ai){
game.me.chooseCard('请选择拼点牌',true).set('type','compare').set('glow_result',true).ai=ai;
game.resume();
},event.ai);
}
else{
event.localPlayer=true;
player.chooseCard('请选择拼点牌',true).set('type','compare').set('glow_result',true).ai=event.ai;
}
if(event.fixedResult&&event.fixedResult[target.playerid]) event.card2=event.fixedResult[target.playerid];
else if(target.isOnline()){
target.wait(sendback);
event.ol=true;
target.send(function(ai){
game.me.chooseCard('请选择拼点牌',true).set('type','compare').set('glow_result',true).ai=ai;
game.resume();
},event.ai);
}
else{
event.localTarget=true;
}
"step 2"
if(event.localPlayer){
if(result.skill&&lib.skill[result.skill]&&lib.skill[result.skill].onCompare){
result.cards=lib.skill[result.skill].onCompare(player);
player.logSkill(result.skill);
}
event.card1=result.cards[0];
}
if(event.localTarget){
target.chooseCard('请选择拼点牌',true).set('type','compare').set('glow_result',true).ai=event.ai;
}
"step 3"
if(event.localTarget){
if(result.skill&&lib.skill[result.skill]&&lib.skill[result.skill].onCompare){
target.logSkill(result.skill);
result.cards=lib.skill[result.skill].onCompare(target);
}
event.card2=result.cards[0];
}
if(!event.resultOL&&event.ol){
game.pause();
}
"step 4"
try{
if(!event.card1){
if(event.resultOL[player.playerid].skill&&lib.skill[event.resultOL[player.playerid].skill]&&lib.skill[event.resultOL[player.playerid].skill].onCompare){
player.logSkill(event.resultOL[player.playerid].skill);
event.resultOL[player.playerid].cards=lib.skill[event.resultOL[player.playerid].skill].onCompare(player);
}
event.card1=event.resultOL[player.playerid].cards[0]
};
if(!event.card2){
if(event.resultOL[target.playerid].skill&&lib.skill[event.resultOL[target.playerid].skill]&&lib.skill[event.resultOL[target.playerid].skill].onCompare){
target.logSkill(event.resultOL[target.playerid].skill);
event.resultOL[target.playerid].cards=lib.skill[event.resultOL[target.playerid].skill].onCompare(player);
}
event.card2=event.resultOL[target.playerid].cards[0];
}
if(!event.card1||!event.card2){
throw('err');
}
}
catch(e){
console.log(e);
game.print(e);
event.finish();
return;
}
if(event.card2.number>=10||event.card2.number<=4){
if(target.countCards('h')>2){
event.addToAI=true;
}
}
player.lose(event.card1,ui.ordering);
target.lose(event.card2,ui.ordering);
"step 5"
game.broadcast(function(){
ui.arena.classList.add('thrownhighlight');
});
ui.arena.classList.add('thrownhighlight');
game.addVideo('thrownhighlight1');
player.$compare(event.card1,target,event.card2);
game.log(player,'的拼点牌为',event.card1);
game.log(target,'的拼点牌为',event.card2);
event.num1=event.card1.number;
event.num2=event.card2.number;
event.trigger('compare');
game.delay(0,1500);
"step 6"
event.result={
player:event.card1,
target:event.card2,
num1:event.num1,
num2:event.num2
}
var str;
if(event.num1>event.num2){
event.result.bool=true;
event.result.winner=player;
str=get.translation(player)+'拼点成功';
player.popup('胜');
target.popup('负');
}
else{
event.result.bool=false;
str=get.translation(player)+'拼点失败';
if(event.num1==event.num2){
event.result.tie=true;
player.popup('平');
target.popup('平');
}
else{
event.result.winner=target;
player.popup('负');
target.popup('胜');
}
}
game.broadcastAll(function(str){
var dialog=ui.create.dialog(str);
dialog.classList.add('center');
setTimeout(function(){
dialog.close();
},1000);
},str);
game.delay(2);
"step 7"
if(typeof event.target.ai.shown=='number'&&event.target.ai.shown<=0.85&&event.addToAI){
event.target.ai.shown+=0.1;
}
game.broadcastAll(function(){
ui.arena.classList.remove('thrownhighlight');
});
game.addVideo('thrownhighlight2');
if(event.clear!==false){
game.broadcastAll(ui.clear);
}
if(typeof event.preserve=='function'){
event.preserve=event.preserve(event.result);
}
else if(event.preserve=='win'){
event.preserve=event.result.bool;
}
else if(event.preserve=='lose'){
event.preserve=!event.result.bool;
}
},
chooseSkill:function(){
'step 0'
var list;
if(typeof event.target=='string'){
list=get.gainableSkillsName(event.target,event.func);
}
else{
list=event.target.getGainableSkills(event.func);
}
if(!list.length){
event.finish();
event.result={bool:false};
return;
}
event.skillai=function(list){
return get.max(list,get.skillRank,'item');
};
if(event.isMine()){
var dialog=ui.create.dialog('forcebutton');
dialog.add(event.prompt||'选择获得一项技能');
_status.event.list=list;
var clickItem=function(){
_status.event._result=this.link;
game.resume();
};
for(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 "帮助条目":"列表2-条目1 列表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);
var 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.js(extensionURL.replace(/raw\.githubusercontent\.com/,'rawgit.com')+'catalog.js',null,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 result=eval(text2.value);
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 textstr='';
for(var i=0;i';
pre.innerHTML+=textstr;
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).setContent(function(){
game.log(player,'投降');
player.popup('投降');
player.die('nosource');
}).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{
dialog.add([list,'character'],noclick);
}
}
dialog.add(ui.create.div('.placeholder'));
for(i=0;i=3600){
var num1=Math.floor(num/3600);
var num2=Math.floor((num-num1*3600)/60);
if(num2<10){
num2='0'+num2.toString();
}
var num3=num-num1*3600-parseInt(num2)*60;
if(num3<10){
num3='0'+num3.toString();
}
ui.time3.innerHTML=num1+':'+num2+':'+num3;
}
else{
var num1=Math.floor(num/60);
var num2=num-num1*60;
if(num2<10){
num2='0'+num2.toString();
}
ui.time3.innerHTML=num1+':'+num2;
}
},1000);
}
if(get.is.nomenu()){
if(!['menu','system'].contains(lib.config.round_menu_func)){
lib.config.round_menu_func='system';
}
}
else if(!lib.config.show_round_menu){
ui.roundmenu.style.display='none';
}
var resetround=function(e){
_status.draggingroundmenu=false;
ui.roundmenu.style.transform='';
ui.roundmenu._dragtransform=[0,0];
ui.roundmenu.style.transition='all 0.3s';
delete ui.roundmenu._dragtouches;
delete ui.roundmenu._dragorigin;
delete ui.roundmenu._dragorigintransform;
setTimeout(function(){
ui.roundmenu.style.transition='';
},500);
game.saveConfig('roundmenu_transform',[0,0]);
if(e) e.stopPropagation();
return false;
};
ui.click.resetround=resetround;
if(lib.config.touchscreen){
ui.roundmenu.addEventListener('touchstart',function(e){
_status.draggingroundmenu=true;
ui.roundmenu._dragorigin={
clientX:e.touches[0].clientX,
clientY:e.touches[0].clientY,
};
if(!ui.roundmenu._dragtransform){
ui.roundmenu._dragtransform=[0,0];
}
ui.roundmenu._dragorigintransform=ui.roundmenu._dragtransform.slice(0);
ui.roundmenu._resetTimeout=setTimeout(function(){
resetround();
delete ui.roundmenu._resetTimeout;
},1000);
});
}
else{
ui.roundmenu.oncontextmenu=resetround;
}
if(!lib.config.remember_round_button){
game.saveConfig('roundmenu_transform');
}
if(lib.config.roundmenu_transform){
var translate=lib.config.roundmenu_transform;
ui.roundmenu._dragtransform=translate;
ui.roundmenu.style.transform='translate('+translate[0]+'px,'+translate[1]+'px)';
ui.click.checkroundtranslate();
}
if(get.is.phoneLayout()){
ui.arena.classList.add('phone');
}
ui.sidebar=ui.create.div('#sidebar');
ui.sidebar3=ui.create.div('#sidebar3');
ui.canvas=document.createElement('canvas');
ui.arena.appendChild(ui.canvas);
ui.canvas.id='canvas';
ui.ctx=ui.canvas.getContext('2d');
ui.sidebar.ontouchstart=ui.click.touchStart;
ui.sidebar.ontouchmove = ui.click.touchScroll;
ui.sidebar.style.WebkitOverflowScrolling='touch';
var zoom;
switch(lib.config.ui_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;
default:zoom=1;
}
game.documentZoom=game.deviceZoom*zoom;
if(zoom!=1){
ui.updatez();
}
ui.system1=ui.create.div('#system1',ui.system);
ui.system2=ui.create.div('#system2',ui.system);
ui.replay=ui.create.system('重来',game.reload,true);
ui.replay.id='restartbutton';
ui.config2=ui.create.system('选项',ui.click.config);
ui.pause=ui.create.system('暂停',ui.click.pause);
ui.pause.id='pausebutton';
if(!_status.video){
ui.pause.hide();
}
if(!lib.config.touchscreen){
lib.setPopped(ui.pause,ui.click.pausehistory,220,400,null,true);
}
if(!lib.config.show_pause){
ui.pause.style.display='none';
}
ui.cardPileButton=ui.create.system('牌堆',null,true);
ui.cardPileButton.style.display='none';
lib.setPopped(ui.cardPileButton,ui.click.cardPileButton,220);
ui.wuxie=ui.create.system('不询问无懈',ui.click.wuxie,true);
if(!lib.config.touchscreen){
lib.setPopped(ui.config2,ui.click.pauseconfig,170);
}
ui.auto=ui.create.system('托管',ui.click.auto);
if(!game.syncMenu){
ui.config2.classList.add('hidden');
ui.config2.style.transition='all 0.5s';
ui.roundmenu.classList.add('transparent2');
ui.auto.style.opacity=0.5;
ui.auto.style.transition='all 0.5s';
lib.onfree.push(function(){
ui.auto.style.opacity='';
setTimeout(function(){
ui.auto.style.transition='';
},500);
});
}
ui.auto.id='autobutton';
ui.autonode=ui.create.div('#autonode','托管中...
',ui.arena);
ui.autonode.listen(ui.click.auto);
if(lib.config.mode=='connect'){
ui.auto.hide();
ui.pause.hide();
}
if(lib.forcehide){
if(lib.forcehide.contains('replay')) ui.replay.classList.add('forcehide');
if(lib.forcehide.contains('auto')) ui.auto.classList.add('forcehide');
if(lib.forcehide.contains('pause')) ui.pause.classList.add('forcehide');
if(lib.forcehide.contains('wuxie')) ui.wuxie.classList.add('forcehide');
if(lib.forcehide.contains('cardPileButton')) ui.cardPileButton.classList.add('forcehide');
}
ui.volumn=ui.create.system('♫');
lib.setPopped(ui.volumn,ui.click.volumn,200);
// if(lib.config.show_pause) ui.auto.style.marginLeft='10px';
if(!lib.config.show_volumn){
ui.volumn.style.display='none';
}
if(!lib.config.show_auto){
ui.auto.style.display='none';
}
if(!lib.config.show_wuxie){
ui.wuxie.style.display='none';
}
// if(!lib.config.show_cardpile||_status.connectMode){
// ui.cardPileButton.style.display='none';
// }
ui.sortCard=ui.create.system('整理手牌',function(){
var hs=game.me.getCards('h');
if(!hs.length) return;
game.addVideo('lose',game.me,[get.cardsInfo(hs),[],[]]);
for(var i=0;i4){
this.position=1;
}
var left1='180px';
var left2='calc(100% - 245px)';
var top1='210px';
var top2='calc(100% - 245px)';
if(game.layout=='default'){
left1='265px';
top1='160px';
left2='calc(100% - 330px)';
top2='calc(100% - 235px)';
}
if(this.position==1||this.position==2){
this.style.top=top2;
}
else{
this.style.top=top1;
}
if(this.position==1||this.position==4){
this.style.left=left2;
}
else{
this.style.left=left1;
}
}
ui.timer.listen(setTimerPosition);
ui.shortcut=ui.create.div('#shortcut.hidden',ui.window);
ui.shortcut.listen(ui.click.shortcut);
ui.create.div(ui.shortcut,function(e){e.stopPropagation()});
ui.create.div('.menubutton.round','重来 ',ui.shortcut,game.reload).dataset.position=1;
ui.create.div('.menubutton.round','退出 ',ui.shortcut,game.exit).dataset.position=3;
ui.create.div('.menubutton.round','记录 ',ui.shortcut,ui.click.pause).dataset.position=4;
ui.shortcut.autobutton=ui.create.div('.menubutton.round','托管 ',ui.shortcut,ui.click.auto);
ui.shortcut.autobutton.dataset.position=2;
ui.favmodelist=ui.create.div('.favmodelist',ui.shortcut);
ui.favmodelist.update=function(){
this.innerHTML='';
var num=Math.min(6,lib.config.favouriteMode.length);
for(var i=0;i菜单',ui.shortcut,ui.click.config).dataset.position=5;
if(_status.connectMode){
ui.playerids.remove();
ui.pause.innerHTML='记录';
}
setTimerPosition.call(ui.timer);
ui.arena.appendChild(ui.timer);
if(!game.syncMenu){
lib.onfree.push(function(){
ui.create.menu();
ui.config2.classList.remove('hidden');
ui.roundmenu.classList.remove('transparent2');
setTimeout(function(){
ui.config2.style.transition='';
},500);
});
}
else{
ui.create.menu();
}
lib.status.date=new Date();
lib.status.dateDelayed=0;
while(lib.arenaReady.length){
(lib.arenaReady.shift())();
}
delete lib.arenaReady;
if(lib.config.auto_check_update){
setTimeout(function(){
game.checkForUpdate(false);
},3000);
}
if(!lib.config.asset_version){
lib.onfree.push(function(){
setTimeout(function(){
if(!game.download){
game.saveConfig('asset_version','无');
}
else{
var func=function(){
if(confirm('是否下载图片和字体素材?(约175MB)')){
if(!ui.arena.classList.contains('menupaused')){
ui.click.configMenu();
ui.click.menuTab('其它');
}
setTimeout(game.checkForAssetUpdate,500);
}
else{
game.saveConfig('asset_version','无');
}
}
if(_status.new_tutorial){
_status.new_tutorial=func;
}
else{
func();
}
}
},3000);
});
}
if(localStorage.getItem(lib.configprefix+'playback')){
setTimeout(lib.init.onfree);
}
if(lib.config.test_game){
ui.window.classList.add('testing');
lib.config.game_speed='vfast';
lib.config.low_performance=true;
lib.config.animation=false;
_status.auto=true;
ui.auto.classList.add('glow');
setTimeout(function(){
var node=ui.create.pause().animate('start');
node.appendChild(ui.sidebar);
node.firstChild.innerHTML='正在测试';
node.removeEventListener('click',ui.click.resume);
},500);
}
},
system:function(str,func,right,before){
var parent=right?ui.system2:ui.system1;
var node=ui.create.div();
if(before){
parent.insertBefore(node,parent.firstChild);
}
else{
parent.appendChild(node);
}
node.innerHTML=str;
if(func){
node.listen(func);
}
if(lib.config.button_press){
node.addEventListener(lib.config.touchscreen?'touchstart':'mousedown',function(e){
if(!node.classList.contains('hidden')) node.classList.add('pressdown');
});
node.addEventListener(lib.config.touchscreen?'touchend':'mouseup',function(e){
node.classList.remove('pressdown');
});
node.addEventListener(lib.config.touchscreen?'touchmove':'mousemove',function(e){
node.classList.remove('pressdown');
});
}
return node;
},
pause:function(){
if(_status.pausing) return;
ui.click.shortcut(false);
var node=ui.create.div(".pausedbg",ui.window);
_status.pausing=true;
setTimeout(function(){
_status.pausing=false;
},500);
if(lib.config.touchscreen){
setTimeout(function(){
node.addEventListener('touchend',ui.click.resume);
},500);
}
else{
node.addEventListener('click',ui.click.resume);
}
if(!lib.config.touchscreen){
node.oncontextmenu=ui.click.resume;
}
var node2=ui.create.div(node);
if(_status.connectMode){
node2.innerHTML='';
}
else{
node2.innerHTML='已暂停';
}
// node2.listen(function(){
// _status.clicked=true;
// if(ui.sidebar.classList.contains('hidden')){
// ui.sidebar.show();
// ui.sidebar3.show();
// }
// else{
// ui.sidebar.hide();
// ui.sidebar3.hide();
// }
// });
return node;
},
prebutton:function(item,type,position,noclick){
var node=ui.create.div(position);
node.style.display='none';
node.link=item;
node.activate=function(){
ui.create.button(item,type,position,noclick,node);
delete node.activate;
}
_status.prebutton.push(node);
return node;
},
button:function(item,type,position,noclick,node){
switch(type){
case 'blank':
node=ui.create.div('.button.card',position);
node.link=item;
break;
case 'card':
if(typeof item.copy=='function'){
node=item.copy(false);
}
else{
node=item.cloneNode(true);
}
node.classList.add('button');
position.appendChild(node);
node.link=item;
if(item.style.backgroundImage){
node.style.backgroundImage=item.style.backgroundImage;
node.style.backgroundSize='cover';
}
if(item.style.color){
node.style.color=item.style.color;
}
if(item.nature){
node.classList.add(item.nature);
}
if(!noclick){
lib.setIntro(node);
}
break;
case 'vcard':
if(typeof item=='string'){
item=[get.type(item),'',item];
}
node=ui.create.card(position,'noclick',noclick);
node.classList.add('button');
node.init(item);
node.link=item;
break;
case 'character':case 'player':case 'characterx':
if(node){
node.classList.add('button');
node.classList.add('character');
node.style.display='';
}
else{
node=ui.create.div('.button.character',position);
}
node._link=item;
if(_status.noReplaceCharacter&&type=='characterx') type='character';
if(type=='characterx'){
if(lib.characterReplace[item]&&lib.characterReplace[item].length) item=lib.characterReplace[item][0];
}
node.link=item;
if(type=='character'||type=='characterx'){
if(type=='characterx'&&lib.characterReplace[node._link]&&lib.characterReplace[node._link].length>1) node._replaceButton=true;
var func=function(node,item){
node.setBackground(item,'character');
if(node.node){
node.node.name.remove();
node.node.hp.remove();
node.node.group.remove();
node.node.intro.remove();
if(node.node.replaceButton) node.node.replaceButton.remove();
}
node.node={
name:ui.create.div('.name',node),
hp:ui.create.div('.hp',node),
group:ui.create.div('.identity',node),
intro:ui.create.div('.intro',node),
};
var infoitem=lib.character[item];
if(!infoitem){
for(var itemx in lib.characterPack){
if(lib.characterPack[itemx][item]){
infoitem=lib.characterPack[itemx][item];break;
}
}
}
node.node.name.innerHTML=get.slimName(item);
if(lib.config.buttoncharacter_style=='default'||lib.config.buttoncharacter_style=='simple'){
if(lib.config.buttoncharacter_style=='simple'){
node.node.group.style.display='none';
}
node.node.name.dataset.nature=get.groupnature(infoitem[1]);
node.node.group.dataset.nature=get.groupnature(infoitem[1],'raw');
node.classList.add('newstyle');
ui.create.div(node.node.hp);
var textnode=ui.create.div('.text',get.numStr(infoitem[2]),node.node.hp);
if(infoitem[2]==0){
node.node.hp.hide();
}
else if(get.infoHp(infoitem[2])<=3){
node.node.hp.dataset.condition='mid';
}
else{
node.node.hp.dataset.condition='high';
}
}
else{
var hp=get.infoHp(infoitem[2]);
var maxHp=get.infoMaxHp(infoitem[2]);
if(maxHp>14){
if(typeof infoitem[2]=='string') node.node.hp.innerHTML=infoitem[2];
else node.node.hp.innerHTML=get.numStr(infoitem[2]);
node.node.hp.classList.add('text');
}
else{
for(var i=0;i=hp) next.classList.add('exclude');
}
}
}
if(node.node.hp.childNodes.length==0){
node.node.name.style.top='8px';
}
if(node.node.name.querySelectorAll('br').length>=4){
node.node.name.classList.add('long');
if(lib.config.buttoncharacter_style=='old'){
node.addEventListener('mouseenter',ui.click.buttonnameenter);
node.addEventListener('mouseleave',ui.click.buttonnameleave);
}
}
node.node.intro.innerHTML=lib.config.intro;
if(!noclick){
lib.setIntro(node);
}
if(infoitem[1]){
node.node.group.innerHTML=''+get.translation(infoitem[1])+'
';
node.node.group.style.backgroundColor=get.translation(infoitem[1]+'Color');
}
else{
node.node.group.style.display='none';
}
if(node._replaceButton){
var intro=ui.create.div('.button.replaceButton',node);
node.node.replaceButton=intro;
intro.innerHTML='切换';
intro._node=node;
intro.addEventListener(lib.config.touchscreen?'touchend':'click',function(){
_status.tempNoButton=true;
var node=this._node;
var list=lib.characterReplace[node._link];
var link=node.link;
var index=list.indexOf(link);
if(index==list.length-1) index=0;
else index++;
link=list[index];
node.link=link;
node.refresh(node,link);
setTimeout(function(){
delete _status.tempNoButton;
},200);
});
}
};
node.refresh=func;
node.refresh(node,item);
}
else{
node.node={
name:ui.create.div('.name',node),
intro:ui.create.div('.intro',node)
}
if(item.name&&item.name.indexOf('unknown')==0){
if(item.node&&item.node.name_seat){
node.classList.add('cardbg');
ui.create.div('.avatar_name',node,get.translation(item.name));
}
else{
node.setBackground(item.name1,'character');
}
}
else{
node.setBackground(item.name,'character');
}
}
break;
case 'text':
node=ui.create.div('.button.text',position);
node.link=item;
node.innerHTML=item;
break;
case 'textButton':
node=ui.create.div('.caption',position);
node.link=item;
node.innerHTML=item;
break;
}
if(!noclick){
node.addEventListener(lib.config.touchscreen?'touchend':'click',ui.click.button);
}
else{
node.classList.add('noclick');
if(node.querySelector('.intro')){
node.querySelector('.intro').remove();
}
}
for(var i in lib.element.button){
node[i]=lib.element.button[i];
}
return node;
},
buttons:function(list,type,position,noclick,zoom){
var buttons=[];
var pre=(type.slice(0,3)=='pre');
if(pre){
if(!_status.prebutton){
_status.prebutton=[];
lib.onfree.push(function(){
for(var i=0;i<_status.prebutton.length;i++){
if(_status.prebutton[i].activate){
_status.prebutton[i].activate();
}
}
delete _status.prebutton;
});
}
}
for(var i=0;i翻 面',node),
framebg:ui.create.div('.framebg',node),
intro:ui.create.div('.intro',node),
identity:ui.create.div('.identity',node),
hp:ui.create.div('.hp',node),
name:ui.create.div('.name',node),
name2:ui.create.div('.name.name2',node),
nameol:ui.create.div('.nameol',node),
count:ui.create.div('.count',node).hide(),
equips:ui.create.div('.equips',node).hide(),
judges:ui.create.div('.judges',node),
marks:ui.create.div('.marks',node),
chain:ui.create.div('.chain','
',node),
handcards1:ui.create.div('.handcards'),
handcards2:ui.create.div('.handcards'),
};
var chainlength=game.layout=='default'?64:40;
for(var i=0;i
=lib.configOL.number){
player.classList.add('unselectable2');
}
}
var bar=ui.create.div(ui.window);
bar.style.height='20px';
bar.style.width='80%';
bar.style.left='10%';
bar.style.top='calc(200% / 7 - 120px + 5px)';
bar.style.textAlign='center';
var ipbar=ui.create.div('.shadowed',ip,bar);
ipbar.style.padding='4px';
ipbar.style.borderRadius='2px';
ipbar.style.position='relative';
var button=ui.create.div('.menubutton.large.highlight.connectbutton.pointerdiv',game.online?'退出联机':'开始游戏',ui.window,function(){
if(button.clicked) return;
if(game.online){
if(game.onlinezhu){
game.send('startGame');
}
else{
game.saveConfig('tmp_owner_roomId');
game.saveConfig('tmp_user_roomId');
game.saveConfig('reconnect_info');
game.reload();
}
}
else{
var num=0;
for(var i of game.connectPlayers){
if(!i.nickname&&!i.classList.contains('unselectable2')) num++;
}
if(num>=lib.configOL.number-1){
alert('至少要有两名玩家才能开始游戏!');
return;
}
game.resume();
}
button.delete();
bar.delete();
delete ui.connectStartButton;
delete ui.connectStartBar;
button.clicked=true;
});
ui.connectStartButton=button;
ui.connectStartBar=bar;
},
players:function(num){
if(num===0){
return;
}
if(num==undefined) num=lib.configOL.number;
if(num==undefined) num=get.playerNumber();
if(typeof num=='string'){
num=parseInt(num);
}
if(!num) num=5;
for(var i=0;i0){
players[i].previous=players[i-1];
players[i].previousSeat=players[i-1];
}
if(i');
uiintro.content.lastChild.style.paddingTop=0;
button.input=uiintro.content.lastChild.lastChild;
button.input.onfocus=function(){
button.focused=true;
}
button.input.onblur=function(){
delete button.focused;
}
if(button.interval){
button.input.disabled=true;
button.input.style.opacity=0.6;
if(button.intervaltext){
button.textnode.innerHTML=button.intervaltext;
}
}
var datenode=ui.create.div(uiintro.content);
datenode.style.marginTop=0;
datenode.style.whiteSpace='nowrap';
var date=new Date();
var days=[];
var currentDay=date.getDay();
if(currentDay==0) currentDay=7;
for(var i=1;i<=7;i++){
if(i7){
initday-=7;
}
var daysselect=ui.create.selectlist(days,initday.toString(),datenode);
daysselect.style.width='55px';
var hours=[];
for(var i=0;i<24;i++){
hours.push([i.toString(),i.toString()+'点']);
}
var hoursselect=ui.create.selectlist(hours,date.getHours().toString(),datenode);
hoursselect.style.marginLeft='5px';
hoursselect.style.width='55px';
var timeconfirm=ui.create.node('button','确定',datenode);
timeconfirm.style.marginLeft='5px';
timeconfirm.onclick=function(){
if(!button.input.value){
alert('请填写约战标题');
return;
}
var date2=new Date();
date2.setHours(parseInt(hoursselect.value));
date2.setMinutes(0);
date2.setSeconds(0);
var deltaday=parseInt(daysselect.value)-currentDay;
if(deltaday<0){
deltaday+=7;
}
var utc=date2.getTime()+deltaday*24*3600000;
if(utcID:'+button.info[i].creator,eventnode);
ui.create.div('','已有'+(button.info[i].members.length)+'人加入',eventnode);
ui.create.div('','时间:'+str,eventnode);
if(button.info[i].members.contains(game.onlineKey)){
eventnode.classList.add('active');
}
}
else{
ui.create.div('.title',button.info[i].title,eventnode);
ui.create.div('',button.info[i].content,eventnode);
ui.create.div('','创建者:'+(button.info[i].nickname),eventnode);
}
}
if(num>=3){
button.input.disabled=true;
button.input.style.opacity=0.6;
hoursselect.disabled=true;
daysselect.disabled=true;
timeconfirm.disabled=true;
}
}
uiintro.refresh();
ui.window.appendChild(uiintro);
_status.connectEventsCallback=function(){
if(uiintro.parentNode==ui.window){
uiintro.refresh();
}
};
}
},
connectClients:function(){
if(this.info){
var button=this;
var layer=ui.create.div('.poplayer',ui.window);
var uiintro=ui.create.dialog('hidden','notouchscroll');
this.classList.add('active');
if(lib.config.touchscreen){
lib.setScroll(uiintro.contentContainer);
}
layer.listen(function(){
if(this.clicked){
this.clicked=false;
return;
}
button.classList.remove('active');
uiintro.delete();
this.delete();
});
uiintro.listen(function(){
_status.clicked=true;
});
uiintro.style.zIndex=21;
uiintro.classList.add('popped');
uiintro.classList.add('static');
uiintro.classList.add('onlineclient');
uiintro.style.width='180px';
uiintro.style.height='300px';
uiintro.style.left='auto';
uiintro.style.right='20px';
uiintro.style.top='auto';
uiintro.style.bottom='75px';
uiintro.refresh=function(){
if(button.focused) return;
uiintro.content.innerHTML='';
uiintro.addText('发状态');
button.textnode=uiintro.content.lastChild.lastChild;
uiintro.add(' ');
uiintro.content.lastChild.style.paddingTop=0;
button.input=uiintro.content.lastChild.lastChild;
button.input.onfocus=function(){
button.focused=true;
}
button.input.onblur=function(){
delete button.focused;
}
if(button.interval){
button.input.disabled=true;
button.input.style.opacity=0.6;
if(button.intervaltext){
button.textnode.innerHTML=button.intervaltext;
}
}
button.input.onkeydown=function(e){
if(e.keyCode==13&&!this.disabled){
game.send('server','status',this.value);
this.blur();
this.disabled=true;
this.style.opacity=0.6;
button.textnode.innerHTML='发状态(10)';
button.intervaltext=button.textnode.innerHTML;
var num=10;
var that=this;
button.input.disabled=true;
button.input.style.opacity=0.6;
this.value='';
button.interval=setInterval(function(){
num--;
if(num>0){
button.textnode.innerHTML='发状态('+num+')';
button.intervaltext=button.textnode.innerHTML;
}
else{
button.textnode.innerHTML='发状态';
button.input.disabled=false;
button.input.style.opacity='';
clearInterval(button.interval);
delete button.interval;
delete button.intervaltext;
}
},1000);
}
}
for(var i=0;i'+(button.info[i][0]||'无名玩家'),node);node.isme=true;
}
else if(button.info[i][2]){
ui.create.div('.name',(button.info[i][0]||'无名玩家'),node);
}
else{
ui.create.div('.name',''+(button.info[i][0]||'无名玩家'),node);
}
//ui.create.div('.videostatus',node,button.info[i][5]);
//node.classList.add('videonodestatus');
if(button.info[i][3]){
ui.create.div('.videostatus',node,button.info[i][3].slice(0,80));
node.classList.add('videonodestatus')
}
}
};
uiintro.refresh();
ui.window.appendChild(uiintro);
_status.connectClientsCallback=function(){
if(uiintro.parentNode==ui.window){
uiintro.refresh();
}
};
}
},
autoskin:function(){
if(!lib.config.change_skin) return;
var players=game.filterPlayer();
var change=function(player,num,callback){
if(num=='1'){
ui.click.skin(player.node.avatar,player.name,callback);
}
else{
ui.click.skin(player.node.avatar2,player.name2,callback);
}
};
var finish=function(){
if(lib.config.change_skin_auto!='off'){
_status.skintimeout=setTimeout(ui.click.autoskin,parseInt(lib.config.change_skin_auto));
}
};
var autoskin=function(){
if(players.length){
var player=players.randomRemove();
var list=[];
if(player.name&&!player.isUnseen(0)){
list.push('1');
}
if(player.name2&&!player.isUnseen(1)){
list.push('2');
}
if(list.length){
change(player,list.randomRemove(),function(bool){
if(bool){
finish();
}
else if(list.length){
change(player,list[0],function(bool){
if(bool){
finish();
}
else{
autoskin();
}
});
}
else{
autoskin();
}
});
}
else{
autoskin();
}
}
}
autoskin();
},
skin:function(avatar,name,callback){
var num=1;
if(name.indexOf('gz_')==0){
name=name.slice(3);
}
if(lib.config.skin[name]){
num=lib.config.skin[name]+1;
}
var fakeavatar=avatar.cloneNode(true);
var finish=function(bool){
var player=avatar.parentNode;
if(bool){
fakeavatar.style.boxShadow='none';
player.insertBefore(fakeavatar,avatar.nextSibling);
setTimeout(function(){
fakeavatar.delete();
},100);
}
if(bool&&lib.config.animation&&!lib.config.low_performance){
player.$rare();
}
if(callback){
callback(bool);
}
}
var img=new Image();
img.onload=function(){
lib.config.skin[name]=num;
game.saveConfig('skin',lib.config.skin);
avatar.style.backgroundImage='url("'+img.src+'")';
finish(true);
}
img.onerror=function(){
if(lib.config.skin[name]){
finish(true);
}
else{
finish(false);
}
delete lib.config.skin[name];
game.saveConfig('skin',lib.config.skin);
avatar.setBackground(name,'character');
}
img.src=lib.assetURL+'image/skin/'+name+'/'+num+'.jpg';
},
touchpop:function(forced){
if(lib.config.touchscreen||forced){
_status.touchpopping=true;
clearTimeout(_status.touchpoppingtimeout);
_status.touchpoppingtimeout=setTimeout(function(){
_status.touchpopping=false;
},600);
}
},
exit:function(){
if(game.servermode&&lib.config.reconnect_info&&_status.over){
if(!_status.roomtimeout){
lib.config.reconnect_info[2]=game.roomId;
game.saveConfig('reconnect_info',lib.config.reconnect_info);
}
game.reload();
return;
}
else{
if(typeof game.roomId!='number'){
game.saveConfig('reconnect_info');
}
}
if(!ui.exit||!ui.exit.stay){
if(lib.config.reconnect_info){
lib.config.reconnect_info.length=1;
game.saveConfig('reconnect_info',lib.config.reconnect_info);
}
game.saveConfig('tmp_user_roomId',undefined,false,function(){
game.reload();
});
}
else{
game.reload();
}
},
shortcut:function(show){
if(show===false){
ui.shortcut.classList.add('hidden');
}
else{
ui.shortcut.classList.toggle('hidden');
}
if(ui.shortcut.classList.contains('hidden')){
ui.favmode.style.display='none';
if(window.StatusBar&&lib.config.show_statusbar_ios=='auto'){
document.body.classList.remove('statusbar');
window.StatusBar.hide();
}
ui.window.classList.remove('shortcutpaused');
}
else{
if(lib.config.show_favmode){
ui.favmode.style.display='';
}
if(window.StatusBar&&lib.config.show_statusbar_ios=='auto'){
document.body.classList.add('statusbar');
window.StatusBar.overlaysWebView(true);
window.StatusBar.backgroundColorByName('black');
window.StatusBar.show();
}
if(_status.auto){
ui.shortcut.autobutton.classList.add('active');
}
else{
ui.shortcut.autobutton.classList.remove('active');
}
ui.window.classList.add('shortcutpaused');
}
},
favouriteCharacter:function(e){
if(typeof this.link=='string'){
if(this.innerHTML=='添加收藏'){
this.innerHTML='移除收藏';
lib.config.favouriteCharacter.add(this.link);
}
else{
this.innerHTML='添加收藏';
lib.config.favouriteCharacter.remove(this.link);
}
if(ui.favouriteCharacter){
if(lib.config.favouriteCharacter.contains(this.link)){
for(var i=0;i=node.scrollHeight){
clearInterval(that.buttonscrollinterval);
delete that.buttonscrollinterval;
}
else{
if(num>0){
num--;
}
else{
node.scrollTop+=2;
}
}
},16);
}
},
buttonnameleave:function(){
if(this.buttonscrollinterval){
clearInterval(this.buttonscrollinterval);
}
var node=this.node.name;
if(node.offsetHeight1&&
!this.classList.contains('popped')&&
!this.classList.contains('fixed')){
_status.draggingtouchdialog=this;
this._dragorigin={
clientX:e.touches[0].clientX,
clientY:e.touches[0].clientY,
};
if(!this._dragtransform){
this._dragtransform=[0,0];
}
this._dragorigintransform=this._dragtransform.slice(0);
e.preventDefault();
e.stopPropagation();
}
},
identity:function(e){
if(_status.dragged) return;
_status.clicked=true;
if(!game.getIdentityList) return;
if(_status.video) return;
if(this.parentNode.forceShown) return;
if(_status.clickingidentity){
for(var i=0;i<_status.clickingidentity[1].length;i++){
_status.clickingidentity[1][i].delete();
_status.clickingidentity[1][i].style.transform='';
}
if(_status.clickingidentity[0]==this.parentNode){
delete _status.clickingidentity;
return;
}
}
var list=game.getIdentityList(this.parentNode);
if(!list) return;
if(lib.config.mark_identity_style=='click'){
var list2=[];
for(var i in list){
list2.push(i);
}
list2.push(list2[0]);
for(var i=0;i'+num);
if(_status.connectMode) return uiintro;
uiintro.add('轮数 '+game.roundNumber+' 洗牌 '+game.shuffleNumber+'
');
uiintro.add('弃牌堆
');
if(ui.discardPile.childNodes.length){
var list=[];
for(var i=0;i无 ');
}
return uiintro;
},
chat:function(){
ui.system1.classList.add('shown');
ui.system2.classList.add('shown');
var uiintro=ui.create.dialog('hidden');
uiintro.listen(function(e){
e.stopPropagation();
});
var list=ui.create.div('.caption');
if(get.is.phoneLayout()){
list.style.maxHeight='110px';
}
else{
list.style.maxHeight='220px';
}
list.style.overflow='scroll';
lib.setScroll(list);
uiintro.contentContainer.style.overflow='hidden';
var input;
var addEntry=function(info,clear){
if(list._chatempty){
list.innerHTML='';
delete list._chatempty;
}
var node=ui.create.div('.text.chat');
node.innerHTML=info[0]+': '+info[1];
list.appendChild(node);
list.scrollTop=list.scrollHeight;
uiintro.style.height=uiintro.content.scrollHeight+'px';
}
_status.addChatEntry=addEntry;
_status.addChatEntry._origin=uiintro;
if(lib.chatHistory.length){
for(var i=0;i');
node.style.paddingTop=0;
node.style.marginBottom='16px';
input=node.firstChild;
input.style.width='calc(100% - 20px)';
input.onchange=function(){
_status.chatValue=input.value;
}
input.onkeydown=function(e){
if(e.keyCode==13&&input.value){
var player=game.me;
var str=input.value;
if(!player){
if(game.connectPlayers){
if(game.online){
for(var i=0;i',function(){
emotionTitle.innerHTML=get.translation(this.pack);
for(var j=1;j<=lib.emotionList[this.pack];j++){
var emotionButton=ui.create.div('.card.fullskin',' ',function(){
var player=game.me;
if(!player){
if(game.connectPlayers){
if(game.online){
for(var i=0;iui.window.offsetWidth-10){
left=ui.window.offsetWidth-width-10;
}
uiintro.style.left=left+'px';
uiintro._poppedorigin=this;
if(!lib.config.touchscreen){
uiintro.addEventListener('mouseleave',ui.click.leavehoverpopped);
}
ui.click.shortcut(false);
if(uiintro._onopen){
uiintro._onopen();
}
if(this._paused2&&!lib.config.touchscreen){
game.pause2();
uiintro.classList.add('static');
var layer=ui.create.div('.poplayer',ui.window);
var clicklayer=function(e){
uiintro.delete();
layer.remove();
game.resume2();
e.stopPropagation();
return false;
}
uiintro.style.zIndex=21;
layer.onclick=clicklayer;
layer.oncontextmenu=clicklayer;
uiintro.addEventListener('mouseleave',clicklayer);
uiintro.addEventListener('click',clicklayer);
}
},
hoverpopped_leave:function(){
this._poppedalready=false;
},
leavehoverpopped:function(){
if(_status.dragged) return;
if(this.classList.contains('noleave')) return;
this.delete();
var button=this._poppedorigin;
var uiintro=this;
setTimeout(function(){
if(button._uiintro==uiintro){
delete button._uiintro;
}
},500);
},
dierevive:function(){
if(game.me.isDead()){
game.me.revive(Math.max(1,game.me.maxHp));
game.me.draw(2);
}
else{
if(ui.revive){
ui.revive.close();
delete ui.revive;
}
}
},
dieswap:function(){
if(game.me.isDead()){
_status.clicked=true;
var i,translation,intro,str;
if(ui.intro){
ui.intro.close();
if(ui.intro.source=='dieswap'){
delete ui.intro;
ui.control.show();
game.resume2();
return;
}
}
game.pause2();
ui.control.hide();
ui.intro=ui.create.dialog();
ui.intro.source='dieswap';
var players=[];
for(var i=0;i100){
if(ui.roundmenu._resetTimeout){
clearTimeout(ui.roundmenu._resetTimeout);
delete ui.roundmenu._resetTimeout;
}
}
ui.roundmenu._dragtouches=e.touches[0];
ui.click.checkroundtranslate(translate);
}
_status.clicked=true;
}
else if(_status.draggingtouchdialog){
delete _status._swipeorigin;
if(_status.draggingtouchdialog._dragorigin&&_status.draggingtouchdialog._dragtransform&&e.touches.length){
var translate=_status.draggingtouchdialog._dragtransform.slice(0);
var dx=e.touches[0].clientX/game.documentZoom-_status.draggingtouchdialog._dragorigin.clientX/game.documentZoom;
var dy=e.touches[0].clientY/game.documentZoom-_status.draggingtouchdialog._dragorigin.clientY/game.documentZoom;
translate[0]+=dx;
translate[1]+=dy;
_status.draggingtouchdialog._dragtouches=e.touches[0];
ui.click.checkdialogtranslate(translate,_status.draggingtouchdialog);
}
_status.clicked=true;
}
else if(_status._swipeorigin&&e.touches[0]){
_status._swipeorigin.touches=e.touches[0];
}
if(_status.mousedragging&&e.touches.length){
e.preventDefault();
var item=document.elementFromPoint(e.touches[0].clientX,e.touches[0].clientY);
if(game.chess&&ui.selected.cards.length){
var itemtype=get.itemtype(item);
if(itemtype!='card'&&itemtype!='button'){
var ex=e.touches[0].clientX/game.documentZoom-ui.arena.offsetLeft;
var ey=e.touches[0].clientY/game.documentZoom-ui.arena.offsetTop;
for(var i=0;ileft&&extop&&eyitem.offsetLeft&&exitem.offsetTop&&ey=0){
if(dy<=0){
deg+=90;
}
else{
deg=90-deg;
}
}
else{
if(dy<=0){
deg=270-deg;
}
else{
deg+=270;
}
}
node.style.transform='rotate('+(-deg)+'deg) scaleY(0)';
node.style.height=get.xyDistance(from,to)+'px';
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)';
ui.touchlines.push(node);
node._origin=item;
}
}
}
else{
_status.lastdragchange.remove(item);
for(var i=0;i200){
goswipe(lib.config.swipe_down);
}
}
else if(Math.abs(dy)<100){
if(dx<-200){
goswipe(lib.config.swipe_left);
}
else if(dx>200){
goswipe(lib.config.swipe_right);
}
}
}
}
var tmpflag=false;
_status.mousedown=false;
_status.clicked=false;
if(_status.mousedragging&&_status.mouseleft){
if(game.check()){
if(ui.confirm){
ui.confirm.close();
}
ui.click.ok();
ui.canvas.width=ui.arena.offsetWidth;
ui.canvas.height=ui.arena.offsetHeight;
}
else{
game.uncheck();
game.check();
}
}
else if(_status.mousedragging&&_status.mousedragorigin){
tmpflag=_status.mousedragorigin;
}
_status.lastdragchange.length=0;
_status.mousedragging=null;
_status.mouseleft=false;
_status.mousedragorigin=null;
_status.dragstatuschanged=false;
while(ui.touchlines.length){
ui.touchlines.shift().delete();
}
if(tmpflag){
game.check();
}
_status.dragged=false;
_status.clicked=false;
},
checkroundtranslate:function(translate){
var translate=translate||ui.roundmenu._dragtransform;
if(translate[1]+ui.roundmenu._position[1]+50+ui.arena.offsetTop>ui.window.offsetHeight){
translate[1]=ui.window.offsetHeight-(ui.roundmenu._position[1]+50)-ui.arena.offsetTop;
}
else if(translate[1]+ui.roundmenu._position[1]+ui.arena.offsetTop<0){
translate[1]=-ui.roundmenu._position[1]-ui.arena.offsetTop;
}
if(translate[0]+ui.roundmenu._position[0]+50+ui.arena.offsetLeft>ui.window.offsetWidth){
translate[0]=ui.window.offsetWidth-(ui.roundmenu._position[0]+50)-ui.arena.offsetLeft;
}
else if(translate[0]+ui.roundmenu._position[0]+ui.arena.offsetLeft<0){
translate[0]=-ui.roundmenu._position[0]-ui.arena.offsetLeft;
}
ui.roundmenu.style.transform='translate('+translate[0]+'px,'+translate[1]+'px)';
},
checkdialogtranslate:function(translate,dialog){
var translate=translate||dialog._dragtransform;
if(Math.sqrt(translate[0]*translate[0]+translate[1]*translate[1])<10){
translate[0]=0;
translate[1]=0;
}
dialog.style.transform='translate('+translate[0]+'px,'+translate[1]+'px)';
},
windowmousewheel:function(e){
_status.tempunpopup=e;
},
windowmousemove:function(e){
if(window.inSplash) return;
if(_status.tempunpopup){
if(get.evtDistance(_status.tempunpopup,e)>5){
delete _status.tempunpopup;
}
}
if(e.button==2) return;
var dialogs=document.querySelectorAll('#window>.dialog.popped:not(.static)');
for(var i=0;ileft&&extop&&eyitem.offsetLeft&&exitem.offsetTop&&ey.dialog.popped:not(.static)');
for(var i=0;ilib.versionOL){
alert('加入失败:你的游戏版本过低');
}
else{
alert('加入失败:房主的游戏版本过低');
}
}
else{
if(!_status.enteringroom){
_status.enteringroom=true;
_status.enteringroomserver=this.serving;
if(this.roomempty){
_status.roomindex=this.roomindex;
ui.click.connectMenu();
}
else{
game.send('server','enter',this.roomindex,lib.config.connect_nickname,lib.config.connect_avatar);
}
}
}
}
return;
}
if(this.playerid){
if(this.ws){
if(confirm('是否踢出'+this.nickname+'?')){
var id=get.id();
this.ws.send(function(id){
if(game.ws){
game.ws.close();
game.saveConfig('reconnect_info');
game.saveConfig('banned_info',id);
}
},id);
lib.node.banned.push(id);
}
}
}
else{
if(lib.configOL.mode=='versus'||lib.configOL.mode=='doudizhu'||lib.configOL.mode=='single') return;
if(lib.configOL.mode=='identity'&&(lib.configOL.identity_mode=='zhong'||lib.configOL.identity_mode=='purple')) return;
if(!this.classList.contains('unselectable2')&&lib.configOL.number<=2) return;
this.classList.toggle('unselectable2')
if(this.classList.contains('unselectable2')){
lib.configOL.number--;
}
else{
lib.configOL.number++;
}
game.send('server','config',lib.configOL);
game.updateWaiting();
}
return;
}
_status.clicked=true;
var custom=_status.event.custom;
if(custom.replace.target){
custom.replace.target(this,e);
return;
}
if(this.classList.contains('selectable')==false) return;
this.unprompt();
if(this.classList.contains('selected')){
ui.selected.targets.remove(this);
if(_status.multitarget||_status.event.complexSelect){
game.uncheck();
game.check();
}
else{
this.classList.remove('selected');
}
}
else{
ui.selected.targets.add(this);
if(_status.event.name=='chooseTarget'||_status.event.name=='chooseToUse'||_status.event.name=='chooseCardTarget'){
var targetprompt=null;
if(_status.event.targetprompt){
targetprompt=_status.event.targetprompt;
}
else if(_status.event.skill&&!get.info(_status.event.skill).viewAs){
targetprompt=get.info(_status.event.skill).targetprompt;
}
else if(_status.event.name=='chooseToUse'){
var currentcard=get.card();
if(currentcard){
targetprompt=get.info(currentcard).targetprompt;
}
}
if(targetprompt){
if(Array.isArray(targetprompt)){
targetprompt=targetprompt[Math.min(targetprompt.length-1,ui.selected.targets.indexOf(this))];
}
else if(typeof targetprompt=='function'){
targetprompt=targetprompt(this);
}
if(targetprompt&&typeof targetprompt=='string'){
this.prompt(targetprompt);
}
}
}
this.classList.add('selected');
}
if(custom.add.target){
custom.add.target();
}
game.check();
},
control2:function(){
if(this.childNodes.length==1&&!this._doubleclick){
ui.click.control.call(this.firstChild);
}
},
control:function(){
if(_status.dragged) return;
if(ui.control.classList.contains('hidden')) return;
var node=this.parentNode;
if(node){
if(node._doubleclick){
return;
}
else{
node._doubleclick=true;
setTimeout(function(){
node._doubleclick=false;
},500);
}
if(node.classList.contains('hidden')) return;
if(node.classList.contains('removing')) return;
if(node.classList.contains('disabled')) return;
}
if(ui.intro){
ui.intro.close();
delete ui.intro;
}
_status.clicked=true;
if(this.parentNode.custom){
this.parentNode.custom(this.link,this);
return;
}
if(this.link=='ok'){
ui.click.ok(this);
}
else if(this.link=='cancel'){
ui.click.cancel(this);
}
else{
_status.event.result={
buttons:ui.selected.buttons.slice(0),
cards:ui.selected.cards.slice(0),
targets:ui.selected.targets.slice(0),
control:this.link,
links:get.links(ui.selected.buttons)
};
if(this.parentNode.close!=false){
game.uncheck();
this.parentNode.close();
}
game.resume();
}
},
dialogcontrol:function(){
_status.event.result={
buttons:ui.selected.buttons.slice(0),
cards:ui.selected.cards.slice(0),
targets:ui.selected.targets.slice(0),
control:this.link,
links:get.links(ui.selected.buttons)
};
game.resume();
},
skill:function(skill){
var info=get.info(skill);
var event=_status.event;
event.backup(skill);
if(info.filterCard&&info.discard!=false&&info.lose!=false&&!info.viewAs){
var cards=event.player.getCards(event.position);
for(var i=0;i'+str2+'
');
if(info.longprompt){
event.skillDialog.forcebutton=true;
ui.update();
}
}
else if(info.promptfunc){
event.skillDialog=ui.create.dialog(str,''+info.promptfunc(event,event.player)+'
');
}
else if(lib.dynamicTranslate[skill]){
event.skillDialog=ui.create.dialog(str,''+lib.dynamicTranslate[skill](event.player,skill)+'
');
}
else if(lib.translate[skill+'_info']){
event.skillDialog=ui.create.dialog(str,''+lib.translate[skill+'_info']+'
');
}
}
},
ok:function(node){
var event=_status.event;
if(event.custom.replace.confirm){
event.custom.replace.confirm(true);return;
}
event.result={
buttons:ui.selected.buttons.slice(0),
cards:ui.selected.cards.slice(0),
targets:ui.selected.targets.slice(0),
confirm:'ok',
bool:true,
links:get.links(ui.selected.buttons)
};
if(node){
node.parentNode.close();
}
if(event.skill){
event.result.skill=event.skill;
if(typeof get.info(event.skill).viewAs=='function') event.result.card=get.info(event.skill).viewAs(event.result.cards,event.player);
else event.result.card=get.copy(get.info(event.skill).viewAs);
if(event.result.cards.length==1&&event.result.card){
event.result.card.suit=get.suit(event.result.cards[0]);
event.result.card.number=get.number(event.result.cards[0]);
}
if(event.skillDialog&&get.objtype(event.skillDialog)=='div'){
event.skillDialog.close();
}
var cards=event.player.getCards('hej');
for(var i=0;i=4){
avatars.classList.add('scroll');
if(lib.config.touchscreen){
lib.setScroll(avatars);
}
}
for(var i=0;i<=num;i++){
var button=ui.create.div(avatars,function(){
playerbg.classList.remove('scroll');
if(this._link){
lib.config.skin[nameskin]=this._link;
bg.style.backgroundImage=this.style.backgroundImage;
if(sourcenode) sourcenode.style.backgroundImage=this.style.backgroundImage;
if(avatar) avatar.style.backgroundImage=this.style.backgroundImage;
game.saveConfig('skin',lib.config.skin);
}
else{
delete lib.config.skin[nameskin];
if(gzbool&&lib.character[nameskin2][4].contains('gzskin')&&lib.config.mode_config.guozhan.guozhanSkin){
bg.setBackground(nameskin2,'character');
if(sourcenode) sourcenode.setBackground(nameskin2,'character');
if(avatar) avatar.setBackground(nameskin2,'character');
}
else{
bg.setBackground(nameskin,'character');
if(sourcenode) sourcenode.setBackground(nameskin,'character');
if(avatar) avatar.setBackground(nameskin,'character');
}
game.saveConfig('skin',lib.config.skin);
}
});
button._link=i;
if(i){
button.setBackgroundImage('image/skin/'+nameskin+'/'+i+'.jpg');
}
else{
if(gzbool&&lib.character[nameskin2][4].contains('gzskin')&&lib.config.mode_config.guozhan.guozhanSkin) button.setBackground(nameskin2,'character','noskin');
else button.setBackground(nameskin,'character','noskin');
}
}
};
var num=1;
var loadImage=function(){
var img=new Image();
img.onload=function(){
num++;
loadImage();
}
img.onerror=function(){
num--;
createButtons(num);
}
img.src=lib.assetURL+'image/skin/'+nameskin+'/'+num+'.jpg';
}
if(lib.config.change_skin){
loadImage();
}
else{
createButtons(lib.skin[nameskin]);
}
};
};
if(lib.config.change_skin){
var img=new Image();
img.onload=changeskin;
img.src=lib.assetURL+'image/skin/'+nameskin+'/1.jpg';
}
else if(lib.config.debug&&lib.skin[nameskin]){
changeskin();
}
var ban=ui.create.div('.menubutton.large.ban.character',uiintro,'禁用',function(e){
if(this.classList.contains('unselectable')) return;
if(typeof noedit=='string'){
this.classList.toggle('active');
var bannedname=noedit+'_banned';
if(!lib.config[bannedname]){
lib.config[bannedname]=[];
}
if(this.classList.contains('active')){
lib.config[bannedname].add(name);
}
else{
lib.config[bannedname].remove(name);
}
game.saveConfig(bannedname,lib.config[bannedname]);
ban.updateBanned();
}
else{
ui.click.touchpop();
ui.click.intro.call(this,e);
_status.clicked=true;
}
});
ban.link=name;
ban._banning='offline';
ban.updateBanned=function(){
if(noedit===true) return;
if(lib.config[get.mode()+'_banned']&&lib.config[get.mode()+'_banned'].contains(name)){
ban.classList.add('active');
}
else{
ban.classList.remove('active');
}
if(sourcenode&&sourcenode.updateBanned){
sourcenode.updateBanned();
}
};
ban.updateBanned();
var fav=ui.create.div('.menubutton.large.fav',uiintro,'收藏',function(){
if(this.classList.contains('unselectable')) return;
this.classList.toggle('active');
if(this.classList.contains('active')){
lib.config.favouriteCharacter.add(name);
}
else{
lib.config.favouriteCharacter.remove(name);
}
game.saveConfig('favouriteCharacter',lib.config.favouriteCharacter);
});
if(noedit===true){
fav.classList.add('unselectable');
ban.classList.add('unselectable');
}
else if(lib.config.favouriteCharacter.contains(name)){
fav.classList.add('active');
}
var intro=ui.create.div('.characterintro',get.characterIntro(name),uiintro);
var intro2=ui.create.div('.characterintro.intro2',uiintro);
var list=get.character(name,3)||[];
var skills=ui.create.div('.characterskill',uiintro);
if(lib.config.touchscreen){
lib.setScroll(intro);
lib.setScroll(intro2);
lib.setScroll(skills);
}
if(lib.config.mousewheel){
skills.onmousewheel=ui.click.mousewheel;
}
var clickSkill=function(e){
var current=this.parentNode.querySelector('.active');
if(current){
current.classList.remove('active');
}
this.classList.add('active');
intro2.innerHTML=''+get.translation(this.link)+' '+get.skillInfoTranslation(this.link);
var info=get.info(this.link);
var skill=this.link;
var playername=this.linkname;
var skillnode=this;
if(info.derivation){
var derivation=info.derivation;
if(typeof derivation=='string'){
derivation=[derivation];
}
for(var i=0;i'+get.translation(derivation[i])+' '+get.skillInfoTranslation(derivation[i]);
}
}
if(info.alter){
intro2.innerHTML+='
';
var skillversionnode=intro2.querySelector('.hrefnode.skillversion');
if(lib.config.vintageSkills.contains(skill)){
skillversionnode.innerHTML='切换至新版';
}
else{
skillversionnode.innerHTML='切换至旧版';
}
skillversionnode.listen(function(){
if(lib.config.vintageSkills.contains(skill)){
lib.config.vintageSkills.remove(skill);
lib.translate[skill+'_info']=lib.translate[skill+'_info_alter'];
}
else{
lib.config.vintageSkills.push(skill);
lib.translate[skill+'_info']=lib.translate[skill+'_info_origin'];
}
game.saveConfig('vintageSkills',lib.config.vintageSkills);
clickSkill.call(skillnode,'init');
});
}
if(lib.config.background_speak&&e!=='init'){
var audioname=this.link;
if(info.audioname2&&info.audioname2[playername]){
audioname=info.audioname2[playername];
info=lib.skill[audioname];
}
var audioinfo=info.audio;
var that=this;
var getIndex=function(i){
if(typeof that.audioindex!='number'){
that.audioindex=i;
}
that.audioindex++;
if(that.audioindex>i){
that.audioindex=1;
}
return that.audioindex;
};
if(typeof audioinfo=='string'){
if(audioinfo.indexOf('ext:')==0){
audioinfo=audioinfo.split(':');
if(audioinfo.length==3){
if(audioinfo[2]=='true'){
game.playAudio('..','extension',audioinfo[1],audioname);
}
else{
audioinfo[2]=parseInt(audioinfo[2]);
if(audioinfo[2]){
game.playAudio('..','extension',audioinfo[1],audioname+getIndex(audioinfo[2]));
}
}
}
return;
}
else{
audioname=audioinfo;
if(lib.skill[audioinfo]){
audioinfo=lib.skill[audioinfo].audio;
}
}
}
else if(Array.isArray(audioinfo)){
audioname=audioinfo[0];
audioinfo=audioinfo[1];
}
if(typeof audioinfo=='number'){
if(Array.isArray(info.audioname)&&info.audioname.contains(playername)) audioname=audioname+'_'+playername;
game.playAudio('skill',audioname+getIndex(audioinfo));
}
else if(audioinfo){
if(Array.isArray(info.audioname)&&info.audioname.contains(playername)) audioname=audioname+'_'+playername;
game.playAudio('skill',audioname);
}
else if(true&&info.audio!==false){
if(Array.isArray(info.audioname)&&info.audioname.contains(playername)) audioname=audioname+'_'+playername;
game.playSkillAudio(audioname,getIndex(2));
}
}
}
var initskill=false;
for(var i=0;i 0 || evt.wheelDelta < 0){
node.interval=setInterval(function(){
if(num--&&Math.abs(node.scrollLeft+node.clientWidth-node.scrollWidth)>0){
node.scrollLeft +=speed;
}
else{
clearInterval(node.interval);
}
},16);
}
else{
node.interval=setInterval(function(){
if(num--&&node.scrollLeft>0){
node.scrollLeft -=speed;
}
else{
clearInterval(node.interval);
}
},16);
}
},
touchStart:function(e){
this.startX=e.touches[0].clientX/game.documentZoom;
this.startY=e.touches[0].clientY/game.documentZoom;
_status.dragged=false;
},
dialogtouchStart:function(e){
ui.click.touchStart.call(this,e);
_status.dialogtouched=true;
},
touchScroll:function(e) {
if(_status.mousedragging) return;
if(_status.draggingtouchdialog) return;
if(!_status.dragged){
if (Math.abs(e.touches[0].clientX/game.documentZoom - this.startX) > 10 ||
Math.abs(e.touches[0].clientY/game.documentZoom - this.startY) > 10) {
_status.dragged=true;
}
}
if((this==ui.handcards1Container||this==ui.handcards2Container)&&!this.classList.contains('scrollh')){
e.preventDefault();
}
else if(lib.device=='ios'&&this.scrollHeight<=this.offsetHeight+5&&this.scrollWidth<=this.offsetWidth+5){
e.preventDefault();
}
else{
delete _status._swipeorigin;
e.stopPropagation();
}
},
autoskill:function(bool,node){
var list=lib.config.autoskilllist;
if(bool){
list.remove(node.link);
}
else{
list.add(node.link);
}
game.saveConfig('autoskilllist',list);
},
skillbutton:function(){
this.func(this.link);
},
autoskill2:function(e){
this.classList.toggle('on');
var list=[];
if(lib.skill[this.link].frequent){
list.push(this.link);
}
if(lib.skill[this.link].subfrequent){
for(var i=0;i 0.2){
// _status.force=true;
// var taptic=false;
// if(_status.longpressing){
// delete _status.longpressing._waitingfordrag;
// ui.click.touchpop();
// ui.click.longpresscallback.call(_status.longpressing);
// taptic=true;
// }
// else if(!_status.forceright){
// _status.forceright=true;
// setTimeout(function(){
// _status.forceright=false;
// },600);
// if(_status.mousedragging){
// _status.mousedragging=null;
// _status.mouseleft=false;
// _status.mousedragorigin=null;
// _status.dragstatuschanged=false;
// game.uncheck();
// game.check();
// }
// switch(lib.config.pressure_click){
// case 'pause':ui.click.pause();break;
// case 'auto':ui.click.auto();break;
// case 'config':ui.click.config();break;
// }
// taptic=true;
// }
// if(taptic&&lib.config.pressure_taptic){
// if(window.TapticEngine){
// window.TapticEngine.generateTapticFeedback();
// }
// else{
// game.vibrate(50);
// }
// }
// }
// }
// });
// },
// pressurepause:function(force,event){
// if(!_status.force&&!_status.mousedragging&&force>=0.5&&!_status.forceright){
// _status.force=true;
// _status.forceright=true;
// setTimeout(function(){
// _status.forceright=false;
// },600);
// switch(lib.config.pressure_click){
// case 'pause':ui.click.pause();break;
// case 'auto':ui.click.auto();break;
// case 'config':ui.click.config();break;
// }
// }
// },
// rightpressure:function(force, event){
// if(force>0){
// _status.force=true;
// }
// if(force>=0.5){
// if(_status.mousedragging){
// _status.mousedragging=null;
// _status.mouseleft=false;
// _status.mousedragorigin=null;
// _status.dragstatuschanged=false;
// game.uncheck();
// game.check();
// }
// ui.click.rightplayer.call(this,event);
// _status.clickedplayer=false;
// }
// },
rightplayer:function(e){
if(this._nopup) return false;
if(_status.clickedplayer){
return false;
}
if(this._mouseenterdialog&&this._mouseenterdialog.parentNode){
this._mouseenterdialog.delete();
}
else{
ui.click.intro.call(this,e);
}
_status.clickedplayer=true;
_status.clicked=false;
ui.click.longpresscancel.call(this);
return false;
},
right:function(e){
if(window.inSplash) return false;
if(lib.config.touchscreen) return;
if(_status.noright){
_status.noright=false;
return false;
}
if(_status.clickedplayer){
_status.clickedplayer=false;
return;
}
game.closePopped();
switch(lib.config.right_click){
case 'shortcut':ui.click.shortcut();break;
case 'pause':ui.click.pause();break;
case 'auto':ui.click.auto();break;
case 'config':ui.click.config();break;
}
e.preventDefault();
return false;
}
},
selected:{
buttons:[],cards:[],targets:[]
},
clear:function(){
game.addVideo('uiClear');
var thrown=document.getElementsByClassName('thrown');
var nodes=[];
var i;
for(i=0;i=fullwidth){
var current_offset=stayleft._offset;
if(fullright){
stayleft._offset=Math.ceil(-ui.arena.offsetWidth/2)+135;
if((game.layout=='long2'||game.layout=='nova')&&ui.arena.dataset.number=='8'&&get.mode()!='boss'){
stayleft._offset+=game.me.getLeft();
}
}
else{
stayleft._offset=Math.ceil(-ui.arena.offsetWidth/2)+165;
}
if(current_offset!=stayleft._offset){
stayleft.animate('controlpressdownx',500);
stayleft.style.transform='translateX('+stayleft._offset+'px)';
}
}
else{
add(stayleft,true);
}
}
if(!controls.length) return;
var offset=-length/2;
var control=controls.shift();
if(control._offset!=offset){
control.animate('controlpressdownx',500);
control.style.transform='translateX('+offset+'px)';
control._offset=offset;
}
while(controls.length){
var control=controls.shift();
var width=widths.shift();
offset+=width+6;
if(get.is.phoneLayout()){
offset+=6;
}
if(control._offset!=offset){
control.animate('controlpressdownx',500);
control.style.transform='translateX('+offset+'px)';
control._offset=offset;
}
}
},
updatex:function(){
ui.update.apply(this,arguments);
ui.updatehl();
for(var i=0;i1&&offset1<32){
offset1=32;
ui.handcards1Container.classList.add('scrollh');
}
else{
ui.handcards1Container.classList.remove('scrollh');
}
}
if(offset1<100){
offset12=100-offset1;
}
for(var i=0;i40){
offset12=90-hs1[i].node.info.offsetWidth;
hs1[i].node.info.querySelector('span').style.display='none';
if(hs1[i].node.name.classList.contains('long')){
hs1[i].node.name.style.transform='translateY(16px) scale(0.85)';
hs1[i].node.name.style.transformOrigin='top left';
}
else{
hs1[i].node.name.style.transform='translateY(16px)';
}
hs1[i].node.info.style.transform='translateX(-'+offset12+'px) translateY(-3px)';
}
else{
hs1[i].node.info.querySelector('span').style.display='';
hs1[i].node.name.style.transform='';
hs1[i].node.name.style.transformOrigin='';
hs1[i].node.info.style.transform='translateX(-'+offset12+'px)';
}
}
ui.handcards1Container.firstChild.style.width=(offset1*(hs1.length-1)+118)+'px';
var offset2,offset22=0;
if(!lib.config.fold_card){
offset2=112;
ui.handcards2Container.classList.add('scrollh');
}
else{
offset2=Math.min(112,(ui.handcards2Container.offsetWidth-128)/(hs2.length-1));
if(hs2.length>1&&offset2<32){
offset2=32;
ui.handcards2Container.classList.add('scrollh');
}
else{
ui.handcards2Container.classList.remove('scrollh');
}
}
if(offset2<100){
offset22=100-offset2;
}
for(var i=0;i40){
offset22=90-hs2[i].node.info.offsetWidth;
hs2[i].node.info.querySelector('span').style.display='none';
if(hs2[i].node.name.classList.contains('long')){
hs2[i].node.name.style.transform='translateY(16px) scale(0.85)';
hs2[i].node.name.style.transformOrigin='top left';
}
else{
hs2[i].node.name.style.transform='translateY(16px)';
}
hs2[i].node.info.style.transform='translateX(-'+offset22+'px) translateY(-3px)';
}
else{
hs2[i].node.info.querySelector('span').style.display='';
hs2[i].node.name.style.transform='';
hs2[i].node.name.style.transformOrigin='';
hs2[i].node.info.style.transform='translateX(-'+offset22+'px)';
}
}
ui.handcards2Container.firstChild.style.width=(offset2*(hs2.length-1)+118)+'px';
},
updateh:function(compute){
if(!game.me) return;
if(!ui.handcards1Container) return;
if(lib.config.low_performance){
if(compute){
ui.updatehl();
setTimeout(ui.updatehl,1000);
}
return;
}
if(compute){
ui.handcards1Container._handcardsWidth=ui.handcards1Container.offsetWidth;
ui.handcards2Container._handcardsWidth=ui.handcards2Container.offsetWidth;
}
ui.updatehx(game.me.node.handcards1);
ui.updatehx(game.me.node.handcards2);
},
updatehx:function(node){
var width=node.parentNode._handcardsWidth;
var num=node.childElementCount-node.getElementsByClassName('removing').length;
node.classList.remove('fold0');
node.classList.remove('fold1');
node.classList.remove('fold2');
node.classList.remove('fold3');
if(num*78+40>=width){
// node.dataset.fold=3;
node.classList.add('fold3');
}
else if(num*93+25>=width){
// node.dataset.fold=2;
node.classList.add('fold2');
}
else if(num*112+6>=width){
// node.dataset.fold=1;
node.classList.add('fold1');
}
else{
// node.dataset.fold=0;
node.classList.add('fold0');
}
},
updated:function(){
if (document.documentElement.offsetWidth<900 || document.documentElement.offsetHeight < 500) {
game.deviceZoom=Math.min(
Math.round(document.documentElement.offsetWidth/98)/10,
Math.round(document.documentElement.offsetHeight/50)/10
);
}
else {
game.deviceZoom=1;
}
},
updatez:function(){
var width=document.documentElement.offsetWidth;
var height=document.documentElement.offsetHeight;
var zoom=game.documentZoom;
if(zoom!=1){
document.body.style.width=Math.round(width/zoom)+'px';
document.body.style.height=Math.round(height/zoom)+'px';
document.body.style.transform='scale('+(Math.floor(zoom*100)/100)+')';
}
else{
document.body.style.width=width+'px';
document.body.style.height=height+'px';
document.body.style.transform='';
}
},
update:function(){
for(var i=0;i=height1&&height2>=210))){
ui.dialog.classList.remove('scroll1');
ui.dialog.classList.remove('scroll2');
}
else{
ui.dialog.classList.add('scroll1');
ui.dialog.classList.add('scroll2');
if(game.layout!='default'){
ui.dialog.style.height=Math.min(height1,((game.layout=='long2'||game.layout=='nova')&&ui.arena.classList.contains('choose-character'))?380:350)+'px';
ui.dialog._scrollset=true;
}
}
if(game.layout=='long2'||game.layout=='nova'){
if(height1+240>=ui.arena.offsetHeight){
ui.dialog.classList.add('scroll3');
}
else{
ui.dialog.classList.remove('scroll3');
}
}
}
}
},
recycle:function(node,key){
if(!ui._recycle) ui._recycle={};
if(typeof node=='string'){
return ui._recycle[node]
}
ui._recycle[key]=node;
},
};
var get={
sourceCharacter:function(str){
if(str){
for(var i in lib.characterReplace){
if(lib.characterReplace[i].contains(str)) return i;
}
}
return str;
},
isLuckyStar:function(player){
if(player&&player.hasSkillTag('luckyStar')) return true;
if(_status.connectMode) return false;
return (!player||player==game.me||player.isUnderControl())&&lib.config.lucky_star==true;
},
infoHp:function(hp){
if(typeof hp=='number') return hp;
else if(typeof hp=='string'&&hp.indexOf('/')!=-1){
return parseInt(hp.slice(0,hp.indexOf('/')));
}
return 0;
},
infoMaxHp:function(hp){
if(typeof hp=='number') return hp;
else if(typeof hp=='string'&&hp.indexOf('/')!=-1){
return parseInt(hp.slice(hp.indexOf('/')+1));
}
return 0;
},
is:{
yingbian:function(node){
return get.cardtag(node,'yingbian_zhuzhan')||get.cardtag(node,'yingbian_fujia')||get.cardtag(node,'yingbian_canqu')||get.cardtag(node,'yingbian_kongchao');
},
emoji:function(substring){
if(substring){
var reg=new RegExp("[~#^$@%&!?%*]",'g');
if(substring.match(reg)){
return true;
}
for(var i=0;i1){
var ls=substring.charCodeAt(i+1);
var uc=((hs-0xd800)*0x400)+(ls-0xdc00)+0x10000;
if(0x1d000<=uc&&uc<=0x1f77f){
return true;
}
}
}
else if(substring.length>1){
var ls=substring.charCodeAt(i+1);
if(ls==0x20e3){
return true;
}
}
else{
if(0x2100<=hs&&hs<=0x27ff){
return true;
}
else if(0x2B05<=hs&&hs<=0x2b07){
return true;
}
else if(0x2934<=hs&&hs<=0x2935){
return true;
}
else if(0x3297<=hs&&hs<=0x3299){
return true;
}
else if(hs==0xa9||hs==0xae||hs==0x303d||hs==0x3030
||hs==0x2b55||hs==0x2b1c||hs==0x2b1b
||hs==0x2b50){
return true;
}
}
}
}
return false;
},
banWords:function(str){
if(get.is.emoji(str)) return true;
for(var i of window.bannedKeyWords){
if(str.indexOf(i)!=-1) return true;
}
return false;
},
converted:function(event){
return !(event.card&&event.card.isCard);
},
safari:function(){
var ua=navigator.userAgent.toLowerCase();
return ua.indexOf('safari'!=-1)&&ua.indexOf('chrome')==-1;
},
freePosition:function(cards){
for(var i=0;i'+str.slice(2)+'';
}
return str;
},
evtprompt:function(next,str){
if(next.prompt){
next.set('prompt2',str);
}
else{
if(str.indexOf('###')==0){
var prompts=str.slice(3).split('###');
if(prompts[0]) next.set('prompt',prompts[0]);
if(prompts[1]) next.set('prompt2',prompts[1]);
}
else{
next.set('prompt',str);
}
}
},
autoViewAs:function(card,cards){
var info=get.info(card);
if(info.autoViewAs){
if(cards===false){
return {
name:info.autoViewAs
};
}
else if(Array.isArray(cards)){
return {
name:info.autoViewAs,
cards:cards.slice(0)
};
}
else if(get.itemtype(card)=='card'){
return {
name:info.autoViewAs,
cards:[card]
};
}
else{
return {
name:info.autoViewAs,
suit:card.suit,
number:card.number,
nature:card.nature,
};
}
}
else{
if(card.isCard||get.itemtype(card)=='card'){
var next={
name:get.name(card),
suit:get.suit(card),
number:card.number,
nature:get.nature(card),
isCard:true,
cardid:card.cardid,
wunature:card.wunature,
storage:card.storage,
cards:card.cards,
};
if(get.itemtype(cards)=='cards'&&!card.cards) next.cards=cards.slice(0);
else if(get.itemtype(card)=='card') next.cards=[card];
return next;
}
else if(get.is.object(card)&&get.itemtype(cards)=='cards'&&!card.cards){
card=get.copy(card);
card.cards=cards.slice(0);
}
return card;
}
},
max:function(list,func,type){
list=list.slice(0);
if(typeof func=='string'){
var key=func;
func=function(item){
return item[key];
}
}
list.sort(function(a,b){
return func(b)-func(a);
});
if(type=='list'){
var list2=[];
for(var i=0;i0) return 1;
if(num<0) return -1;
return 0;
},
rand:function(num,num2){
if(typeof num2=='number'){
return num+Math.floor(Math.random()*(num2-num+1));
}
else{
return Math.floor(Math.random()*num);
}
},
sort:function(arr,method){
switch(method){
case 'seat':{
lib.tempSortSeat=arguments[2];
arr.sort(lib.sort.seat);
delete lib.tempSortSeat;
return arr;
}
}
},
sortSeat:function(arr,target){
lib.tempSortSeat=target;
arr.sort(lib.sort.seat);
delete lib.tempSortSeat;
return arr;
},
zip:function(callback){
if(!window.JSZip){
lib.init.js(lib.assetURL+'game','jszip',function(){
callback(new JSZip());
});
}
else{
callback(new JSZip());
}
},
delayx:function(num,max){
if(typeof num!='number') num=1;
if(typeof max!='number') max=Infinity;
switch(lib.config.game_speed){
case 'vslow':return Math.min(max,2.5*num);
case 'slow':return Math.min(max,1.5*num);
case 'fast':return Math.min(max,0.7*num);
case 'vfast':return Math.min(max,0.4*num);
case 'vvfast':return Math.min(max,0.2*num);
default:return Math.min(max,num);
}
},
prompt:function(skill,target,player){
player=player||_status.event.player;
if(target){
var str=get.translation(target);
if(target==player){
str+='(你)'
}
return '是否对'+str+'发动【'+get.skillTranslation(skill,player)+'】?';
}
else{
return '是否发动【'+get.skillTranslation(skill,player)+'】?';
}
},
prompt2:function(skill,target,player){
var str=get.prompt.apply(this,arguments);
if(!lib.translate[skill+'_info']) return str;
return '###'+str+'###'+lib.translate[skill+'_info'];
},
url:function(master){
var url=lib.config.updateURL||lib.updateURL;
if(url[url.length-1]!='/'){
url+='/';
}
if(master!='nodev'){
return url+'master/';
}
else{
return url+'v'+lib.version+'/';
}
},
round:function(num,f){
var round=1;
for(var i=0;i1&&threaten>1){
num+=Math.sqrt(threaten)-1;
}
}
else if(type=='out'){
if(threaten<1){
num=1/Math.sqrt(threaten);
}
if(info.trigger&&(info.trigger.global||info.trigger.target||(typeof info.trigger.player=='string'&&
(info.trigger.player.indexOf('damage')==0||info.trigger.player.indexOf('lose')==0)))) num+=0.1;
if(info.ai){
if(info.ai.maixie||info.ai.maixie_hp||info.ai.maixie_defend){
num+=0.5;
}
if(info.ai.nolose||info.ai.noh||info.ai.noe||info.ai.nodiscard){
num+=0.3;
}
}
}
if(!grouped){
var groups=game.expandSkills([skill]);
groups.remove(skill);
var ggt=[];
for(var i=0;i1){
ggt.push(gi);
}
}
if(ggt.length){
num+=Math.max.apply(this,ggt)-1+ggt.length/20;
}
}
return num;
},
targetsInfo:function(targets){
var info=[];
for(var i=0;i';
}
}
return str2;
},
numStr:function(num,method){
if(num==Infinity){
if(method=='card') return get.selectableCards().length+ui.selected.cards.length;
if(method=='target') return get.selectableTargets().length+ui.selected.targets.length;
return '∞';
}
return num.toString();
},
rawName:function(str){
if(lib.translate[str+'_ab']) return lib.translate[str+'_ab'];
var str2=lib.translate[str];
if(!str2) return '';
if(str2.indexOf('SP')==0){
str2=str2.slice(2);
}
else if(str2.indexOf('TW')==0){
str2=str2.slice(2);
}
else if(str2.indexOf('OL')==0){
str2=str2.slice(2);
}
else if(str2.indexOf('JSP')==0){
str2=str2.slice(3);
}
else if(str2.indexOf('☆SP')==0){
str2=str2.slice(3);
}
else if(str2.indexOf('手杀')==0){
str2=str2.slice(2);
}
else if(str2.indexOf('界')==0&&lib.characterPack.refresh&&lib.characterPack.refresh[str]){
str2=str2.slice(1);
}
else if(str2.indexOf('旧')==0&&(lib.characterPack.old||lib.characterPack.mobile)&&(lib.characterPack.old[str]||lib.characterPack.mobile[str])){
str2=str2.slice(1);
}
else if(str2.indexOf('新')==0&&(str.indexOf('re_')==0||str.indexOf('new_')==0)){
str2=str2.slice(1);
}
return str2;
},
rawName2:function(str){
if(lib.translate[str+'_ab']) return lib.translate[str+'_ab'];
var str2=lib.translate[str];
if(!str2) return '';
if(str2.indexOf('SP')==0){
str2=str2.slice(2);
}
else if(str2.indexOf('TW')==0){
str2=str2.slice(2);
}
else if(str2.indexOf('OL')==0){
str2=str2.slice(2);
}
else if(str2.indexOf('JSP')==0){
str2=str2.slice(3);
}
else if(str2.indexOf('☆SP')==0){
str2=str2.slice(3);
}
else if(str2.indexOf('手杀')==0){
str2=str2.slice(2);
}
return str2;
},
slimName:function(str){
var str2=lib.translate[str];
if(lib.translate[str+'_ab']) str2=lib.translate[str+'_ab'];
if(!str2) return '';
if(str2.indexOf('SP')==0){
str2=str2.slice(2);
}
else if(str2.indexOf('TW')==0){
str2=str2.slice(2);
}
else if(str2.indexOf('OL')==0){
str2=str2.slice(2);
}
else if(str2.indexOf('JSP')==0){
str2=str2.slice(3);
}
else if(str2.indexOf('☆SP')==0){
str2=str2.slice(3);
}
else if(str2.indexOf('手杀')==0){
str2=str2.slice(2);
}
return get.verticalStr(str2,true);
},
time:function(){
if(lib.status.dateDelaying){
return lib.getUTC(lib.status.dateDelaying)-lib.getUTC(lib.status.date)-lib.status.dateDelayed;
}
else{
return lib.getUTC(new Date())-lib.getUTC(lib.status.date)-lib.status.dateDelayed;
}
},
utc:function(){
return (new Date()).getTime();
},
evtDistance:function(e1,e2){
var dx=(e1.clientX-e2.clientX)/game.documentZoom;
var dy=(e1.clientY-e2.clientY)/game.documentZoom;
return Math.sqrt(dx*dx+dy*dy);
},
xyDistance:function(from,to){
return Math.sqrt((from[0]-to[0])*(from[0]-to[0])+(from[1]-to[1])*(from[1]-to[1]));
},
itemtype:function(obj){
var i,j;
if(typeof obj=='string'){
if(obj.length<=3){
var bool=true;
for(i=0;i锁定技').
// replace(/限定技/g,'限定技 ').
// replace(/觉醒技/g,'觉醒技 ').
// replace(/主将技/g,'主将技 ').
// replace(/副将技/g,'副将技 ').
// replace(/阵法技/g,'阵法技 ').
// replace(/主公技/g,'主公技 ');
},
translation:function(str,arg){
if(str&&typeof str=='object'&&(str.name||str._tempTranslate)){
if(str._tempTranslate) return str._tempTranslate;
var str2;
if(arg=='viewAs'&&str.viewAs){
str2=get.translation(str.viewAs);
}
else{
str2=get.translation(str.name);
}
if(str2=='杀'){
if(str.nature=='fire'){
str2='火'+str2;
}
else if(str.nature=='thunder'){
str2='雷'+str2;
}
else if(str.nature=='kami'){
str2='神'+str2;
}
else if(str.nature=='ice'){
str2='冰'+str2;
}
}
if(get.itemtype(str)=='card'||str.isCard){
if(_status.cardtag&&str.cardid){
var tagstr='';
for(var i in _status.cardtag){
if(_status.cardtag[i].contains(str.cardid)){
tagstr+=lib.translate[i+'_tag'];
}
}
if(tagstr){
str2+='·'+tagstr;
}
}
if(str.suit&&str.number){
var cardnum=str.number||'';
if([1,11,12,13].contains(cardnum)){
cardnum={'1':'A','11':'J','12':'Q','13':'K'}[cardnum]
}
if(arg=='viewAs'&&str.viewAs!=str.name&&str.viewAs){
str2+='('+get.translation(str)+')';
}
else{
str2+='【'+get.translation(str.suit)+cardnum+'】';
// var len=str2.length-1;
// str2=str2.slice(0,len)+''+str2[len]+'· '+get.translation(str.suit)+str.number;
}
}
}
return str2;
}
if(Array.isArray(str)){
var str2=get.translation(str[0],arg);
for(var i=1;i0){
str2=str.slice(0,str.lastIndexOf('_'));
if(lib.translate[str2+'_info']) return lib.translate[str2+'_info'];
}
str2=str.slice(0,str.length-2);
if(lib.translate[str2+'_info']) return lib.translate[str2+'_info'];
if(lib.skill[str]&&lib.skill[str].prompt) return lib.skill[str].prompt;
}
if(lib.translate[str]){
return lib.translate[str];
}
if(typeof str=='string'){
return str;
}
if(typeof str=='number'||typeof str=='boolean'){
return str.toString();
}
if(str&&str.toString){
return str.toString();
}
return '';
},
cnNumber:function(num,two){
if(num==Infinity) return '∞';
if(isNaN(num)) return '';
if(typeof num!='number') return num;
if(num<0||num>99) return num;
if(num<=10){
switch(num){
case 0:return '〇';
case 1:return '一';
case 2:return two?'二':'两';
case 3:return '三';
case 4:return '四';
case 5:return '五';
case 6:return '六';
case 7:return '七';
case 8:return '八';
case 9:return '九';
case 10:return '十';
}
}
if(num<20){
return '十'+get.cnNumber(num-10,true);
}
var x=Math.floor(num/10);
return get.cnNumber(x,true)+'十'+(num>10*x?get.cnNumber(num-10*x,true):'');
},
selectableButtons:function(sort){
if(!_status.event.player) return[];
var buttons=_status.event.dialog.buttons;
var selectable=[];
for(var i=0;i【'+skilltrans+'】'+
get.skillInfoTranslation(skills[i])+'
';
}
}
return str;
},
intro:function(name){
var info=lib.character[name];
var str='性别:'+get.translation(info[0])+' ';
str+='势力:'+get.translation(info[1])+' ';
str+='体力:'+get.translation(info[2])+' ';
str+='技能:';
if(info[3].length){
str+=get.translation(info[3][0]);
for(var i=1;i0){
return '共有'+content+'个标记';
}
return false;
}
case 'turn':{
if(content>0){
return '剩余'+content+'个回合';
}
return false;
}
case 'time':{
if(content>0){
return '剩余'+content+'次';
}
return false;
}
case 'limited':{
if(content){
return '已发动';
}
return '未发动';
}
case 'info':{
return lib.translate[skill+'_info'];
}
case 'cardCount':{
if(typeof content=='object'&&typeof content.length=='number'){
return '共有'+get.cnNumber(content.length)+'张牌';
}
return false;
}
case 'card':case 'cards':{
if(get.itemtype(content)=='card'){
content=[content];
}
if(dialog&&get.itemtype(content)=='cards'){
dialog.addAuto(content);
}
else{
if(content&&content.length){
return get.translation(content);
}
}
if(Array.isArray(content)&&!content.length){
return '没有卡牌';
}
return false;
}
case 'player':case 'players':{
if(get.itemtype(content)=='player'){
content=[content];
}
if(dialog&&get.itemtype(content)=='players'){
dialog.addAuto(content);
return false;
}
else{
if(content&&content.length){
return get.translation(content);
}
return false;
}
}
case 'character':case 'characters':{
if(typeof content=='string'){
content=[content];
}
if(dialog&&Array.isArray(content)){
dialog.addAuto([content,'character']);
return false;
}
else{
if(content&&content.length){
return get.translation(content);
}
return false;
}
}
default:{
if(typeof type=='string'){
type=type.replace(/#/g,content);
type=type.replace(/&/g,get.cnNumber(content));
type=type.replace(/\$/g,get.translation(content));
return type;
}
else if(typeof type=='function'){
return type(content,player,skill);
}
return false;
}
}
},
nodeintro:function(node,simple,evt){
var uiintro=ui.create.dialog('hidden','notouchscroll');
if(node.classList.contains('player')&&!node.name){
return uiintro;
}
var i,translation,intro,str;
if(node._nointro) return;
if(typeof node._customintro=='function'){
if(node._customintro(uiintro)===false) return;
}
else if(Array.isArray(node._customintro)){
var caption=node._customintro[0];
var content=node._customintro[1];
if(typeof caption=='function'){
caption=caption(node);
}
if(typeof content=='function'){
content=content(node);
}
uiintro.add(caption);
uiintro.add(''+content+'
');
}
else if(node.classList.contains('player')||node.linkplayer){
if(node.linkplayer){
node=node.link;
}
var capt=get.translation(node.name);
if((lib.character[node.name]&&lib.character[node.name][1])||lib.group.contains(node.group)){
capt+=' '+(lib.group.contains(node.group)?get.translation(node.group):lib.translate[lib.character[node.name][1]]);
}
uiintro.add(capt);
if(lib.characterTitle[node.name]){
uiintro.addText(get.colorspan(lib.characterTitle[node.name]));
}
if(node.isUnderControl()||(!game.observe&&game.me&&game.me.hasSkillTag('viewHandcard',null,node,true))){
var hs=node.getCards('h');
if(hs.length){
uiintro.add('手牌
');
uiintro.addSmall(node.getCards('h'));
}
}
var skills=node.getSkills(false,false);
for(var i in node.forbiddenSkills){
skills.add(i);
}
skills=skills.slice(0);
var skills2=game.filterSkills(skills,node);
if(node==game.me&&node.hiddenSkills.length){
skills.addArray(node.hiddenSkills);
}
for(var i in node.disabledSkills){
if(node.disabledSkills[i].length==1&&
node.disabledSkills[i][0]==i+'_awake'&&
!node.hiddenSkills.contains(i)){
skills.push(i);
}
}
for(i=0;i';
if(node.forbiddenSkills[skills[i]].length){
forbidstr+='(与'+get.translation(node.forbiddenSkills[skills[i]])+'冲突) ';
}
else{
forbidstr+='(双将禁用) ';
}
forbidstr+=get.skillInfoTranslation(skills[i],node)+'
'
uiintro.add(forbidstr);
}
else if(!skills2.contains(skills[i])){
uiintro.add('【'+translation+'】
'+get.skillInfoTranslation(skills[i],node)+'
');
}
else if(lib.skill[skills[i]].temp||!node.skills.contains(skills[i])||lib.skill[skills[i]].thundertext){
if(lib.skill[skills[i]].frequent||lib.skill[skills[i]].subfrequent){
uiintro.add('【'+translation+'】
'+get.skillInfoTranslation(skills[i],node)+'
自动发动
');
var underlinenode=uiintro.content.lastChild.querySelector('.underlinenode');
if(lib.skill[skills[i]].frequent){
if(lib.config.autoskilllist.contains(skills[i])){
underlinenode.classList.remove('on');
}
}
if(lib.skill[skills[i]].subfrequent){
for(var j=0;j【'+translation+'】
'+get.skillInfoTranslation(skills[i],node)+'
');
}
}
else if(lib.skill[skills[i]].frequent||lib.skill[skills[i]].subfrequent){
uiintro.add('【'+translation+'】
'+get.skillInfoTranslation(skills[i],node)+'
自动发动
');
var underlinenode=uiintro.content.lastChild.querySelector('.underlinenode');
if(lib.skill[skills[i]].frequent){
if(lib.config.autoskilllist.contains(skills[i])){
underlinenode.classList.remove('on');
}
}
if(lib.skill[skills[i]].subfrequent){
for(var j=0;j【'+translation+'】
'+get.skillInfoTranslation(skills[i],node)+'
').querySelector('.skillbutton');
if(!_status.gameStarted||(lib.skill[skills[i]].clickableFilter&&!lib.skill[skills[i]].clickableFilter(node))){
intronode.classList.add('disabled');
intronode.style.opacity=0.5;
}
else{
intronode.link=node;
intronode.func=lib.skill[skills[i]].clickable;
intronode.classList.add('pointerdiv');
intronode.listen(ui.click.skillbutton);
}
}
else if(lib.skill[skills[i]].nobracket){
uiintro.add(''+get.translation(skills[i])+'
'+lib.translate[skills[i]+'_info']+'
');
}
else{
uiintro.add('【'+translation+'】
'+get.skillInfoTranslation(skills[i],node)+'
');
}
if(lib.translate[skills[i]+'_append']){
uiintro._place_text=uiintro.add(''+lib.translate[skills[i]+'_append']+'
')
}
}
}
// if(get.is.phoneLayout()){
// var storage=node.storage;
// for(i in storage){
// if(get.info(i)&&get.info(i).intro){
// intro=get.info(i).intro;
// if(node.getSkills().concat(lib.skill.global).contains(i)==false&&!intro.show) continue;
// var name=intro.name?intro.name:get.translation(i);
// if(typeof name=='function'){
// name=name(storage[i],node);
// }
// translation='『'+name.slice(0,2)+'』
';
// var stint=get.storageintro(intro.content,storage[i],node,null,i);
// if(stint){
// translation+=stint+'
';
// uiintro.add(translation);
// }
// }
// }
// }
if(lib.config.right_range&&_status.gameStarted){
uiintro.add(ui.create.div('.placeholder'));
var table,tr,td;
table=document.createElement('table');
tr=document.createElement('tr');
table.appendChild(tr);
td=document.createElement('td');
td.innerHTML='距离';
tr.appendChild(td);
td=document.createElement('td');
td.innerHTML='手牌';
tr.appendChild(td);
td=document.createElement('td');
td.innerHTML='行动';
tr.appendChild(td);
td=document.createElement('td');
td.innerHTML='伤害';
tr.appendChild(td);
tr=document.createElement('tr');
table.appendChild(tr);
td=document.createElement('td');
if(node==game.me||!game.me||!game.me.isIn()){
td.innerHTML='-';
}
else{
var dist1=get.numStr(Math.max(1,game.me.distanceTo(node)));
var dist2=get.numStr(Math.max(1,node.distanceTo(game.me)));
if(dist1==dist2){
td.innerHTML=dist1;
}
else{
td.innerHTML=dist1+'/'+dist2;
}
}
tr.appendChild(td);
td=document.createElement('td');
td.innerHTML=node.countCards('h');
tr.appendChild(td);
td=document.createElement('td');
td.innerHTML=node.stat.length-1;
tr.appendChild(td);
td=document.createElement('td');
(function(){
num=0;
for(var j=0;j'+es[i].outerHTML+'
'+lib.translate[es[i].name+'_info']+'
');
uiintro.content.lastChild.querySelector('.skill>.card').style.transform='';
}
var js=node.getCards('j');
for(var i=0;i'+js[i].outerHTML+'
'+lib.translate[js[i].viewAs]+':'+lib.translate[js[i].viewAs+'_info']+'
');
}
else{
uiintro.add(''+js[i].outerHTML+'
'+lib.translate[js[i].name+'_info']+'
');
}
uiintro.content.lastChild.querySelector('.skill>.card').style.transform='';
}
if(get.is.phoneLayout()){
var markCoutainer=ui.create.div('.mark-container.marks');
for(var i in node.marks){
var nodemark=node.marks[i].cloneNode(true);
nodemark.classList.add('pointerdiv');
nodemark.link=node.marks[i];
nodemark.style.transform='';
markCoutainer.appendChild(nodemark);
nodemark.listen(function(){
uiintro.noresume=true;
var rect=this.link.getBoundingClientRect();
ui.click.intro.call(this.link,{
clientX:rect.left+rect.width,
clientY:rect.top+rect.height/2,
});
if(lib.config.touchscreen){
uiintro._close();
}
});
}
if(markCoutainer.childElementCount){
uiintro.addText('标记');
uiintro.add(markCoutainer);
}
}
}
if(!game.observe&&_status.gameStarted&&game.me&&node!=game.me){
ui.throwEmotion=[];
uiintro.addText('发送交互表情');
var click=function(){
if(_status.dragged) return;
if(_status.justdragged) return;
if(_status.throwEmotionWait) return;
var emotion=this.link;
if(game.online){
game.send('throwEmotion',node,emotion);
}
else game.me.throwEmotion(node,emotion);
uiintro._close();
_status.throwEmotionWait=true;
setTimeout(function(){
_status.throwEmotionWait=false;
if(ui.throwEmotion){
for(var i of ui.throwEmotion) i.classList.remove('exclude');
}
},(emotion=='flower'||emotion=='egg')?5000:10000)
};
var td;
var table=document.createElement('div');
table.classList.add('add-setting');
table.style.margin='0';
table.style.width='100%';
table.style.position='relative';
var listi=['flower','egg'];
for(var i=0;i';
td.addEventListener(lib.config.touchscreen?'touchend':'click',click);
}
uiintro.content.appendChild(table);
table=document.createElement('div');
table.classList.add('add-setting');
table.style.margin='0';
table.style.width='100%';
table.style.position='relative';
var listi=['wine','shoe'];
if(game.me.storage.zhuSkill_shanli) listi=['yuxisx','jiasuo'];
for(var i=0;i';
td.addEventListener(lib.config.touchscreen?'touchend':'click',click);
}
uiintro.content.appendChild(table);
}
var modepack=lib.characterPack['mode_'+get.mode()];
if(lib.config.show_favourite&&lib.character[node.name]&&game.players.contains(node)&&
(!modepack||!modepack[node.name])&&(!simple||get.is.phoneLayout())){
var addFavourite=ui.create.div('.text.center.pointerdiv');
addFavourite.link=node.link;
if(lib.config.favouriteCharacter.contains(node.name)){
addFavourite.innerHTML='移除收藏';
}
else{
addFavourite.innerHTML='添加收藏';
}
addFavourite.listen(ui.click.favouriteCharacter)
uiintro.add(addFavourite);
}
if(!simple||get.is.phoneLayout()){
if((lib.config.change_skin||lib.skin)&&!node.isUnseen()){
var num=1;
var introadded=false;
var createButtons=function(num,avatar2){
if(!introadded){
introadded=true;
uiintro.add('更改皮肤
');
}
var buttons=ui.create.div('.buttons.smallzoom.scrollbuttons');
lib.setMousewheel(buttons);
var nameskin=(avatar2?node.name2:node.name1);
var nameskin2=nameskin;
var gzbool=false;
if(nameskin.indexOf('gz_shibing')==0){
nameskin=nameskin.slice(3,11);
}
else if(nameskin.indexOf('gz_')==0){
nameskin=nameskin.slice(3);
gzbool=true;
}
for(var i=0;i<=num;i++){
var button=ui.create.div('.button.character.pointerdiv',buttons,function(){
if(this._link){
if(avatar2){
lib.config.skin[nameskin]=this._link;
node.node.avatar2.style.backgroundImage=this.style.backgroundImage;
}
else{
lib.config.skin[nameskin]=this._link;
node.node.avatar.style.backgroundImage=this.style.backgroundImage;
}
}
else{
delete lib.config.skin[nameskin];
if(avatar2){
if(gzbool&&lib.character[nameskin2][4].contains('gzskin')&&lib.config.mode_config.guozhan.guozhanSkin) node.node.avatar2.setBackground(nameskin2,'character');
else node.node.avatar2.setBackground(nameskin,'character');
}
else{
if(gzbool&&lib.character[nameskin2][4].contains('gzskin')&&lib.config.mode_config.guozhan.guozhanSkin) node.node.avatar.setBackground(nameskin2,'character');
else node.node.avatar.setBackground(nameskin,'character');
}
}
game.saveConfig('skin',lib.config.skin);
});
button._link=i;
if(i){
button.setBackgroundImage('image/skin/'+nameskin+'/'+i+'.jpg');
}
else{
if(gzbool&&lib.character[nameskin2][4].contains('gzskin')&&lib.config.mode_config.guozhan.guozhanSkin) button.setBackground(nameskin2,'character','noskin');
else button.setBackground(nameskin,'character','noskin');
}
}
uiintro.add(buttons);
};
var loadImage=function(avatar2){
var img=new Image();
img.onload=function(){
num++;
loadImage(avatar2);
}
img.onerror=function(){
num--;
if(num){
createButtons(num,avatar2);
}
if(!avatar2){
if(!node.classList.contains('unseen2')&&node.name2){
num=1;
loadImage(true);
}
}
}
var nameskin=(avatar2?node.name2:node.name1);
var nameskin2=nameskin;
var gzbool=false;
if(nameskin.indexOf('gz_shibing')==0){
nameskin=nameskin.slice(3,11);
}
else if(nameskin.indexOf('gz_')==0){
nameskin=nameskin.slice(3);
gzbool=true;
}
img.src=lib.assetURL+'image/skin/'+nameskin+'/'+num+'.jpg';
}
if(lib.config.change_skin){
if(!node.isUnseen(0)){
loadImage();
}
else if(node.name2){
loadImage(true);
}
}
else{
setTimeout(function(){
var nameskin1=node.name1;
var nameskin2=node.name2;
if(nameskin1&&nameskin1.indexOf('gz_')==0){
nameskin1=nameskin1.slice(3);
}
if(nameskin2&&nameskin2.indexOf('gz_')==0){
nameskin2=nameskin2.slice(3);
}
if(!node.isUnseen(0)&&lib.skin[nameskin1]){
createButtons(lib.skin[nameskin1]);
}
if(!node.isUnseen(1)&&lib.skin[nameskin2]){
createButtons(lib.skin[nameskin2],true);
}
});
}
}
}
uiintro.add(ui.create.div('.placeholder.slim'));
}
else if(node.classList.contains('mark')&&node.info&&
node.parentNode&&node.parentNode.parentNode&&node.parentNode.parentNode.classList.contains('player')){
var info=node.info;
var player=node.parentNode.parentNode;
if(info.name){
if(typeof info.name=='function'){
var named=info.name(player.storage[node.skill],player);
if(named){
uiintro.add(named);
}
}
else{
uiintro.add(info.name);
}
}
else if(info.name!==false){
uiintro.add(get.translation(node.skill));
}
if(typeof info.id=='string'&&info.id.indexOf('subplayer')==0&&
player.isUnderControl(true)&&player.storage[info.id]&&!_status.video){
var storage=player.storage[info.id];
uiintro.addText('当前体力:'+storage.hp+'/'+storage.maxHp);
if(storage.hs.length){
uiintro.addText('手牌区');
uiintro.addSmall(storage.hs);
}
if(storage.es.length){
uiintro.addText('装备区');
uiintro.addSmall(storage.es);
}
}
if(typeof info.mark=='function'){
var stint=info.mark(uiintro,player.storage[node.skill],player);
if(stint){
var placetext=uiintro.add(''+stint+'
');
if(stint.indexOf(''+stint+'
');
// }
// else{
// uiintro.add(''+stint+'
');
// }
}
}
else{
var stint=get.storageintro(info.content,player.storage[node.skill],player,uiintro,node.skill);
if(stint){
if(stint[0]=='@'){
uiintro.add(''+stint.slice(1)+'
');
}
else{
var placetext=uiintro.add(''+stint+'
');
if(stint.indexOf(''+stint+'
');
// }
// else{
// uiintro.add(''+stint+'
');
// }
}
}
uiintro.add(ui.create.div('.placeholder.slim'));
}
else if(node.classList.contains('card')){
//卡牌长按介绍
if(ui.arena.classList.contains('observe')&&node.parentNode.classList.contains('handcards')){
return;
}
var name=node.name;
if(node.parentNode.cardMod){
var moded=false;
for(var i in node.parentNode.cardMod){
var item=node.parentNode.cardMod[i](node);
if(Array.isArray(item)){
moded=true;
uiintro.add(item[0]);
uiintro._place_text=uiintro.add(''+item[1]+'
');
}
}
if(moded) return uiintro;
}
if(node.link&&node.link.name&&lib.card[node.link.name]){
name=node.link.name;
}
if(get.position(node)=='j'&&node.viewAs&&node.viewAs!=name){
uiintro.add(get.translation(node.viewAs));
uiintro.add('('+get.translation(get.translation(node))+')
');
// uiintro.add(get.translation(node.viewAs)+'('+get.translation(node)+')
');
uiintro.nosub=true;
name=node.viewAs;
}
else{
uiintro.add(get.translation(node));
}
if(node._banning){
var clickBanned=function(){
var banned=lib.config[this.bannedname]||[];
if(banned.contains(name)){
banned.remove(name);
}
else{
banned.push(name);
}
game.saveConfig(this.bannedname,banned);
this.classList.toggle('on');
if(node.updateBanned){
node.updateBanned();
}
};
var modeorder=lib.config.modeorder||[];
for(var i in lib.mode){
modeorder.add(i);
}
var list=[];
uiintro.contentContainer.listen(function(e){
ui.click.touchpop();
e.stopPropagation();
});
for(var i=0;i攻击范围:'+(-dist.attackFrom+1)+'');
}
}
if(!added){
uiintro.add('攻击范围:1
');
}
}
else if(get.subtype(node)){
uiintro.add(''+get.translation(get.subtype(node))+'
');
}
else if(lib.card[name]&&lib.card[name].addinfomenu){
uiintro.add(''+lib.card[name].addinfomenu+'
');
}
else if(lib.card[name]&&lib.card[name].derivation){
if(typeof lib.card[name].derivation=='string'){
uiintro.add('来源:'+get.translation(lib.card[name].derivation)+'
');
}
else if(lib.card[name].derivationpack){
uiintro.add('来源:'+get.translation(lib.card[name].derivationpack+'_card_config')+'包
');
}
}
else{
if(lib.card[name].unique){
uiintro.add('特殊'+get.translation(lib.card[name].type)+'牌
');
}
else{
if(lib.card[name].type&&lib.translate[lib.card[name].type]) uiintro.add(''+get.translation(lib.card[name].type)+'牌
');
}
}
if(lib.card[name].unique&&lib.card[name].type=='equip'){
if(lib.cardPile.guozhan&&lib.cardPack.guozhan.contains(name)){
uiintro.add('专属装备
').style.marginTop='-5px';
}
else{
uiintro.add('特殊装备
').style.marginTop='-5px';
}
}
}
if(lib.translate[name+'_info']){
var placetext=uiintro.add(''+lib.translate[name+'_info']+'
');
if(lib.translate[name+'_info'].indexOf('应变:'+lib.card[name].yingbian_prompt(node.link||node)+'
');
else uiintro.add('应变:'+lib.card[name].yingbian_prompt+'
');
}
if(lib.translate[name+'_append']){
uiintro.add(''+lib.translate[name+'_append']+'
');
}
}
uiintro.add(ui.create.div('.placeholder.slim'));
}
}
else if(node.classList.contains('character')){
var character=node.link;
if(lib.character[node.link]&&lib.character[node.link][1]){
uiintro.add(get.translation(character)+' '+lib.translate[lib.character[node.link][1]]);
}
else{
uiintro.add(get.translation(character));
}
if(lib.characterTitle[node.link]){
uiintro.addText(get.colorspan(lib.characterTitle[node.link]));
}
if(node._banning){
var clickBanned=function(){
var banned=lib.config[this.bannedname]||[];
if(banned.contains(character)){
banned.remove(character);
}
else{
banned.push(character);
}
game.saveConfig(this.bannedname,banned);
this.classList.toggle('on');
if(node.updateBanned){
node.updateBanned();
}
};
var modeorder=lib.config.modeorder||[];
for(var i in lib.mode){
modeorder.add(i);
}
var list=[];
uiintro.contentContainer.listen(function(e){
ui.click.touchpop();
e.stopPropagation();
});
for(var i=0;i'+get.translation(skills[i])+'
'+get.skillInfoTranslation(skills[i])+'
');
}
else{
uiintro.add('【'+translation+'】
'+get.skillInfoTranslation(skills[i])+'
');
}
if(lib.translate[skills[i]+'_append']){
uiintro._place_text=uiintro.add(''+lib.translate[skills[i]+'_append']+'
')
}
}
}
var modepack=lib.characterPack['mode_'+get.mode()];
if(lib.config.show_favourite&&
lib.character[node.link]&&(!modepack||!modepack[node.link])&&(!simple||get.is.phoneLayout())){
var addFavourite=ui.create.div('.text.center.pointerdiv');
addFavourite.link=node.link;
addFavourite.style.marginBottom='15px';
if(lib.config.favouriteCharacter.contains(node.link)){
addFavourite.innerHTML='移除收藏';
}
else{
addFavourite.innerHTML='添加收藏';
}
addFavourite.listen(ui.click.favouriteCharacter)
uiintro.add(addFavourite);
}
else{
uiintro.add(ui.create.div('.placeholder.slim'));
}
var addskin=false;
if(node.parentNode.classList.contains('menu-buttons')){
addskin=!lib.config.show_charactercard;
}
else{
addskin=lib.config.change_skin||lib.skin;
}
if(addskin&&(!simple||get.is.phoneLayout())){
var num=1;
var introadded=false;
var nameskin=node.link;
var nameskin2=nameskin;
var gzbool=false;
if(nameskin.indexOf('gz_shibing')==0){
nameskin=nameskin.slice(3,11);
}
else if(nameskin.indexOf('gz_')==0){
nameskin=nameskin.slice(3);
gzbool=true;
}
var createButtons=function(num){
if(!num) return;
if(!introadded){
introadded=true;
uiintro.add('更改皮肤
');
}
var buttons=ui.create.div('.buttons.smallzoom.scrollbuttons');
lib.setMousewheel(buttons);
for(var i=0;i<=num;i++){
var button=ui.create.div('.button.character.pointerdiv',buttons,function(){
if(this._link){
lib.config.skin[nameskin]=this._link;
node.style.backgroundImage=this.style.backgroundImage;
game.saveConfig('skin',lib.config.skin);
}
else{
delete lib.config.skin[nameskin];
if(gzbool&&lib.character[nameskin2][4].contains('gzskin')&&lib.config.mode_config.guozhan.guozhanSkin) node.setBackground(nameskin2,'character');
else node.setBackground(nameskin,'character');
game.saveConfig('skin',lib.config.skin);
}
});
button._link=i;
if(i){
button.setBackgroundImage('image/skin/'+nameskin+'/'+i+'.jpg');
}
else{
if(gzbool&&lib.character[nameskin2][4].contains('gzskin')&&lib.config.mode_config.guozhan.guozhanSkin) button.setBackground(nameskin2,'character','noskin');
else button.setBackground(nameskin,'character','noskin');
}
}
uiintro.add(buttons);
};
var loadImage=function(){
var img=new Image();
img.onload=function(){
num++;
loadImage();
}
img.onerror=function(){
num--;
createButtons(num);
}
img.src=lib.assetURL+'image/skin/'+nameskin+'/'+num+'.jpg';
}
if(lib.config.change_skin){
loadImage();
}
else{
setTimeout(function(){
createButtons(lib.skin[nameskin]);
});
}
}
}
}
else if(node.classList.contains('equips')&&ui.arena.classList.contains('selecting')){
(function(){
uiintro.add('选择装备');
uiintro.addSmall(Array.from(node.childNodes),true);
uiintro.clickintro=true;
ui.control.hide();
uiintro._onclose=function(){
ui.control.show();
}
var confirmbutton;
for(var i=0;i'+lib.translate['_'+career+'_skill_info']+'');
}
else if(node.classList.contains('skillbar')){
if(node==ui.friendBar){
uiintro.add('友方怒气值');
uiintro.add(''+_status.friendRage+'/100
');
}
else if(node==ui.enemyBar){
uiintro.add('敌方怒气值');
uiintro.add(''+_status.enemyRage+'/100
');
}
}
else if(node.parentNode==ui.historybar){
if(node.dead){
if(!node.source||node.source==node.player){
uiintro.add(''+get.translation(node.player)+'阵亡
');
uiintro.addSmall([node.player]);
}
else{
uiintro.add(''+get.translation(node.player)+'被'+get.translation(node.source)+'杀害
');
uiintro.addSmall([node.source]);
}
}
if(node.skill){
uiintro.add(''+get.translation(node.skill,'skill')+'
');
uiintro._place_text=uiintro.add(''+get.translation(node.skill,'info')+'
');
}
if(node.targets&&get.itemtype(node.targets)=='players'){
uiintro.add('目标
');
uiintro.addSmall(node.targets);
}
if(node.players&&node.players.length>1){
uiintro.add('使用者
');
uiintro.addSmall(node.players);
}
if(node.cards&&node.cards.length){
uiintro.add('卡牌
');
uiintro.addSmall(node.cards);
}
for(var i=0;i已横置');
var list=[];
for(var i=0;i4){
num=4+Math.sqrt(num-4);
}
else{
if(player.isHealthy()){
if(player.hp==3){
num+=0.5;
}
else if(player.hp<3){
num++;
}
}
}
num+=player.countCards('h')/2;
var es=player.getCards('e');
for(var i=0;i=7) num+=0.8;
if(val>=5) num+=0.5;
if(val>=3) num+=0.2;
}
return num;
},
attitude:function(from,to){
if(!from||!to) return 0;
from=from._trueMe||from;
arguments[0]=from;
var att=get.rawAttitude.apply(this,arguments);
if(from.isMad()) att=-att;
if(to.isMad()&&att>0){
if(to.identity=='zhu'){
att=1;
}
else{
att=0;
}
}
if(!_status.tempnofake){
_status.tempnofake=true;
if(from.ai.modAttitudeFrom){
att=from.ai.modAttitudeFrom(from,to,att);
}
if(to.ai.modAttitudeTo){
att=to.ai.modAttitudeTo(from,to,att);
}
delete _status.tempnofake;
}
return att;
},
sgnAttitude:function(){
return get.sgn(get.attitude.apply(this,arguments));
},
useful:function(card){
if(get.position(card)=='j') return -1;
if(get.position(card)=='e') return get.equipValue(card);
if(card._modUseful){
return card._modUseful();
}
var i=0;
if(_status.event.player){
i=_status.event.player.getCards('h',card.name).indexOf(card);
if(i<0) i=0;
}
var aii=get.info(card).ai;
var useful;
if(aii&&aii.useful) useful=aii.useful;
else if(aii&&aii.basic) useful=aii.basic.useful;
if(useful==undefined) return -1;
if(typeof useful=='function'){
return useful(card,i);
}
if(typeof useful=='number') return useful;
if(i0&&!target.needsToDiscard()&&!get.tag(card,'valueswap')){
return 0;
}
}
return Math.max(0,value1-value2)/5;
},
equipValue:function(card,player){
if(player==undefined||get.itemtype(player)!='player') player=get.owner(card);
if(player==undefined||get.itemtype(player)!='player') player=_status.event.player;
var info=get.info(card);
if(!info.ai) return 0;
var value=info.ai.equipValue;
if(value==undefined){
if(info.ai.basic&&info.ai.basic.equipValue!=undefined){
value=info.ai.basic.equipValue;
}
else return 0;
}
if(typeof value=='number') return value;
if(typeof value=='function') return value(card,player,null,'raw2');
return 0;
},
equipValueNumber:function(card){
var info=get.info(card);
if(info.ai){
if(typeof info.ai.equipValue=='number') return info.ai.equipValue;
if(info.ai.basic&&typeof info.ai.basic.equipValue=='number') return info.ai.basic.equipValue;
}
return 0;
},
disvalue:function(card,player){
return -get.value(card,player);
},
disvalue2:function(card,player){
return -get.value(card,player,'raw');
},
skillthreaten:function(skill,player,target){
if(!lib.skill[skill]) return 1;
if(!lib.skill[skill].ai) return 1;
var threaten=lib.skill[skill].ai.threaten;
if(typeof threaten=='number') return threaten;
if(typeof threaten=='function'){
player=player||_status.event.player;
target=target||player;
return threaten(player,target);
}
return 1;
},
order:function(item){
var info=get.info(item);
if(!info) return -1;
var aii=info.ai;
var order;
if(aii&&aii.order) order=aii.order;
else if(aii&&aii.basic) order=aii.basic.order;
if(order==undefined) return -1;
var num=order;
if(typeof(order)=='function'){
num=order(item,_status.event.player);
}
if(typeof item=='object'&&_status.event.player){
var player=_status.event.player;
num=game.checkMod(player,item,num,'aiOrder',player);
}
return num;
},
result:function(item,skill){
var result;
var info=get.info(item);
if(info.ai) result=get.copy(info.ai.result);
if(typeof(result)=='function') result=result(item);
if(!result) result={};
if(skill){
var info2=get.info(skill);
if(info2.ai){
info2=info2.ai.result;
for(var i in info2){
result[i]=info2[i];
}
}
}
return result;
},
effect_use:function(target,card,player,player2,isLink){
var event=_status.event;
var eventskill=null;
if(player==undefined) player=_status.event.player;
if(typeof card!='string'&&(typeof card!='object'||!card.name)){
var skillinfo=get.info(event.skill);
if(event.skill&&skillinfo.viewAs==undefined) card=_status.event.skill;
else{
card=get.card();
if(skillinfo&&skillinfo.viewAs&&card.name===skillinfo.viewAs.name){
eventskill=event.skill;
}
}
}
var info=get.info(card);
if(typeof card=='object'&&info&&info.changeTarget){
var targets=[target];
info.changeTarget(player,targets);
var eff=0;
for(var i of targets){
eff+=get.effect(i,card,player,player2,isLink);
}
return eff;
}
var result=get.result(card,eventskill);
var result1=result.player_use||result.player,result2=result.target_use||result.target;
if(typeof result1=='function') result1=result1(player,target,card,isLink);
if(typeof result2=='function') result2=result2(player,target,card,isLink);
if(typeof result1!='number') result1=0;
if(typeof result2!='number') result2=0;
var temp1,temp2,temp3,temp01=0,temp02=0,threaten=1;
var skills1=player.getSkills().concat(lib.skill.global);
game.expandSkills(skills1);
var zerotarget=false,zeroplayer=false;
for(var i=0;i3) result2*=0.5;
if(target.hp==4) result2*=0.9;
if(target.hp==5) result2*=0.8;
if(target.hp>5) result2*=0.6;
}
else{
result2+=temp02;
result1+=temp01;
}
if(zeroplayer) result1=0;
if(zerotarget) result2=0;
var final=0;
if(player2){
final=(result1*get.attitude(player2,player)+(target?result2*get.attitude(player2,target):0));
}
else final=(result1*get.attitude(player,player)+(target?result2*get.attitude(player,target):0));
if(!isLink&&get.tag(card,'natureDamage')&&!zerotarget){
var info=get.info(card);
if(!info||!info.ai||!info.ai.canLink){
if(target.isLinked()) game.countPlayer(function(current){
if(current!=target&¤t.isLinked()) final+=get.effect(current,card,player,player2,true);
});
}
else if(info.ai.canLink(player,target,card)){
game.countPlayer(function(current){
if(current!=target&¤t.isLinked()) final+=get.effect(current,card,player,player2,true);
});
}
}
return final;
},
effect:function(target,card,player,player2,isLink){
var event=_status.event;
var eventskill=null;
if(player==undefined) player=_status.event.player;
if(typeof card!='string'&&(typeof card!='object'||!card.name)){
var skillinfo=get.info(event.skill);
if(event.skill&&skillinfo.viewAs==undefined) card=_status.event.skill;
else{
card=get.card();
if(skillinfo&&skillinfo.viewAs&&card.name===skillinfo.viewAs.name){
eventskill=event.skill;
}
}
}
var result=get.result(card,eventskill);
var result1=result.player,result2=result.target;
if(typeof result1=='function') result1=result1(player,target,card,isLink);
if(typeof result2=='function') result2=result2(player,target,card,isLink);
if(typeof result1!='number') result1=0;
if(typeof result2!='number') result2=0;
var temp1,temp2,temp3,temp01=0,temp02=0,threaten=1;
var skills1=player.getSkills().concat(lib.skill.global);
game.expandSkills(skills1);
var zerotarget=false,zeroplayer=false;
for(var i=0;i3) result2*=0.5;
if(target.hp==4) result2*=0.9;
if(target.hp==5) result2*=0.8;
if(target.hp>5) result2*=0.6;
// if(get.attitude(player,target)<0){
// result2*=threaten;
// }
// else{
// result2*=Math.sqrt(threaten);
// }
// if(target.hp<=1) result2*=2;
// if(target.hp==2) result2*=1.1;
// if(target.countCards('h')==0){
// result2*=1.1;
// if(get.tag(card,'respondSha')||get.tag(card,'respondShan')) result2*=1.4;
// }
// if(target.countCards('h')==1) result2*=1.05;
// if(target.countCards('h')==2) result2*=1.02;
// if(target.countCards('h')>3) result2*=0.9;
// if(target.hp==4) result2*=0.9;
// if(target.hp==5) result2*=0.8;
// if(target.hp>5) result2*=0.6;
}
else{
result2+=temp02;
result1+=temp01;
}
if(zeroplayer) result1=0;
if(zerotarget) result2=0;
var final=0;
if(player2){
final=(result1*get.attitude(player2,player)+(target?result2*get.attitude(player2,target):0));
}
else final=(result1*get.attitude(player,player)+(target?result2*get.attitude(player,target):0));
if(!isLink&&get.tag(card,'natureDamage')&&!zerotarget){
var info=get.info(card);
if(!info||!info.ai||!info.ai.canLink){
if(target.isLinked()) game.countPlayer(function(current){
if(current!=target&¤t.isLinked()) final+=get.effect(current,card,player,player2,true);
});
}
else if(info.ai.canLink(player,target,card)){
game.countPlayer(function(current){
if(current!=target&¤t.isLinked()) final+=get.effect(current,card,player,player2,true);
});
}
}
return final;
},
damageEffect:function(target,player,viewer,nature){
if(!player){
player=target;
}
if(!viewer){
viewer=target;
}
var name='damage';
if(nature=='fire'){
name='firedamage';
}
else if(nature=='thunder'){
name='thunderdamage';
}
else if(nature=='ice'){
name='icedamage';
}
var eff=get.effect(target,{name:name},player,viewer);
if(eff>0&&target.hujia>0) return 0;
return eff;
},
recoverEffect:function(target,player,viewer){
if(target.hp==target.maxHp) return 0;
if(!player){
player=target;
}
if(!viewer){
viewer=target;
}
return get.effect(target,{name:'recover'},player,viewer);
},
buttonValue:function(button){
var card=button.link;
var player=get.owner(card);
if(!player) player=_status.event.player;
if(player.getCards('j').contains(card)){
var efff=get.effect(player,card,player,player);
if(efff>0) return 0.5;
if(efff==0) return 0;
return -1.5;
}
if(player.getCards('e').contains(card)){
var evalue=get.value(card,player);
if(player.hasSkillTag('noe')){
if(evalue>=7){
return evalue/6;
}
return evalue/10;
}
return evalue/3;
}
if(player.hasSkillTag('noh')) return 0.1;
var nh=player.countCards('h');
switch(nh){
case 1:return 2;
case 2:return 1.6;
case 3:return 1;
case 4:return 0.8;
case 5:return 0.6;
default:return 0.4;
}
},
attitude2:function(to){
return get.attitude(_status.event.player,to);
},
};
var ai={
basic:{
chooseButton:function(check){
var event=_status.event;
var i,j,range,buttons,buttons2;
var ok=false,forced=event.forced;
var iwhile=100;
while(iwhile--){
range=get.select(event.selectButton);
if(range[1]==-1){
j=0;
for(i=0;i0);
}
buttons=get.selectableButtons();
if(buttons.length==0){
return ok;
}
buttons2=buttons.slice(0);
var ix=0;
var checkix=check(buttons[0],buttons2);
for(i=1;icheckix){
ix=i;
checkix=checkixtmp;
}
}
// buttons.sort(function(a,b){
// return check(b,buttons2)-check(a,buttons2);
// });
if(check(buttons[ix])<=0){
if(!forced||ok){
return ok;
}
}
buttons[ix].classList.add('selected');
ui.selected.buttons.add(buttons[ix]);
game.check();
if(ui.selected.buttons.length>=range[0]){
ok=true;
}
if(ui.selected.buttons.length==range[1]){
return true;
}
}
},
chooseCard:function(check){
var event=_status.event;
if(event.filterCard==undefined) return (check()>0);
var i,j,range,cards,cards2,skills,check,effect;
var ok=false,forced=event.forced;
var iwhile=100;
while(iwhile--){
range=get.select(event.selectCard);
if(ui.selected.cards.length>=range[0]){
ok=true;
}
if(range[1]==-1){
if(ui.selected.cards.length==0) return true;
j=0;
for(i=0;i0);
}
cards=get.selectableCards();
if(!_status.event.player._noSkill){
cards=cards.concat(get.skills());
}
if(cards.length==0){
return ok;
}
cards2=cards.slice(0);
// cards.sort(function(a,b){
// return (check(b,cards2)-check(a,cards2));
// });
var ix=0;
var checkix=check(cards[0],cards2);
for(i=1;icheckix){
ix=i;
checkix=checkixtmp;
}
}
if(check(cards[ix])<=0){
if(!forced||ok){
return ok;
}
}
if(typeof cards[ix]=='string'){
ui.click.skill(cards[ix]);
var info=get.info(event.skill);
if(info.filterCard){
check=info.check||get.unuseful2;
return (ai.basic.chooseCard(check));
}
else{
return true;
}
}
else{
cards[ix].classList.add('selected');
ui.selected.cards.add(cards[ix]);
game.check();
if(ui.selected.cards.length>=range[ix]){
ok=true;
}
if(ui.selected.cards.length==range[1]){
return true;
}
}
}
},
chooseTarget:function(check){
var event=_status.event;
if(event.filterTarget==undefined) return (check()>0);
var i,j,range,targets,targets2,effect;
var ok=false,forced=event.forced;
var iwhile=100;
while(iwhile--){
range=get.select(event.selectTarget);
if(range[1]==-1){
j=0;
for(i=0;i0);
}
else if(range[1]==0){
return check()>0
}
targets=get.selectableTargets();
if(targets.length==0){
return range[0]==0||ok;
}
targets2=targets.slice(0);
// targets.sort(function(a,b){
// return check(b)-check(a);
// });
var ix=0;
var checkix=check(targets[0],targets2);
for(i=1;icheckix){
ix=i;
checkix=checkixtmp;
}
}
if(check(targets[ix])<=0){
if(!forced||ok){
return ok;
}
}
targets[ix].classList.add('selected');
ui.selected.targets.add(targets[ix]);
game.check();
if(ui.selected.targets.length>=range[0]){
ok=true;
}
if(ui.selected.targets.length==range[1]){
return true;
}
}
}
},
get:get
};
lib.init.init();
}());