"use strict";
(function(){
var _status={
paused:false,
paused2:false,
over:false,
clicked:false,
auto:false,
event:{
finished:true,
next:[],
},
ai:{},
lastdragchange:[],
skillaudio:[],
dieClose:[],
dragline:[],
};
var lib={
configprefix:'noname_0.9_',
versionOL:19,
sourceURL:'https://rawgit.com/libccy/noname/$version$/',
updateURL:'https://raw.githubusercontent.com/libccy/noname/$version$/',
assetURL:'',
hallURL:'websha.cn',
changeLog:[],
updates:[],
canvasUpdates:[],
video:[],
_onDB:[],
skilllist:[],
characterIntro:{},
characterPack:{},
cardPack:{},
onresize:[],
onphase:[],
onwash:[],
onover:[],
chatHistory:[],
arenaReady:[],
inpile:[],
extensions:[],
extensionPack:{},
cardType:{},
hook:{globaltrigger:{},globalskill:{}},
hookmap:{},
layoutfixed:['chess','stone'],
characterDialogGroup:{
'收藏':function(name,capt){
return lib.config.favouriteCharacter.contains(name)?capt:null;
},
'最近':function(name,capt){
return lib.config.recentCharacter.contains(name)?capt:null;
}
},
onDB:function(func){
if(lib.db){
func();
}
else{
lib._onDB.push(func);
}
},
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.arena.classList.add('low_performance');
}
else{
ui.arena.classList.remove('low_performance');
}
}
},
compatiblemode:{
name:'兼容模式',
init:false,
intro:'提高对旧扩展的兼容性,但可能产生未知结果',
onclick:function(bool){
game.saveConfig('compatiblemode',bool);
setTimeout(function(){
if(lib.config.compatiblemode){
alert('开启兼容模式可防止扩展使游戏卡死并提高对旧扩展的兼容性,但对游戏速度有一定影响,若无不稳定或不兼容的扩展建议关闭');
}
},500);
}
},
confirm_exit:{
name:'确认退出',
init:false,
unfrequent:true,
intro:'离开游戏前弹出确认对话框',
},
auto_confirm:{
name:'自动确认',
init:true,
unfrequent:true,
intro:'当候选目标只有1个时,点击目标后无需再点击确认',
},
enable_drag:{
name:'启用拖拽',
init:true,
intro:'按住卡牌后可将卡牌拖至目标',
unfrequent:true,
},
enable_dragline:{
name:'拖拽指示线',
init:true,
unfrequent:true,
intro:'拖拽时显示虚线,可能降低游戏速度',
},
enable_touchdragline:{
name:'拖拽指示线',
init:false,
unfrequent:true,
intro:'拖拽时显示虚线,可能降低游戏速度',
},
wuxie_self:{
name:'不无懈自己',
init:true,
intro:'自己使用的单目标普通锦囊即将生效时,不询问无懈',
},
tao_enemy:{
name:'不对敌方使用桃',
init:false,
intro:'双方阵营明确的模式中(如对决),敌方角色濒死时不询问出桃',
},
touchscreen:{
name:'触屏模式',
init:false,
restart:true,
unfrequent:true,
intro:'开启后可使触屏设备反应更快,但无法使用鼠标操作',
},
swipe:{
name:'滑动手势',
init:true,
unfrequent:true,
intro:'在非滚动区域向四个方向滑动可执行对应操作',
},
swipe_down:{
name:'下划操作',
init:'menu',
unfrequent:true,
intro:'向下滑动时执行的操作',
item:{
system:'显示按钮',
menu:'打开菜单',
pause:'切换暂停',
auto:'切换托管',
chat:'显示聊天',
off:'关闭',
}
},
swipe_up:{
name:'上划操作',
intro:'向上滑动时执行的操作',
init:'auto',
unfrequent:true,
item:{
system:'显示按钮',
menu:'打开菜单',
pause:'切换暂停',
auto:'切换托管',
chat:'显示聊天',
off:'关闭',
}
},
swipe_left:{
name:'左划操作',
intro:'向左滑动时执行的操作',
init:'system',
unfrequent:true,
item:{
system:'显示按钮',
menu:'打开菜单',
pause:'切换暂停',
auto:'切换托管',
chat:'显示聊天',
off:'关闭',
}
},
swipe_right:{
name:'右划操作',
intro:'向右滑动时执行的操作',
init:'chat',
unfrequent:true,
item:{
system:'显示按钮',
menu:'打开菜单',
pause:'切换暂停',
auto:'切换托管',
chat:'显示聊天',
off:'关闭',
}
},
round_menu_func:{
name:'触屏按钮操作',
intro:'点击屏幕中圆形按钮时执行的操作',
init:'system',
unfrequent:true,
item:{
system:'显示按钮',
menu:'打开菜单',
// pause:'切换暂停',
// auto:'切换托管'
}
},
show_splash:{
name:'显示开始界面',
intro:'游戏开始前进入模式选择画面',
init:false,
},
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:'暂停',
config:'选项',
auto:'托管',
}
},
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秒',
}
},
video:{
name:'保存录像',
init:'20',
intro:'游戏结束后保存录像在最大条数,超过后将从最早的录像开始删除(已收藏的录像不计入条数)',
item:{
'0':'关闭',
'5':'五局',
'10':'十局',
'20':'二十局',
'50':'五十局',
'10000':'无限',
},
unfrequent:true,
},
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
},
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,
},
update:function(config,map){
if('ontouchstart' in document){
map.touchscreen.show();
}
else{
map.touchscreen.hide();
}
if(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.swipe.show();
if(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();
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();
}
}
}
},
appearence:{
name:'外观',
config:{
theme:{
name:'主题',
init:'woodden',
item:{},
onclick:function(theme){
game.saveConfig('theme',theme);
ui.arena.hide();
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:'手杀',
},
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;
}
},
// 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.95;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;
document.documentElement.style.zoom=game.documentZoom;
}
},
image_background:{
name:'游戏背景',
init:'default',
item:{
default:'默认',
custom:'自定',
},
onclick:function(background){
var animate=lib.config.image_background=='default';
game.saveConfig('image_background',background);
ui.background.delete();
ui.background=ui.create.div('.background');
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)';
}
else{
ui.background.style.filter='';
ui.background.style.webkitFilter='';
ui.background.style.transform='';
}
document.body.insertBefore(ui.background,document.body.firstChild);
if(animate) ui.background.animate('start');
if(lib.config.image_background=='default'){
document.documentElement.style.backgroundImage='';
ui.background.style.backgroundImage="none";
}
else if(lib.config.image_background=='custom'){
ui.background.style.backgroundImage="none";
game.getDB('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+')';
};
fileReader.readAsDataURL(fileToLoad, "UTF-8");
});
}
else{
ui.background.setBackgroundImage('image/background/'+lib.config.image_background+'.jpg');
}
ui.background.style.backgroundSize='cover';
},
},
import_background:{
name:'
'+
' '+
'确定
',
clear:true,
},
image_background_blur:{
name:'背景模糊',
init:false,
onclick:function(bool){
game.saveConfig('image_background_blur',bool);
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)';
}
else{
ui.background.style.filter='';
ui.background.style.webkitFilter='';
ui.background.style.transform='';
}
},
},
phonelayout:{
name:'触屏布局',
init:false,
onclick:function(bool){
game.saveConfig('phonelayout',bool);
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');
}
}
},
change_skin:{
name:'开启换肤',
init:true,
intro:'双点头像或在右键菜单中换肤,皮肤可在选项-文件-图片文件-皮肤图片中添加'
},
change_skin_auto:{
name:'自动换肤',
init:'60000',
item:{
'off':'关闭',
'30000':'半分钟',
'60000':'一分钟',
'120000':'两分钟',
'300000':'五分钟',
},
intro:'游戏每进行一段时间自动为一个随机角色更换皮肤',
onclick:function(item){
game.saveConfig('change_skin_auto',item);
clearTimeout(_status.skintimeout);
if(item!='off'){
_status.skintimeout=setTimeout(ui.click.autoskin,parseInt(item));
}
}
},
card_style:{
name:'卡牌样式',
init:'default',
intro:'设置正面朝上的卡牌的样式',
item:{
default:'默认',
wood:'木纹',
music:'音乐',
simple:'原版',
new:'新版',
},
onclick:function(layout){
game.saveConfig('card_style',layout);
var style=ui.css.card_style;
ui.css.card_style=lib.init.css(lib.assetURL+'theme/style/card',lib.config.card_style);
style.remove();
},
unfrequent:true,
},
cardback_style:{
name:'卡背样式',
intro:'设置背面朝上的卡牌的样式',
init:'default',
item:{
default:'默认',
wood:'木纹',
music:'音乐',
official:'原版',
new:'新版',
feicheng:'废城',
liusha:'流沙',
},
onclick:function(layout){
game.saveConfig('cardback_style',layout);
var style=ui.css.cardback_style;
ui.css.cardback_style=lib.init.css(lib.assetURL+'theme/style/cardback',lib.config.cardback_style);
style.remove();
},
unfrequent:true,
},
hp_style:{
name:'体力条样式',
init:'default',
item:{
default:'默认',
official:'勾玉',
},
onclick:function(layout){
game.saveConfig('hp_style',layout);
var style=ui.css.hp_style;
ui.css.hp_style=lib.init.css(lib.assetURL+'theme/style/hp',lib.config.hp_style);
style.remove();
if(game.layout=='default'&&lib.config.hp_style=='official'){
ui.arena.classList.add('hpimage');
}
else{
ui.arena.classList.remove('hpimage');
}
},
unfrequent:true,
},
show_history:{
name:'出牌记录栏',
init:'off',
intro:'在屏幕左侧或右侧显示出牌记录',
unfrequent:true,
item:{
off:'关闭',
left:'靠左',
right:'靠右',
},
onclick:function(bool){
if(lib.config.show_history=='right') ui.window.animate('rightbar2');
game.saveConfig('show_history',bool);
if(_status.video||!_status.prepareArena) return;
if(bool=='left'){
ui.window.classList.add('leftbar');
ui.window.classList.remove('rightbar');
}
else if(bool=='right'){
ui.window.classList.remove('leftbar');
ui.window.classList.add('rightbar');
}
else{
ui.window.classList.remove('leftbar');
ui.window.classList.remove('rightbar');
}
}
},
show_log:{
name:'历史记录栏',
init:'off',
intro:'在屏幕中部显示出牌文字记录',
unfrequent:true,
item:{
off:'关闭',
left:'靠左',
center:'居中',
right:'靠右',
},
onclick:function(bool){
game.saveConfig('show_log',bool);
if(lib.config.show_log!='off'){
ui.arenalog.style.display='';
ui.arenalog.dataset.position=bool;
}
else{
ui.arenalog.style.display='none';
ui.arenalog.innerHTML='';
}
}
},
clear_log:{
name:'自动清除历史记录',
init:false,
unfrequent:true,
intro:'开启后将定时清除历史记录栏的条目(而不是等记录栏满后再清除)'
},
log_highlight:{
name:'历史记录高亮',
init:true,
unfrequent:true,
intro:'开启后历史记录不同类别的信息将以不同颜色显示',
},
glow_phase:{
name:'当前回合角色高亮',
unfrequent:true,
init:'yellow',
intro:'设置当前回合角色的边框颜色',
item:{
none:'无',
yellow:'黄色',
green:'绿色',
purple:'紫色',
},
onclick:function(bool){
game.saveConfig('glow_phase',bool);
if(_status.currentPhase){
if(lib.config.glow_phase){
_status.currentPhase.classList.add('glow_phase');
ui.arena.dataset.glow_phase=lib.config.glow_phase;
}
else{
_status.currentPhase.classList.remove('glow_phase');
}
}
}
},
mark_identity_style:{
name:'标记身份操作',
unfrequent:true,
init:'menu',
item:{
menu:'菜单',
click:'单击',
},
},
player_border:{
name:'边框宽度',
init:'normal',
intro:'设置角色的边框宽度',
unfrequent:true,
item:{
slim:'窄',
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');
}
}
},
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;
}
},
show_time:{
name:'显示时间',
intro:'在屏幕顶部显示当前时间',
init:false,
unfrequent:true,
onclick:function(bool){
game.saveConfig('show_time',bool);
if(bool){
ui.time.style.display='';
}
else{
ui.time.style.display='none';
}
}
},
show_time2:{
name:'显示时间',
intro:'在触屏按钮处显示当前时间',
init:true,
unfrequent:true,
onclick:function(bool){
game.saveConfig('show_time2',bool);
if(bool){
ui.roundmenu.classList.add('clock');
}
else{
ui.roundmenu.classList.remove('clock');
}
}
},
watchface:{
name:'表盘样式',
init:'none',
unfrequent:true,
item:{
none:'默认',
simple:'简约',
},
onclick:function(item){
game.saveConfig('watchface',item);
ui.roundmenu.dataset.watchface=item;
}
},
show_card_prompt:{
name:'显示出牌信息',
intro:'出牌时在使用者上显示卡牌名称',
init:true,
unfrequent:true,
},
hide_card_prompt_basic:{
name:'隐藏基本牌信息',
intro:'不显示基本牌名称',
init:false,
unfrequent:true,
},
hide_card_prompt_equip:{
name:'隐藏装备牌信息',
intro:'不显示装备牌名称',
init:false,
unfrequent:true,
},
show_phase_prompt:{
name:'显示阶段信息',
intro:'在当前回合不同阶段开始时显示阶段名称',
init:true,
unfrequent:true,
},
show_phaseuse_prompt:{
name:'出牌阶段提示',
intro:'在你出牌时显示提示文字',
init:true,
unfrequent:true,
},
fold_card:{
name:'折叠手牌',
init:true,
unfrequent:true,
},
fold_mode:{
name:'折叠模式菜单',
intro:'关闭后模式菜单中“更多”内的项目将直接展开',
init:true,
unfrequent:true,
},
auto_popped_config:{
name:'自动弹出选项',
intro:'鼠标移至选项按钮时弹出模式选择菜单',
init:true,
unfrequent:true,
},
auto_popped_history:{
name:'自动弹出历史',
intro:'鼠标移至暂停按钮时弹出历史记录菜单',
init:false,
unfrequent:true,
},
remember_dialog:{
name:'记住对话框位置',
intro:'移动对话框后新的对话框也将在移动后的位置显示',
init:false,
unfrequent:true,
},
reset_dialog:{
name:'重置对话框位置',
clear:true,
unfrequent:true,
onclick:function(){
if(ui.dialog){
var dialog=ui.dialog;
dialog.style.transform='';
dialog._dragtransform=[0,0];
dialog.style.transition='all 0.3s';
dialog._dragtouches;
dialog._dragorigin;
dialog._dragorigintransform;
setTimeout(function(){
dialog.style.transition='';
},500);
}
game.saveConfig('dialog_transform',[0,0]);
}
},
remember_round_button:{
name:'记住按钮位置',
intro:'重新开始后触屏按钮将保存的上一局的位置',
init:false,
unfrequent:true,
},
reset_round_button:{
name:'重置按钮位置',
clear:true,
unfrequent:true,
onclick:function(){
ui.click.resetround();
}
},
character_dialog_tool:{
name:'自由选将显示',
intro:'点击自由选将时默认显示的条目',
init:'最近',
item:{
'收藏':'收藏',
'最近':'最近',
'all':'全部'
},
unfrequent:true,
},
recent_character_number:{
name:'最近使用武将',
intro:'自由选将对话框中最近使用武将的数量',
init:'12',
item:{
'6':'6',
'12':'12',
'20':'24',
'30':'36',
},
unfrequent:true
},
filternode_button:{
name:'触屏筛选按钮',
intro:'设置自由选将对话框中筛选按钮的样式',
init:true,
unfrequent:true,
},
show_charactercard:{
name:'显示武将资料',
intro:'在武将界面单击时弹出武将资料卡',
init:true,
unfrequent:true
},
show_favourite:{
name:'显示添加收藏',
intro:'在角色的右键菜单中显示添加收藏',
init:true,
unfrequent:true
},
show_favourite_menu:{
name:'显示收藏菜单',
intro:'在选项-武将中显示收藏一栏',
init:true,
unfrequent:true
},
show_ban_menu:{
name:'显示禁将菜单',
intro:'在选项-武将中显示禁将一栏',
init:true,
unfrequent:true
},
right_range:{
name:'显示距离信息',
intro:'在角色的右键菜单中显示距离等信息',
init:true,
unfrequent:true
},
hide_card_image:{
name:'隐藏卡牌背景',
intro:'所有卡牌将使用文字作为背景',
init:false,
unfrequent:true,
restart:true,
},
show_name:{
name:'显示武将名',
init:false,
unfrequent:true,
onclick:function(bool){
game.saveConfig('show_name',bool);
if(lib.config.show_name){
for(var i=0;i'+
' '+
'确定 ',
clear:true,
},
background_audio:{
name:'游戏音效',
init:true,
},
background_speak:{
name:'人物配音',
init:true,
},
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;
}
}
}
},
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');
ui.autoskill[i].lastChild.classList.add('on');
}
else{
map[i].classList.remove('on');
ui.autoskill[i].lastChild.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_game:{
name:'重置游戏设置',
onclick:function(){
var node=this;
if(node._clearing){
var noname_inited=localStorage.getItem('noname_inited');
localStorage.clear();
if(noname_inited){
localStorage.setItem('noname_inited',noname_inited);
}
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_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_hiddenpack:{
name:'重置隐藏扩展包',
onclick:function(){
if(this.innerHTML!='已重置'){
this.innerHTML='已重置'
game.saveConfig('hiddenModePack',[]);
game.saveConfig('hiddenCharacterPack',[]);
game.saveConfig('hiddenCardPack',[]);
game.saveConfig('hiddenPlayPack',[]);
var that=this;
setTimeout(function(){
that.innerHTML='重置隐藏扩展包';
},500);
}
},
clear:true
},
reset_tutorial:{
name:'重置新手向导',
onclick:function(){
if(this.innerHTML!='已重置'){
this.innerHTML='已重置'
game.saveConfig('new_tutorial',false);
var that=this;
setTimeout(function(){
that.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={};
for(var i in localStorage){
if(i.indexOf(lib.configprefix)==0){
data[i]=localStorage[i];
}
}
game.export(lib.init.encode(JSON.stringify(data)),'无名杀 - 数据 - '+(new Date()).toLocaleString());
},
clear:true
},
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:{
connect_player_number:{
name:'游戏人数',
init:'8',
item:{
'3':'三人',
'4':'四人',
'5':'五人',
'6':'六人',
'7':'七人',
'8':'八人'
},
frequent:true,
restart:true,
},
connect_initshow_draw:{
name:'首亮摸牌',
item:{
'0':'关闭',
'1':'一张',
'2':'两张',
'3':'三张',
},
init:'2',
frequent:true,
intro:'第一个明置身份牌的角色可获得摸牌奖励'
},
connect_zhulian:{
name:'珠联璧合',
init:true,
frequent:true,
intro:'主将和副将都明置后,若为特定组合,可摸两张牌或回复一点体力'
},
connect_ban_weak:{
name:'屏蔽弱将',
init:false,
restart:true,
},
connect_ban_strong:{
name:'屏蔽强将',
init:false,
restart:true,
},
},
config:{
guozhan_mode:{
name:'游戏模式',
init:'normal',
item:{
normal:'标准',
mingjiang:'明将'
},
frequent:true,
},
player_number:{
name:'游戏人数',
init:'8',
item:{
'3':'三人',
'4':'四人',
'5':'五人',
'6':'六人',
'7':'七人',
'8':'八人'
},
frequent:true,
restart:true,
},
initshow_draw:{
name:'首亮摸牌',
item:{
'0':'关闭',
'1':'一张',
'2':'两张',
'3':'三张',
},
init:'2',
frequent:true,
intro:'第一个明置身份牌的角色可获得摸牌奖励'
},
zhulian:{
name:'珠联璧合',
init:true,
frequent: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;
}
}
},
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();
}
if(config.connect_versus_mode=='4v4'){
map.connect_four_cross.show();
}
else{
map.connect_four_cross.hide();
}
},
connect_versus_mode:{
name:'游戏模式',
init:'1v1',
item:{
'1v1':'1v1',
'2v2':'2v2',
'3v3':'3v3',
'4v4':'4v4',
},
frequent:true
},
connect_four_cross:{
name:'交叉座位',
init:false,
frequent:true,
restart:true,
},
connect_replace_handcard:{
name:'末位可换牌',
init:true,
frequent:true,
intro:'最后行动的角色可在开局时重铸一次手牌'
},
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.four_assign.show();
map.expand_dialog.show();
}
else{
map.change_choice.show();
map.ladder.hide();
map.ladder_monthly.hide();
map.ladder_reset.hide();
map.enable_all.hide();
map.four_assign.hide();
map.expand_dialog.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=='three'||config.versus_mode=='one'){
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.change_identity.show();
}
else{
map.replace_handcard_two.hide();
map.replace_character_two.hide();
map.change_identity.remove();
}
},
versus_mode:{
name:'游戏模式',
init:'three',
item:{
standard:'自由',
three:'统率',
jiange:'剑阁',
// one:'1v1 ',
two:'2v2 ',
four:'4v4 '
},
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_three:{
name:'启用全部武将',
init:false,
frequent:true,
restart:true,
},
enable_all_cards:{
name:'启用全部卡牌',
init:false,
frequent:true,
restart:true,
},
four_assign:{
name:'代替队友选将',
init:false,
frequent:true,
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;
}
}
},
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;
}
},
frequent:true,
},
double_character_jiange:{
name:'双将模式',
init:false,
frequent:true,
},
replace_handcard_two:{
name:'末位可换牌',
init:true,
frequent:true,
intro:'最后行动的角色可在开局时重铸一次手牌'
},
replace_character_two:{
name:'替补模式',
init:false,
frequent:true,
intro:'每个额外选择一名武将,死亡后用该武将代替重新上场,替补武将用完时失败'
},
expand_dialog:{
name:'默认展开选将框',
intro:'选将框打开时直接显示全部武将(可能使游戏在开始时卡顿)',
init:false,
},
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.innerHTML='重置天梯数据';
delete node._clearing;
return;
}
node.innerHTML='单击以确认 (3)';
node._clearing=setTimeout(function(){
node.innerHTML='单击以确认 (2)';
node._clearing=setTimeout(function(){
node.innerHTML='单击以确认 (1)';
node._clearing=setTimeout(function(){
node.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';
}
}
}
},
}
},
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,
},
}
},
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_character.hide();
}
else{
map.chess_leader_save.hide();
map.chess_leader_clear.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_clear:{
name:'清除进度',
onclick:function(){
var node=this;
if(node._clearing){
game.save(get.config('chess_leader_save'),null);
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,
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:'20',
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:{
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
},
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.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.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,
},
}
},
},
status:{
running:false,
canvas:false,
time: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.get("h") 装备牌 player.get("e") 判定牌 player.get("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 游戏结束 game.over(bool)'+
' 角色资料 lib.character 卡牌资料 lib.card ',
},
setIntro:function(node,func){
if(lib.config.touchscreen){
lib.setLongPress(node,ui.click.intro);
}
else{
if(lib.config.hover_all){
lib.setHover(node,ui.click.hoverplayer);
}
if(lib.config.right_info){
node.oncontextmenu=ui.click.rightplayer;
}
}
node._customintro=func;
},
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;
},
setLongPress:function(node,func){
node.addEventListener('touchstart',ui.click.longpressdown);
node.addEventListener('touchend',ui.click.longpresscancel);
// node.addEventListener('mouseleave',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;
};
HTMLDivElement.prototype.transform=function(transform){
var str='';
for(var i in transform){
switch(i){
case 'scale':str+='scale('+transform[i]+') ';break;
case 'rotate':str+='rotate('+transform[i]+'deg) ';break;
}
}
if(typeof transform=='object'){
if(transform.left&&transform.top){
str+='translate('+parseInt(transform.left)+'px,'+parseInt(transform.top)+'px) ';
}
else if(transform.left){
str+='translate('+parseInt(transform.left)+'px) ';
}
else if(transform.top){
str+='translate(0,'+parseInt(transform.top)+'px) ';
}
}
this.style.transform=str;
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;i1&&document.documentElement.offsetWidth<900&&!lib.crosswalk){
game.documentZoom=document.documentElement.offsetWidth/960;
game.deviceZoom=game.documentZoom;
document.documentElement.style.zoom=game.documentZoom;
}
else{
if(lib.device=='ios'){
if(document.documentElement.offsetWidth<900){
var zoom=Math.round(document.documentElement.offsetWidth/96)/10;
var metas=document.head.querySelectorAll('meta');
for(var j=0;j 10 ||
Math.abs(e.touches[0].clientY/game.documentZoom - this.startY) > 10) {
_status.dragged=true;
}
});
}
lib.onDB(function(){
if(lib.config.image_background=='custom'){
ui.background.style.backgroundImage="none";
game.getDB('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");
});
}
});
var proceed=function(){
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(lib.init.eval(mode[lib.config.mode].element[i][j]));
}
else{
lib.element[i][j]=lib.init.eval(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]=lib.init.eval(mode[lib.config.mode].ai[i][j]);
}
}
else{
ai[i]=lib.init.eval(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]=lib.init.eval(mode[lib.config.mode].ui[i][j]);
}
}
else{
ui[i]=lib.init.eval(mode[lib.config.mode].ui[i]);
}
}
for(i in mode[lib.config.mode].game){
game[i]=lib.init.eval(mode[lib.config.mode].game[i]);
}
for(i in mode[lib.config.mode].get){
get[i]=lib.init.eval(mode[lib.config.mode].get[i]);
}
lib.init.start=mode[lib.config.mode].start;
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.characterRank;
delete window.characterRank;
for(i in mode[lib.config.mode]){
if(i=='element') continue;
if(i=='game') continue;
if(i=='ai') continue;
if(i=='ui') continue;
if(i=='get') continue;
if(i=='config') continue;
if(i=='start') continue;
if(lib[i]==undefined) lib[i]=(get.objtype(mode[lib.config.mode][i])=='array')?[]:{};
for(j in mode[lib.config.mode][i]){
lib[i][j]=lib.init.eval(mode[lib.config.mode][i][j]);
}
}
if(typeof mode[lib.config.mode].init=='function'){
(lib.init.eval(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'){
for(k in character[i][j]){
lib.hiddenCharacters.push(k);
}
}
else if(lib.config.mode!='boss'||i!='boss'){
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);
}
for(var l=0;l>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;
},
cfg:function(){
var mode=lib.config.all.mode.slice(0);
mode.remove('connect');
mode.remove('brawl');
var banned=['yxs_luzhishen','xuhuang','zhenji','shen_guanyu','zhurong',
'daqiao','lingcao','liuzan','lusu','luxun','yanwen','zhouyu','xiahouyuan',
'zhuzhi','old_caozhen','guojia','simayi','sp_pangde'];
var bannedcards=['zengbin','toulianghuanzhu','huoshan','hongshui'];
for(var i=0;i0&&typeof arguments[i]=='number'){
for(var j=0;j=info.usable){
event.finish();
}
else{
var hidden=player.hiddenSkills.slice(0);
game.expandSkills(hidden);
if(hidden.contains(event.skill)){
if(!info.direct){
event.trigger('triggerHidden');
}
else{
event.skillHidden=true;
}
}
}
"step 1"
if(event.cancelled){
event.finish();
}
else{
event.trigger('triggerBefore');
}
"step 2"
var info=get.info(event.skill);
if(event.cancelled){
event.finish();
return;
}
if(!event.revealed&&!info.forced){
var checkFrequent=function(info){
if(typeof info.frequent=='boolean') return info.frequent;
if(typeof info.frequent=='function') return info.frequent(trigger,player);
if(info.frequent=='check'&&typeof info.check=='function') return info.check(trigger,player);
return false;
}
if(info.direct&&player.isUnderControl()){
game.modeSwapPlayer(player);
event._result={bool:true};
}
else if(checkFrequent(info)&&!lib.config.autoskilllist.contains(event.skill)){
event._result={bool:true};
}
else if(info.direct&&player==game.me&&!_status.auto){
event._result={bool:true};
}
else if(info.direct&&player.isOnline()){
event._result={bool:true};
}
else{
var str;
var check=info.check;
if(info.prompt) str=info.prompt;
else{
if(typeof info.logTarget=='string'){
str=get.prompt(event.skill,trigger[info.logTarget],player);
}
else if(typeof info.logTarget=='function'){
str=get.prompt(event.skill,info.logTarget(trigger,player),player);
}
else{
str=get.prompt(event.skill,null,player);
}
}
if(typeof str=='function'){str=str(trigger,player)}
player.chooseBool(str).ai=function(){
return !check||check(trigger,player);
};
}
}
"step 3"
if(result&&result.bool==false) return;
var info=get.info(event.skill);
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.popup!=false&&!info.direct){
if(info.popup){
player.popup(info.popup);
game.log(player,'发动了','【'+get.skillTranslation(event.skill,player)+'】');
}
else{
if(info.logTarget){
if(typeof info.logTarget=='string'){
player.logSkill(event.skill,trigger[info.logTarget]);
}
else if(typeof info.logTarget=='function'){
player.logSkill(event.skill,info.logTarget(trigger,player));
}
}
else{
player.logSkill(event.skill);
}
}
}
},
playVideoContent:function(){
'step 0'
game.delay(0,500);
'step 1'
if(!game.chess){
ui.control.innerHTML='';
var nodes=[];
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;
game.pause();
'step 1'
_status.waitingForPlayer=false;
lib.configOL.gameStarted=true;
if(game.onlineroom){
game.send('server','config',lib.configOL);
}
for(var i=0;i0){
player.draw(event.num);
}
}
"step 1"
if(Array.isArray(result)){
event.cards=result;
}
},
phaseUse:function(){
"step 0";
var next=player.chooseToUse();
if(!lib.config.show_phaseuse_prompt){
next.set('prompt',false);
}
"step 1"
if(result.bool&&!event.skipped){
event.goto(0);
}
game.broadcastAll(function(){
if(ui.tempnowuxie){
ui.tempnowuxie.close();
delete ui.tempnowuxie;
}
});
delete player.using;
},
phaseDiscard:function(){
"step 0"
event.num=player.num('h')-player.getHandcardLimit();
if(event.num<=0) event.finish();
else{
if(lib.config.show_phase_prompt){
player.popup('弃牌阶段');
}
}
event.trigger('phaseDiscard');
"step 1"
player.chooseToDiscard(num,true);
"step 2"
event.cards=result.cards;
},
chooseToUse:function(){
"step 0"
var skills=player.get('s',true);
game.expandSkills(skills);
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();
}
});
}
if(Array.isArray(event.dialog)){
event.dialog=ui.create.dialog.apply(this,event.dialog);
event.dialog.open();
event.dialog.classList.add('noselect');
}
else if(event.prompt!=false){
var str;
if(typeof(event.prompt)=='string') str=event.prompt;
else{
str='请弃置';
if(range[0]==range[1]) str+=get.cnNumber(range[0]);
else if(range[1]==Infinity) str+='至少'+get.cnNumber(range[0]);
else str+=get.cnNumber(range[0])+'至'+get.cnNumber(range[1]);
str+='张';
if(event.position=='h'||event.position==undefined) str+='手';
if(event.position=='e') str+='装备';
str+='牌';
}
if(event.prompt2){
str+=''+event.prompt2;
}
event.dialog=ui.create.dialog(str);
if(Array.isArray(event.selectCard)){
event.dialog.add('0/'+get.numStr(event.selectCard[1]));
event.custom.add.card=function(){
_status.event.dialog.content.childNodes[1].innerHTML=
ui.selected.cards.length+'/'+get.numStr(_status.event.selectCard[1]);
}
}
}
else if(get.itemtype(event.dialog)=='dialog'){
event.dialog.style.display='';
event.dialog.open();
}
}
else if(event.isOnline()){
event.send();
}
else{
event.result='ai';
}
}
"step 1"
if(event.result=='ai'){
game.check();
if(ai.basic.chooseCard(event.ai)||forced){
ui.click.ok();
}
else if(event.skill){
var skill=event.skill;
ui.click.cancel();
event.aiexclude.add(skill);
event.redo();
game.resume();
}
else{
ui.click.cancel();
}
}
if(event.rangecards){
for(var i=0;ievent.card2.number){
player.popup('胜');
event.current.popup('负');
str=get.translation(player.name)+'拼点成功';
}
else{
if(event.card1.number==event.card2.number){
player.popup('平');
event.current.popup('平');
}
else{
player.popup('负');
event.current.popup('胜');
}
str=get.translation(player.name)+'拼点失败';
}
game.broadcastAll(function(str){
var dialog=ui.create.dialog(str);
dialog.classList.add('center');
setTimeout(function(){
dialog.close();
},500);
},str);
},1500);
}
else{
event.finish();
}
"step 4"
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.current;
next.card1=event.card1;
next.card2=event.card2;
next.setContent(event.callback);
}
"step 5"
game.broadcastAll(ui.clear);
event.goto(3);
},
chooseToCompare:function(){
"step 0"
if(player.num('h')==0||target.num('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(player.isOnline()){
player.wait(sendback);
event.ol=true;
player.send(function(ai){
game.me.chooseCard('请选择拼点牌',true).set('glow_result',true).ai=ai;
game.resume();
},event.ai);
}
else{
event.localPlayer=true;
player.chooseCard('请选择拼点牌',true).set('glow_result',true).ai=event.ai;
}
if(target.isOnline()){
target.wait(sendback);
event.ol=true;
target.send(function(ai){
game.me.chooseCard('请选择拼点牌',true).set('glow_result',true).ai=ai;
game.resume();
},event.ai);
}
else{
event.localTarget=true;
}
"step 2"
if(event.localPlayer){
event.card1=result.cards[0];
}
if(event.localTarget){
target.chooseCard('请选择拼点牌',true).set('glow_result',true).ai=event.ai;
}
"step 3"
if(event.localTarget){
event.card2=result.cards[0];
}
if(!event.resultOL&&event.ol){
game.pause();
}
"step 4"
try{
if(!event.card1) event.card1=event.resultOL[player.playerid].cards[0];
if(!event.card2) event.card2=event.resultOL[target.playerid].cards[0];
if(!event.card1||!event.card2){
throw('err');
}
}
catch(e){
console.log(e);
event.finish();
return;
}
if(event.card2.number>=10||event.card2.number<=4){
if(target.num('h')>2){
event.addToAI=true;
}
}
player.lose(event.card1);
target.lose(event.card2);
"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.result={
player:event.card1,
target:event.card2,
}
event.dialogid=lib.status.videoId++;
if(get.number(event.card1)>get.number(event.card2)){
event.result.bool=true;
setTimeout(function(){
var str=get.translation(player.name)+'拼点成功';
game.broadcast(function(str,id){
var dialog=ui.create.dialog(str);
dialog.videoId=id;
dialog.classList.add('center');
},str,event.dialogid);
event.dialog=ui.create.dialog(str);
event.dialog.classList.add('center');
player.popup('胜');
target.popup('负');
game.resume();
},1500);
}
else{
event.result.bool=false;
if(get.number(event.card1)==get.number(event.card2)){
event.result.tie=true;
setTimeout(function(){
var str=get.translation(player.name)+'拼点失败';
game.broadcast(function(str,id){
var dialog=ui.create.dialog(str);
dialog.videoId=id;
dialog.classList.add('center');
},str,event.dialogid);
event.dialog=ui.create.dialog(str);
event.dialog.classList.add('center');
player.popup('平');
target.popup('平');
game.resume();
},1500);
}
else{
setTimeout(function(){
var str=get.translation(player.name)+'拼点失败';
game.broadcast(function(str,id){
var dialog=ui.create.dialog(str);
dialog.videoId=id;
dialog.classList.add('center');
},str,event.dialogid);
event.dialog=ui.create.dialog(str);
event.dialog.classList.add('center');
player.popup('负');
target.popup('胜');
game.resume();
},1500);
}
}
game.pause();
"step 6"
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;
}
ui.arena.classList.remove('thrownhighlight');
game.broadcast(function(id){
var dialog=get.idDialog(id);
if(dialog){
dialog.close();
}
ui.arena.classList.remove('thrownhighlight');
},event.dialogid);
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;
}
event.dialog.close();
},
chooseButton:function(){
"step 0"
if(typeof event.dialog=='number'){
event.dialog=get.idDialog(event.dialog);
}
if(event.createDialog&&!event.dialog){
if(Array.isArray(event.createDialog)){
event.createDialog.add('hidden');
event.dialog=ui.create.dialog.apply(this,event.createDialog);
}
event.closeDialog=true;
}
if(event.dialog==undefined) event.dialog=ui.dialog;
if(event.isMine()||event.dialogdisplay){
event.dialog.style.display='';
event.dialog.open();
}
game.check();
if(event.isMine()){
game.pause();
}
else if(event.isOnline()){
event.send();
delete event.callback;
}
else{
event.result='ai';
}
"step 1"
if(event.result=='ai'){
if(event.processAI){
event.result=event.processAI();
}
else{
game.check();
if(ai.basic.chooseButton(event.ai)||forced) ui.click.ok();
else ui.click.cancel();
}
}
if(event.closeDialog){
event.dialog.close();
}
if(event.callback){
event.callback(event.player,event.result);
}
event.resume();
},
chooseCardOL:function(){
'step 0'
event.targets=event.list.slice(0);
if(!_status.connectMode){
event.result=[];
event.goto(7);
}
else{
for(var i=0;i
');
item.firstChild.listen(ui.click.dialogcontrol);
item.firstChild.link=event.controls[i];
}
event.dialog.open();
}
else{
if(event.seperate||lib.config.seperate_control){
event.controlbars=[];
for(var i=0;i