2015-05-11 11:57:44 +00:00
|
|
|
|
'use strict';
|
2015-04-29 03:25:17 +00:00
|
|
|
|
mode.versus={
|
2016-03-23 02:34:26 +00:00
|
|
|
|
start:function(){
|
|
|
|
|
"step 0"
|
|
|
|
|
_status.mode=get.config('versus_mode');
|
|
|
|
|
"step 1"
|
|
|
|
|
var playback=localStorage.getItem(lib.configprefix+'playback');
|
|
|
|
|
if(playback){
|
|
|
|
|
ui.create.me();
|
|
|
|
|
ui.arena.style.display='none';
|
|
|
|
|
ui.system.style.display='none';
|
|
|
|
|
_status.playback=playback;
|
|
|
|
|
localStorage.removeItem(lib.configprefix+'playback');
|
|
|
|
|
var store=lib.db.transaction(['video'],'readwrite').objectStore('video');
|
|
|
|
|
store.get(parseInt(playback)).onsuccess=function(e){
|
|
|
|
|
if(e.target.result){
|
|
|
|
|
game.playVideoContent(e.target.result.video);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
alert('播放失败:找不到录像');
|
|
|
|
|
game.reload();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
event.finish();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(_status.mode=='jiange'||_status.mode=='four'){
|
|
|
|
|
game.prepareArena(8);
|
|
|
|
|
// game.pause();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(lib.storage.choice==undefined) game.save('choice',20);
|
|
|
|
|
if(lib.storage.zhu==undefined) game.save('zhu',true);
|
|
|
|
|
if(lib.storage.noreplace_end==undefined) game.save('noreplace_end',true);
|
|
|
|
|
if(get.config('first_less')==undefined) game.saveConfig('first_less',true,true);
|
|
|
|
|
if(lib.storage.autoreplaceinnerhtml==undefined) game.save('autoreplaceinnerhtml',true);
|
|
|
|
|
if(lib.storage.single_control==undefined) game.save('single_control',true);
|
|
|
|
|
if(lib.storage.number==undefined) game.save('number',3);
|
|
|
|
|
if(lib.storage.versus_reward==undefined) game.save('versus_reward',3);
|
|
|
|
|
if(lib.storage.versus_punish==undefined) game.save('versus_punish','弃牌');
|
|
|
|
|
if(lib.storage.replace_number==undefined) game.save('replace_number',3);
|
|
|
|
|
|
|
|
|
|
switch(lib.storage.seat_order){
|
|
|
|
|
case '交叉':lib.storage.cross_seat=true;lib.storage.random_seat=false;break;
|
|
|
|
|
case '随机':lib.storage.cross_seat=false;lib.storage.random_seat=true;break;
|
|
|
|
|
default:lib.storage.cross_seat=false;lib.storage.random_seat=false;
|
|
|
|
|
}
|
|
|
|
|
game.save('only_zhu',true);
|
|
|
|
|
game.save('control_all',true);
|
|
|
|
|
ui.wuxie.hide();
|
|
|
|
|
ui.create.cards();
|
|
|
|
|
game.finishCards();
|
|
|
|
|
}
|
|
|
|
|
game.delay();
|
|
|
|
|
"step 2"
|
|
|
|
|
if(_status.mode=='four'){
|
|
|
|
|
var list=['zhu','zhong','zhong','zhong','ezhu','ezhong','ezhong','ezhong'];
|
|
|
|
|
list.randomSort();
|
|
|
|
|
var side=Math.random()<0.5;
|
|
|
|
|
for(var i=0;i<8;i++){
|
|
|
|
|
if(list[i][0]=='e'){
|
|
|
|
|
game.players[i].side=side;
|
|
|
|
|
game.players[i].identity=list[i].slice(1);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.players[i].side=!side;
|
|
|
|
|
game.players[i].identity=list[i];
|
|
|
|
|
}
|
|
|
|
|
if(game.players[i].identity=='zhu'){
|
|
|
|
|
game[game.players[i].side+'Zhu']=game.players[i];
|
|
|
|
|
game.players[i].isZhu=true;
|
|
|
|
|
}
|
|
|
|
|
game.players[i].setIdentity(game.players[i].identity);
|
|
|
|
|
game.players[i].node.identity.dataset.color=get.translation(game.players[i].side+'Color');
|
|
|
|
|
}
|
|
|
|
|
game.chooseCharacterFour();
|
|
|
|
|
}
|
|
|
|
|
else if(_status.mode=='jiange'){
|
|
|
|
|
var list=['shumech','shu','shuboss','shu','wei','weiboss','wei','weimech'];
|
|
|
|
|
var pos=Math.floor(Math.random()*8);
|
|
|
|
|
for(var i=0;i<8;i++){
|
|
|
|
|
var j=pos+i;
|
|
|
|
|
if(j>=8){
|
|
|
|
|
j-=8;
|
|
|
|
|
}
|
|
|
|
|
if(list[i][0]=='w'){
|
|
|
|
|
game.players[j].side=true;
|
|
|
|
|
game.players[j].setIdentity('wei');
|
|
|
|
|
game.players[j].identity='wei';
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.players[j].side=false;
|
|
|
|
|
game.players[j].setIdentity('shu');
|
|
|
|
|
game.players[j].identity='shu';
|
|
|
|
|
}
|
|
|
|
|
if(list[i].indexOf('mech')!=-1){
|
|
|
|
|
game.players[j].type='mech';
|
|
|
|
|
}
|
|
|
|
|
else if(list[i].indexOf('boss')!=-1){
|
|
|
|
|
game.players[j].type='boss';
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.players[j].type='human';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.chooseCharacterJiange();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.chooseCharacter();
|
|
|
|
|
}
|
|
|
|
|
"step 3"
|
|
|
|
|
var players=get.players(lib.sort.position);
|
|
|
|
|
var info=[];
|
|
|
|
|
for(var i=0;i<players.length;i++){
|
|
|
|
|
info.push({
|
|
|
|
|
name:players[i].name,
|
|
|
|
|
name2:players[i].name2,
|
|
|
|
|
identity:players[i].node.identity.firstChild.innerHTML,
|
|
|
|
|
color:players[i].node.identity.dataset.color
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
_status.videoInited=true;
|
|
|
|
|
if(_status.mode=='four'||_status.mode=='jiange'){
|
|
|
|
|
info.push(false);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
info.push(lib.storage.single_control&&lib.storage.control_all&&game.players.length>=4);
|
|
|
|
|
}
|
|
|
|
|
game.addVideo('init',null,info);
|
|
|
|
|
event.trigger('gameStart');
|
|
|
|
|
if(_status.mode=='four'){
|
|
|
|
|
game.gameDraw(_status.firstAct,function(player){
|
|
|
|
|
if(player==_status.firstAct.previousSeat){
|
|
|
|
|
return 5;
|
|
|
|
|
}
|
|
|
|
|
return 4;
|
|
|
|
|
});
|
|
|
|
|
if(game.me==_status.firstAct.previous||game.me==_status.firstAct.previous.previous){
|
|
|
|
|
game.me.chooseBool('是否置换手牌?');
|
|
|
|
|
event.replaceCard=true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(_status.mode=='jiange'){
|
|
|
|
|
var firstAct;
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(game.players[i].type=='mech'&&game.players[i].group=='wei'){
|
|
|
|
|
firstAct=game.players[i];break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_status.actlist=[
|
|
|
|
|
firstAct,
|
|
|
|
|
firstAct.next,
|
|
|
|
|
firstAct.previous,
|
|
|
|
|
firstAct.next.next,
|
|
|
|
|
firstAct.previous.previous,
|
|
|
|
|
firstAct.next.next.next,
|
|
|
|
|
firstAct.previous.previous.previous,
|
|
|
|
|
firstAct.next.next.next.next
|
|
|
|
|
];
|
|
|
|
|
game.gameDraw(firstAct);
|
|
|
|
|
game.phaseLoopJiange();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
var firstAct;
|
|
|
|
|
if(lib.storage.zhu){
|
|
|
|
|
firstAct=(_status.currentSide==game.me.side)?game.friendZhu:game.enemyZhu;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(!lib.storage.cross_seat&&!lib.storage.random_seat&&lib.storage.number>1){
|
|
|
|
|
for(var i=0;i<game.players.length-1;i++){
|
|
|
|
|
if(game.players[i].side!=game.players[i+1].side){
|
|
|
|
|
var actcount;
|
|
|
|
|
if(Math.random()<0.5){
|
|
|
|
|
actcount=i;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(i>=lib.storage.number){
|
|
|
|
|
actcount=i-lib.storage.number;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
actcount=i+lib.storage.number;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(actcount>0){
|
|
|
|
|
actcount--;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
actcount=game.players.length-1;
|
|
|
|
|
}
|
|
|
|
|
firstAct=game.players[actcount];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
firstAct=game.players[Math.floor(Math.random()*game.players.length)];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.gameDraw(firstAct,4);
|
|
|
|
|
_status.first_less=true;
|
|
|
|
|
_status.round=0;
|
|
|
|
|
if(lib.storage.single_control){
|
|
|
|
|
lib.skill.global.push('versus_swap');
|
|
|
|
|
ui.autoreplace=ui.create.div('.caption.normal');
|
|
|
|
|
ui.autoreplace.innerHTML='<div class="underline">自动换人</div>';
|
|
|
|
|
ui.autoreplace.style.textAlign='center';
|
|
|
|
|
if(lib.storage.autoreplaceinnerhtml){
|
|
|
|
|
ui.autoreplace.classList.add('on')
|
|
|
|
|
}
|
|
|
|
|
ui.autoreplace.listen(game.switchAutoreplace);
|
|
|
|
|
|
|
|
|
|
// ui.versusreplace=ui.create.system('换人',null,true);
|
|
|
|
|
// lib.setPopped(ui.versusreplace,game.versusHoverReplace);
|
|
|
|
|
if(game.players.length>2){
|
|
|
|
|
ui.versushs=ui.create.system('手牌',null,true);
|
|
|
|
|
lib.setPopped(ui.versushs,game.versusHoverHandcards,220);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_status.enemyCount=ui.create.system('杀敌: '+get.cnNumber(0,true),null,true);
|
|
|
|
|
_status.friendCount=ui.create.system('阵亡: '+get.cnNumber(0,true),null,true);
|
|
|
|
|
// _status.friendCount=ui.create.system('友方',null,true);
|
|
|
|
|
// _status.enemyCount=ui.create.system('敌方',null,true);
|
|
|
|
|
|
|
|
|
|
lib.setPopped(_status.friendCount,game.versusHoverFriend);
|
|
|
|
|
lib.setPopped(_status.enemyCount,game.versusHoverEnemy);
|
|
|
|
|
|
|
|
|
|
if(lib.storage.zhu){
|
|
|
|
|
_status.currentSide=true;
|
|
|
|
|
game.versusPhaseLoop(firstAct);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.versusPhaseLoop(firstAct);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(_status.mode!='four'){
|
|
|
|
|
event.finish();
|
|
|
|
|
}
|
|
|
|
|
"step 4"
|
|
|
|
|
if(event.replaceCard&&result.bool){
|
|
|
|
|
var hs=game.me.get('h');
|
|
|
|
|
for(var i=0;i<hs.length;i++){
|
|
|
|
|
ui.discardPile.appendChild(hs[i]);
|
|
|
|
|
}
|
|
|
|
|
game.me.directgain(get.cards(hs.length));
|
|
|
|
|
}
|
|
|
|
|
game.phaseLoop(_status.firstAct);
|
|
|
|
|
},
|
2015-04-29 03:25:17 +00:00
|
|
|
|
game:{
|
2015-11-04 01:59:00 +00:00
|
|
|
|
getVideoName:function(){
|
|
|
|
|
var str=get.translation(game.me.name);
|
|
|
|
|
if(game.me.name2){
|
|
|
|
|
str+='/'+get.translation(game.me.name2);
|
|
|
|
|
}
|
|
|
|
|
var name=[
|
|
|
|
|
str,'对决 - '+lib.storage.number+'v'+lib.storage.number
|
|
|
|
|
];
|
|
|
|
|
return name;
|
|
|
|
|
},
|
2015-12-15 08:20:57 +00:00
|
|
|
|
addRecord:function(bool){
|
|
|
|
|
if(typeof bool=='boolean'){
|
|
|
|
|
var data=lib.config.gameRecord.versus.data;
|
|
|
|
|
var identity=get.cnNumber(lib.storage.number)+'人';
|
|
|
|
|
if(!data[identity]){
|
|
|
|
|
data[identity]=[0,0];
|
|
|
|
|
}
|
|
|
|
|
if(bool){
|
|
|
|
|
data[identity][0]++;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
data[identity][1]++;
|
|
|
|
|
}
|
|
|
|
|
var list=['一人','两人','三人'];
|
|
|
|
|
var str='';
|
|
|
|
|
for(var i=0;i<list.length;i++){
|
|
|
|
|
if(data[list[i]]){
|
|
|
|
|
str+=list[i]+':'+data[list[i]][0]+'胜'+' '+data[list[i]][1]+'负<br>';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
lib.config.gameRecord.versus.str=str;
|
|
|
|
|
game.saveConfig('gameRecord',lib.config.gameRecord);
|
|
|
|
|
}
|
|
|
|
|
},
|
2016-01-24 08:34:21 +00:00
|
|
|
|
chooseCharacterJiange:function(){
|
|
|
|
|
var next=game.createEvent('chooseCharacter',false);
|
|
|
|
|
next.showConfig=true;
|
|
|
|
|
next.content=function(){
|
|
|
|
|
'step 0'
|
2016-02-05 03:09:04 +00:00
|
|
|
|
if(lib.config.hiddenCharacterPack.contains('boss')){
|
|
|
|
|
game.loadPackage('character/boss');
|
|
|
|
|
}
|
|
|
|
|
'step 1'
|
2016-02-06 01:58:11 +00:00
|
|
|
|
for(var i in lib.skill){
|
|
|
|
|
if(lib.skill[i].changeSeat){
|
|
|
|
|
lib.skill[i]={};
|
|
|
|
|
if(lib.translate[i+'_info']){
|
|
|
|
|
lib.translate[i+'_info']='此模式下不可用';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-01-24 08:34:21 +00:00
|
|
|
|
var list={
|
|
|
|
|
weilist:[],shulist:[],
|
|
|
|
|
weimech:[],shumech:[],
|
|
|
|
|
weiboss:[],shuboss:[],
|
|
|
|
|
}
|
|
|
|
|
event.list=list;
|
2016-01-28 06:46:42 +00:00
|
|
|
|
if(lib.characterPack.boss){
|
|
|
|
|
for(var i in lib.characterPack.boss){
|
|
|
|
|
if(!lib.character[i]&&lib.characterPack.boss[i][4]){
|
|
|
|
|
if(lib.characterPack.boss[i][4].contains('jiangeboss')||
|
|
|
|
|
lib.characterPack.boss[i][4].contains('jiangemech')){
|
|
|
|
|
lib.character[i]=lib.characterPack.boss[i];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-01-24 08:34:21 +00:00
|
|
|
|
for(var i in lib.character){
|
|
|
|
|
if(lib.character[i][4]){
|
|
|
|
|
if(lib.character[i][4].contains('jiangeboss')){
|
|
|
|
|
list[lib.character[i][1]+'boss'].push(i);continue;
|
|
|
|
|
}
|
|
|
|
|
else if(lib.character[i][4].contains('jiangemech')){
|
|
|
|
|
list[lib.character[i][1]+'mech'].push(i);continue;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(lib.character[i][4]&&lib.character[i][4].contains('forbidai')) continue;
|
|
|
|
|
if(lib.config.forbidai.contains(i)) continue;
|
|
|
|
|
if(lib.config.forbidall.contains(i)) continue;
|
|
|
|
|
if(lib.config.banned.contains(i)) continue;
|
|
|
|
|
if(!get.config('double_character')&&get.config('ban_weak')&&
|
|
|
|
|
(lib.config.forbidsingle.contains(i)||lib.rank.c.contains(i)||lib.rank.d.contains(i))) continue;
|
|
|
|
|
if(get.config('ban_strong')&&(lib.rank.s.contains(i)||lib.rank.ap.contains(i))) continue;
|
|
|
|
|
if(get.config('double_character')&&lib.config.forbiddouble.contains(i)) continue;
|
|
|
|
|
if(lib.character[i][1]=='wei'){
|
|
|
|
|
list.weilist.push(i);
|
|
|
|
|
}
|
|
|
|
|
else if(lib.character[i][1]=='shu'){
|
|
|
|
|
list.shulist.push(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!list.weiboss.length){
|
|
|
|
|
alert('剑阁模式不可隐藏boss武将包,请在选项-其它中选择“重置隐藏扩展包”');
|
|
|
|
|
event.finish();
|
|
|
|
|
_status.over=true;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var dialog;
|
|
|
|
|
switch(game.me.type){
|
|
|
|
|
case 'human':
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(game.players[i].type!='human'){
|
|
|
|
|
game.players[i].init(list[game.players[i].identity+game.players[i].type].randomRemove());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
dialog=ui.create.dialog('选择角色',[list[game.me.identity+'list'].randomGets(8),'character']);
|
|
|
|
|
ui.create.cheat=function(){
|
|
|
|
|
_status.createControl=ui.cheat2;
|
|
|
|
|
ui.cheat=ui.create.control('更换',function(){
|
|
|
|
|
if(ui.cheat2&&ui.cheat2.dialog==_status.event.dialog){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(game.changeCoin){
|
|
|
|
|
game.changeCoin(-3);
|
|
|
|
|
}
|
|
|
|
|
_status.event.dialog.close();
|
|
|
|
|
_status.event.dialog=ui.create.dialog('选择角色',[list[game.me.identity+'list'].randomGets(8),'character']);
|
|
|
|
|
game.uncheck();
|
|
|
|
|
game.check();
|
|
|
|
|
});
|
|
|
|
|
delete _status.createControl;
|
|
|
|
|
}
|
|
|
|
|
event.dialogxx=ui.create.characterDialog(function(name){
|
|
|
|
|
if(lib.character[name][4]){
|
|
|
|
|
if(lib.character[name][4].contains('jiangeboss')) return true;
|
|
|
|
|
if(lib.character[name][4].contains('jiangemech')) return true;
|
|
|
|
|
}
|
|
|
|
|
if(lib.character[name][1]!=game.me.identity) return true;
|
|
|
|
|
});
|
|
|
|
|
ui.create.cheat2=function(){
|
|
|
|
|
ui.cheat2=ui.create.control('自由选将',function(){
|
|
|
|
|
if(this.dialog==_status.event.dialog){
|
|
|
|
|
if(game.changeCoin){
|
|
|
|
|
game.changeCoin(50);
|
|
|
|
|
}
|
|
|
|
|
this.dialog.close();
|
|
|
|
|
_status.event.dialog=this.backup;
|
|
|
|
|
this.backup.open();
|
|
|
|
|
delete this.backup;
|
|
|
|
|
game.uncheck();
|
|
|
|
|
game.check();
|
|
|
|
|
if(ui.cheat){
|
|
|
|
|
ui.cheat.style.opacity=1;
|
|
|
|
|
}
|
2015-12-12 08:37:15 +00:00
|
|
|
|
}
|
|
|
|
|
else{
|
2016-01-24 08:34:21 +00:00
|
|
|
|
if(game.changeCoin){
|
|
|
|
|
game.changeCoin(-10);
|
|
|
|
|
}
|
|
|
|
|
this.backup=_status.event.dialog;
|
|
|
|
|
_status.event.dialog.close();
|
|
|
|
|
_status.event.dialog=_status.event.parent.dialogxx;
|
|
|
|
|
this.dialog=_status.event.dialog;
|
|
|
|
|
this.dialog.open();
|
|
|
|
|
game.uncheck();
|
|
|
|
|
game.check();
|
|
|
|
|
if(ui.cheat){
|
|
|
|
|
ui.cheat.style.opacity=0.6;
|
|
|
|
|
}
|
2015-12-12 08:37:15 +00:00
|
|
|
|
}
|
2016-01-24 08:34:21 +00:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if(!ui.cheat&&get.config('change_choice')) ui.create.cheat();
|
|
|
|
|
if(!ui.cheat2&&get.config('free_choose')) ui.create.cheat2();
|
|
|
|
|
break;
|
|
|
|
|
case 'mech':
|
|
|
|
|
dialog=ui.create.dialog('选择角色',[list[game.me.identity+'mech'],'character']);
|
|
|
|
|
break;
|
|
|
|
|
case 'boss':
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(game.players[i].type=='mech'){
|
|
|
|
|
game.players[i].init(list[game.players[i].identity+game.players[i].type].randomRemove());
|
2015-12-12 08:37:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-01-24 08:34:21 +00:00
|
|
|
|
dialog=ui.create.dialog('选择角色',[list[game.me.identity+'boss'],'character']);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2016-02-05 03:09:04 +00:00
|
|
|
|
game.me.chooseButton(dialog,true).selectButton=function(){
|
|
|
|
|
if(get.config('double_character_jiange')) return [2,2];
|
|
|
|
|
return [1,1];
|
|
|
|
|
};
|
|
|
|
|
'step 2'
|
2016-01-24 08:34:21 +00:00
|
|
|
|
if(ui.cheat){
|
|
|
|
|
ui.cheat.close();
|
|
|
|
|
delete ui.cheat;
|
|
|
|
|
}
|
|
|
|
|
if(ui.cheat2){
|
|
|
|
|
ui.cheat2.close();
|
|
|
|
|
delete ui.cheat2;
|
|
|
|
|
}
|
2016-02-05 03:09:04 +00:00
|
|
|
|
var double=(result.links.length==2);
|
|
|
|
|
game.me.init(result.links[0],result.links[1]);
|
2016-01-24 08:34:21 +00:00
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(game.players[i].name) continue;
|
|
|
|
|
if(game.players[i].type!='human'){
|
|
|
|
|
game.players[i].init(event.list[game.players[i].identity+game.players[i].type].randomRemove());
|
2015-12-12 08:37:15 +00:00
|
|
|
|
}
|
|
|
|
|
else{
|
2016-02-05 03:09:04 +00:00
|
|
|
|
if(double){
|
|
|
|
|
game.players[i].init(event.list[game.players[i].identity+'list'].randomRemove(),event.list[game.players[i].identity+'list'].randomRemove());
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.players[i].init(event.list[game.players[i].identity+'list'].randomRemove());
|
|
|
|
|
}
|
2015-12-12 08:37:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-01-24 08:34:21 +00:00
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
chooseCharacterFour:function(){
|
|
|
|
|
var next=game.createEvent('chooseCharacter',false);
|
|
|
|
|
next.ai=function(player,list,list2){
|
|
|
|
|
if(player.identity=='zhu'){
|
|
|
|
|
list2.randomSort();
|
|
|
|
|
var choice;
|
|
|
|
|
if(Math.random()-0.8<0&&list2.length){
|
|
|
|
|
choice=list2[0];
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
2016-01-24 08:34:21 +00:00
|
|
|
|
else{
|
|
|
|
|
choice=list[0];
|
2015-11-13 01:43:16 +00:00
|
|
|
|
}
|
2016-01-24 08:34:21 +00:00
|
|
|
|
player.init(choice);
|
|
|
|
|
player.hp++;
|
|
|
|
|
player.maxHp++;
|
|
|
|
|
player.update();
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
2016-01-24 08:34:21 +00:00
|
|
|
|
else if(Math.random()<0.5){
|
|
|
|
|
var choice=0;
|
|
|
|
|
for(var i=0;i<list.length;i++){
|
|
|
|
|
if(lib.character[list[i]][1]==game[player.side+'Zhu'].group){
|
|
|
|
|
choice=i;break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
player.init(list[choice]);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
player.init(list[0]);
|
|
|
|
|
}
|
|
|
|
|
this.list.remove(player.name);
|
|
|
|
|
this.list2.remove(player.name);
|
|
|
|
|
}
|
|
|
|
|
next.content=function(){
|
|
|
|
|
"step 0"
|
|
|
|
|
var i;
|
|
|
|
|
var list;
|
|
|
|
|
var list2=[];
|
2015-04-29 03:25:17 +00:00
|
|
|
|
|
2016-01-24 08:34:21 +00:00
|
|
|
|
event.list=[];
|
|
|
|
|
event.filterChoice=function(name){
|
|
|
|
|
if(get.config('enable_all')) return false;
|
2016-02-01 09:32:18 +00:00
|
|
|
|
if(['yuanshu','re_yuanshu','zhangxingcai','hetaiyou','wenpin','yuji',
|
|
|
|
|
'xunyu','lusu','guanping','zhangzong','zhoutai','sp_zhangjiao','zhangjiao',
|
|
|
|
|
'shixie','zhanglu','chenlin','mayunlu','yangxiu','zhugeke','chengyu',
|
|
|
|
|
'zhangbao','zhangliang','sunhao','wutugu','zhugeguo','liuzan','lingcao',
|
2016-02-14 09:04:31 +00:00
|
|
|
|
'sunru','lingju','lifeng','hanba','sunluyu','zhuling','daxiaoqiao',
|
2016-02-01 09:32:18 +00:00
|
|
|
|
'sp_zhaoyun','sp_diaochan','sp_pangtong','sp_caoren','sp_daqiao',
|
|
|
|
|
'sp_ganning','sp_zhangfei','sp_xiahoudun'].contains(name)){
|
2016-01-24 08:34:21 +00:00
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
if(lib.characterPack.refresh[name]) return false;
|
|
|
|
|
if(lib.characterPack.standard[name]){
|
|
|
|
|
if(lib.characterPack.refresh['re_'+name]) return true;
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if(lib.characterPack.shenhua[name]) return false;
|
|
|
|
|
if(lib.characterPack.sp[name]) return false;
|
|
|
|
|
if(lib.characterPack.yijiang[name]) return false;
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
for(i in lib.character){
|
|
|
|
|
if(event.filterChoice(i)) continue;
|
|
|
|
|
if(lib.character[i][4]&&lib.character[i][4].contains('forbidai')) continue;
|
|
|
|
|
if(lib.config.forbidai.contains(i)) continue;
|
|
|
|
|
if(lib.config.forbidall.contains(i)) continue;
|
|
|
|
|
if(lib.config.banned.contains(i)) continue;
|
|
|
|
|
if(!get.config('double_character')&&get.config('ban_weak')&&
|
|
|
|
|
(lib.config.forbidsingle.contains(i)||lib.rank.c.contains(i)||lib.rank.d.contains(i))) continue;
|
|
|
|
|
if(get.config('ban_strong')&&(lib.rank.s.contains(i)||lib.rank.ap.contains(i))) continue;
|
|
|
|
|
if(get.config('double_character')&&lib.config.forbiddouble.contains(i)) continue;
|
|
|
|
|
event.list.push(i);
|
|
|
|
|
if(lib.character[i][4]&&lib.character[i][4].contains('zhu')){
|
|
|
|
|
list2.push(i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
event.list.randomSort();
|
|
|
|
|
event.list2=list2;
|
|
|
|
|
event.current=game.players.randomGet();
|
|
|
|
|
_status.firstAct=event.current;
|
|
|
|
|
event.four_assign=get.config('four_assign');
|
|
|
|
|
event.flipassign=true;
|
|
|
|
|
"step 1"
|
|
|
|
|
if(event.current==game.me||(event.four_assign&&event.current.side==game.me.side)){
|
|
|
|
|
var dialog=event.xdialog||ui.create.characterDialog(event.filterChoice);
|
|
|
|
|
var names=[];
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(game.players[i].name){
|
|
|
|
|
names.push(game.players[i].name);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i=0;i<dialog.buttons.length;i++){
|
|
|
|
|
if(names.contains(dialog.buttons[i].link)){
|
|
|
|
|
dialog.buttons[i].classList.add('unselectable');
|
|
|
|
|
dialog.buttons[i].classList.add('noclick');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(!event.groupControl){
|
|
|
|
|
event.groupControl=ui.create.groupControl(dialog);
|
|
|
|
|
}
|
|
|
|
|
game.me.chooseButton(dialog,true).closeDialog=false;
|
|
|
|
|
event.xdialog=dialog;
|
|
|
|
|
dialog.static=true;
|
|
|
|
|
event.current.classList.add('selectedx');
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
event.ai(event.current,event.list.randomGets(3),event.list2);
|
|
|
|
|
if(!event.four_assign){
|
|
|
|
|
event.current=event.current.next;
|
|
|
|
|
event.redo();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"step 2"
|
|
|
|
|
event.current.classList.remove('selectedx');
|
|
|
|
|
if(event.current.side==game.me.side){
|
|
|
|
|
event.current.init(result.buttons[0].link);
|
|
|
|
|
event.list.remove(event.current.name);
|
|
|
|
|
event.list2.remove(event.current.name);
|
|
|
|
|
if(event.current.identity=='zhu'){
|
|
|
|
|
event.current.hp++;
|
|
|
|
|
event.current.maxHp++;
|
|
|
|
|
event.current.update();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(event.four_assign){
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(!game.players[i].name) break;
|
|
|
|
|
}
|
|
|
|
|
if(i<game.players.length){
|
|
|
|
|
var side=event.current.side;
|
|
|
|
|
event.current=_status.firstAct;
|
|
|
|
|
if(event.flipassign){
|
|
|
|
|
for(var iwhile=0;iwhile<8;iwhile++){
|
|
|
|
|
event.current=event.current.next;
|
|
|
|
|
if(event.current.side!=side&&!event.current.name){
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
for(var iwhile=0;iwhile<8;iwhile++){
|
|
|
|
|
event.current=event.current.previous;
|
|
|
|
|
if(event.current.side==side&&!event.current.name){
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
event.flipassign=!event.flipassign;
|
|
|
|
|
event.goto(1);
|
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
else{
|
2016-01-24 08:34:21 +00:00
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(!game.players[i].name){
|
|
|
|
|
event.ai(game.players[i],event.list.splice(0,3),event.list2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
"step 3"
|
|
|
|
|
if(event.groupControl){
|
|
|
|
|
event.groupControl.close();
|
|
|
|
|
}
|
|
|
|
|
if(event.xdialog){
|
|
|
|
|
event.xdialog.close();
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
chooseCharacter:function(){
|
|
|
|
|
var next=game.createEvent('chooseCharacter',false);
|
|
|
|
|
next.showConfig=true;
|
|
|
|
|
next.content=function(){
|
|
|
|
|
"step 0"
|
2016-01-28 06:46:42 +00:00
|
|
|
|
if(lib.config.continue_name_versus){
|
|
|
|
|
_status.friend=lib.config.continue_name_versus.friend;
|
|
|
|
|
_status.enemy=lib.config.continue_name_versus.enemy;
|
|
|
|
|
_status.color=lib.config.continue_name_versus.color;
|
|
|
|
|
game.additionaldead=[];
|
|
|
|
|
event.goto(1);
|
|
|
|
|
game.saveConfig('continue_name_versus');
|
|
|
|
|
return;
|
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
event.check=function(){
|
2015-05-08 08:07:38 +00:00
|
|
|
|
this.dialog.classList.add('fullwidth');
|
|
|
|
|
this.dialog.classList.add('fullheight');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
this.dialog.classList.add('noslide');
|
|
|
|
|
for(var i=0;i<this.dialog.buttons.length;i++) this.dialog.buttons[i].style.opacity=1;
|
|
|
|
|
this.dialog.add('选项');
|
|
|
|
|
this.dialog.versus_zhu=this.dialog.add(ui.create.switcher('versus_zhu',lib.storage.zhu)).querySelector('.toggle');
|
2015-11-13 01:43:16 +00:00
|
|
|
|
// this.dialog.versus_only_zhu=this.dialog.add(ui.create.switcher('versus_only_zhu',lib.storage.only_zhu)).querySelector('.toggle');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
this.dialog.versus_main_zhu=this.dialog.add(ui.create.switcher('versus_main_zhu',lib.storage.main_zhu)).querySelector('.toggle');
|
|
|
|
|
if(lib.storage.zhu){
|
2015-11-13 01:43:16 +00:00
|
|
|
|
// this.dialog.versus_only_zhu.parentNode.classList.remove('disabled');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
this.dialog.versus_main_zhu.parentNode.classList.remove('disabled');
|
|
|
|
|
}
|
|
|
|
|
else{
|
2015-11-13 01:43:16 +00:00
|
|
|
|
// this.dialog.versus_only_zhu.parentNode.classList.add('disabled');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
this.dialog.versus_main_zhu.parentNode.classList.add('disabled');
|
|
|
|
|
}
|
2015-11-18 03:39:14 +00:00
|
|
|
|
// this.dialog.versus_cross_seat=this.dialog.add(ui.create.switcher('versus_cross_seat',lib.storage.cross_seat)).querySelector('.toggle');
|
|
|
|
|
// this.dialog.versus_random_seat=this.dialog.add(ui.create.switcher('versus_random_seat',lib.storage.random_seat)).querySelector('.toggle');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
this.dialog.versus_noreplace_end=this.dialog.add(ui.create.switcher('versus_noreplace_end',lib.storage.noreplace_end)).querySelector('.toggle');
|
2015-11-18 03:39:14 +00:00
|
|
|
|
this.dialog.versus_assign_enemy=this.dialog.add(ui.create.switcher('versus_assign_enemy',lib.storage.assign_enemy)).querySelector('.toggle');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
this.dialog.versus_single_control=this.dialog.add(ui.create.switcher('versus_single_control',lib.storage.single_control)).querySelector('.toggle');
|
2015-11-23 10:59:44 +00:00
|
|
|
|
// this.dialog.versus_control_all=this.dialog.add(ui.create.switcher('versus_control_all',lib.storage.control_all)).querySelector('.toggle');
|
2016-01-12 13:18:47 +00:00
|
|
|
|
this.dialog.versus_first_less=this.dialog.add(ui.create.switcher('versus_first_less',get.config('first_less'))).querySelector('.toggle');
|
2015-11-18 03:39:14 +00:00
|
|
|
|
this.dialog.versus_reward=this.dialog.add(ui.create.switcher('versus_reward',[0,1,2,3,4],lib.storage.versus_reward)).querySelector('.toggle');
|
2015-11-23 10:59:44 +00:00
|
|
|
|
this.dialog.versus_punish=this.dialog.add(ui.create.switcher('versus_punish',['弃牌','无','摸牌'],lib.storage.versus_punish)).querySelector('.toggle');
|
2015-11-18 03:39:14 +00:00
|
|
|
|
this.dialog.versus_seat_order=this.dialog.add(ui.create.switcher('seat_order',['对阵','交叉','随机'],lib.storage.seat_order)).querySelector('.toggle');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
this.dialog.versus_number=this.dialog.add(ui.create.switcher('versus_number',[1,2,3],lib.storage.number)).querySelector('.toggle');
|
2015-05-08 08:07:38 +00:00
|
|
|
|
this.dialog.replace_number=this.dialog.add(ui.create.switcher('replace_number',[0,1,2,3,5,7,9,17],lib.storage.replace_number)).querySelector('.toggle');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
this.dialog.choice=this.dialog.add(ui.create.switcher('choice',[12,16,20,24,40,'∞'],lib.storage.choice)).querySelector('.toggle');
|
2015-11-13 01:43:16 +00:00
|
|
|
|
|
2015-11-18 03:39:14 +00:00
|
|
|
|
// if(lib.storage.cross_seat){
|
|
|
|
|
// this.dialog.versus_random_seat.parentNode.classList.add('disabled');
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// this.dialog.versus_random_seat.parentNode.classList.remove('disabled');
|
|
|
|
|
// if(lib.storage.random_seat){
|
|
|
|
|
// this.dialog.versus_cross_seat.parentNode.classList.add('disabled');
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// this.dialog.versus_cross_seat.parentNode.classList.remove('disabled');
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2015-11-23 10:59:44 +00:00
|
|
|
|
// if(lib.storage.single_control){
|
|
|
|
|
// this.dialog.versus_control_all.parentNode.classList.remove('disabled');
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// this.dialog.versus_control_all.parentNode.classList.add('disabled');
|
|
|
|
|
// }
|
2015-04-29 03:25:17 +00:00
|
|
|
|
};
|
|
|
|
|
event.confirm=function(){
|
|
|
|
|
var dialog=event.dialog;
|
|
|
|
|
var num=lib.storage.number+lib.storage.replace_number;
|
|
|
|
|
_status.friend.splice(num);
|
|
|
|
|
_status.enemy.splice(num);
|
|
|
|
|
dialog.close();
|
|
|
|
|
if(ui.confirm) ui.confirm.close();
|
|
|
|
|
game.resume();
|
|
|
|
|
};
|
|
|
|
|
ui.control.style.transition='all 0s';
|
2015-10-31 16:18:20 +00:00
|
|
|
|
if(lib.config.layout=='mobile'){
|
|
|
|
|
ui.control.style.top='calc(100% - 70px)';
|
|
|
|
|
}
|
|
|
|
|
else if(lib.config.layout=='phone'){
|
|
|
|
|
ui.control.style.top='calc(100% - 80px)';
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
ui.control.style.top='calc(100% - 30px)';
|
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
_status.friend=[];
|
|
|
|
|
_status.enemy=[];
|
2015-05-05 14:57:35 +00:00
|
|
|
|
game.additionaldead=[];
|
2015-04-29 03:25:17 +00:00
|
|
|
|
_status.color=Math.random()<0.5;
|
|
|
|
|
var i,list=[];
|
|
|
|
|
for(i in lib.character){
|
|
|
|
|
if(lib.config.forbidai.contains(i)) continue;
|
|
|
|
|
if(lib.config.forbidversus.contains(i)) continue;
|
2015-12-06 15:23:47 +00:00
|
|
|
|
if(lib.config.banned.contains(i)) continue;
|
2015-12-07 11:15:35 +00:00
|
|
|
|
if(lib.character[i][4]&&lib.character[i][4].contains('forbidai')) continue;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
if(get.config('ban_weak')&&lib.config.forbidsingle.contains(i)) continue;
|
|
|
|
|
if(get.config('ban_weak')&&lib.config.forbidall.contains(i)) continue;
|
2015-11-18 03:39:14 +00:00
|
|
|
|
if(get.config('ban_weak')&&(lib.rank.c.contains(i)||lib.rank.d.contains(i))) continue;
|
|
|
|
|
if(get.config('ban_strong')&&(lib.rank.s.contains(i)||lib.rank.ap.contains(i))) continue;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
list.push(i);
|
|
|
|
|
}
|
|
|
|
|
var groupSort=function(name){
|
|
|
|
|
if(lib.character[name][1]=='wei') return 0;
|
|
|
|
|
if(lib.character[name][1]=='shu') return 1;
|
|
|
|
|
if(lib.character[name][1]=='wu') return 2;
|
|
|
|
|
if(lib.character[name][1]=='qun') return 3;
|
|
|
|
|
}
|
|
|
|
|
var sortByGroup=function(a,b){
|
|
|
|
|
var del=groupSort(a)-groupSort(b);
|
|
|
|
|
if(del!=0) return del;
|
|
|
|
|
if(a.indexOf('_')!=-1){
|
|
|
|
|
a=a.slice(a.indexOf('_')+1);
|
|
|
|
|
}
|
|
|
|
|
if(b.indexOf('_')!=-1){
|
|
|
|
|
b=b.slice(b.indexOf('_')+1);
|
|
|
|
|
}
|
|
|
|
|
return a>b?1:-1;
|
|
|
|
|
}
|
|
|
|
|
if(lib.storage.choice=='∞'){
|
|
|
|
|
list.sort(sortByGroup);
|
|
|
|
|
}
|
|
|
|
|
else{
|
2015-05-03 15:17:15 +00:00
|
|
|
|
list.randomSort();
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
_status.list=list;
|
|
|
|
|
var choice=(lib.storage.choice=='∞')?list.length:lib.storage.choice;
|
|
|
|
|
event.dialog=ui.create.dialog('选择角色',[list.slice(0,choice),'character']);
|
2016-01-07 09:29:44 +00:00
|
|
|
|
event.dialog.classList.add('fixed');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
// for(var i=0;i<event.dialog.buttons.length;i++){
|
|
|
|
|
// event.dialog.buttons[i].style.transform='scale(0.95)';
|
|
|
|
|
// }
|
|
|
|
|
event.check();
|
|
|
|
|
ui.create.cheat=function(){
|
2015-09-03 03:49:14 +00:00
|
|
|
|
_status.createControl=event.fill;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
ui.cheat=ui.create.control('更换',function(){
|
|
|
|
|
if(lib.storage.choice=='∞'){
|
|
|
|
|
list.sort(sortByGroup);
|
|
|
|
|
}
|
|
|
|
|
else{
|
2015-05-03 15:17:15 +00:00
|
|
|
|
list.randomSort();
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
event.dialog.close();
|
|
|
|
|
_status.friend.length=0;
|
|
|
|
|
_status.enemy.length=0;
|
|
|
|
|
var choice=(lib.storage.choice=='∞')?list.length:lib.storage.choice;
|
|
|
|
|
event.dialog=ui.create.dialog('选择角色',[list.slice(0,choice),'character']);
|
|
|
|
|
event.check();
|
|
|
|
|
});
|
2015-09-03 03:49:14 +00:00
|
|
|
|
delete _status.createControl;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
if(!ui.cheat&&get.config('change_choice'))
|
|
|
|
|
ui.create.cheat();
|
2016-01-07 09:29:44 +00:00
|
|
|
|
if(lib.storage.test){
|
|
|
|
|
lib.config.game_speed='vfast';
|
|
|
|
|
_status.auto=true;
|
|
|
|
|
ui.auto.classList.add('glow');
|
|
|
|
|
setTimeout(function(){
|
|
|
|
|
event.switchToAuto();
|
|
|
|
|
},500);
|
|
|
|
|
}
|
|
|
|
|
event.switchToAuto=function(){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
delete _status.choosefinished;
|
2016-01-07 09:29:44 +00:00
|
|
|
|
event.fill.close();
|
2015-04-29 03:25:17 +00:00
|
|
|
|
var buttons=_status.event.dialog.buttons.slice(0);
|
2015-05-03 15:17:15 +00:00
|
|
|
|
buttons.randomSort();
|
2015-04-29 03:25:17 +00:00
|
|
|
|
for(var i=0;i<buttons.length;i++){
|
2015-12-12 08:37:15 +00:00
|
|
|
|
if(buttons[i].classList.contains('glow')||buttons[i].classList.contains('selectedx')){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
buttons.splice(i,1);i--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var dialog=_status.event.dialog;
|
|
|
|
|
var max=dialog.versus_number.link+dialog.replace_number.link;
|
|
|
|
|
for(var i=0;i<buttons.length;i++){
|
|
|
|
|
if(_status.friend.length<max){
|
|
|
|
|
_status.friend.push(buttons[i].link);
|
|
|
|
|
}
|
|
|
|
|
else if(_status.enemy.length<max){
|
|
|
|
|
_status.enemy.push(buttons[i].link);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
_status.friend.splice(max);
|
|
|
|
|
_status.enemy.splice(max);
|
|
|
|
|
dialog.close();
|
|
|
|
|
if(ui.confirm) ui.confirm.close();
|
|
|
|
|
game.resume();
|
2016-01-07 09:29:44 +00:00
|
|
|
|
};
|
|
|
|
|
event.fill=ui.create.control('补全',event.switchToAuto);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
event.custom.replace.button=function(button){
|
|
|
|
|
if(_status.choose_enemy){
|
2015-12-12 08:37:15 +00:00
|
|
|
|
if(button.classList.contains('glow')||button.classList.contains('selectedx')||_status.choosefinished) return;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
_status.choose_enemy=false;
|
|
|
|
|
if(!_status.color){
|
2015-12-12 08:37:15 +00:00
|
|
|
|
button.classList.add('selectedx');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
// button.style.transform='rotate(-3deg)';
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
button.classList.add('glow');
|
|
|
|
|
// button.style.transform='rotate(-3deg)';
|
|
|
|
|
}
|
|
|
|
|
_status.enemy.push(button.link);
|
|
|
|
|
var buttons=_status.event.dialog.buttons.slice(0);
|
|
|
|
|
for(var i=0;i<buttons.length;i++){
|
2015-12-12 08:37:15 +00:00
|
|
|
|
if(buttons[i].classList.contains('glow')||buttons[i].classList.contains('selectedx')){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
buttons.splice(i,1);i--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
2015-12-12 08:37:15 +00:00
|
|
|
|
if(button.classList.contains('glow')||button.classList.contains('selectedx')||_status.choosefinished) return;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
if(_status.color){
|
2015-12-12 08:37:15 +00:00
|
|
|
|
button.classList.add('selectedx');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
// button.style.transform='rotate(-3deg)';
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
button.classList.add('glow');
|
|
|
|
|
// button.style.transform='rotate(-3deg)';
|
|
|
|
|
}
|
|
|
|
|
_status.friend.push(button.link);
|
|
|
|
|
var buttons=_status.event.dialog.buttons.slice(0);
|
|
|
|
|
for(var i=0;i<buttons.length;i++){
|
2015-12-12 08:37:15 +00:00
|
|
|
|
if(buttons[i].classList.contains('glow')||buttons[i].classList.contains('selectedx')){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
buttons.splice(i,1);i--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(lib.storage.assign_enemy){
|
|
|
|
|
_status.choose_enemy=true;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
var button2=buttons[Math.floor(Math.random()*buttons.length)];
|
|
|
|
|
if(_status.color){
|
|
|
|
|
button2.classList.add('glow');
|
|
|
|
|
// button2.style.transform='rotate(-3deg)';
|
|
|
|
|
}
|
|
|
|
|
else{
|
2015-12-12 08:37:15 +00:00
|
|
|
|
button2.classList.add('selectedx');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
// button2.style.transform='rotate(-3deg)';
|
|
|
|
|
}
|
|
|
|
|
_status.enemy.push(button2.link);
|
|
|
|
|
_status.event.dialog.content.firstChild.innerHTML='对方选择了'+get.translation(button2.link);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
event.custom.add.window=function(){
|
|
|
|
|
var dialog=_status.event.dialog;
|
|
|
|
|
if(_status.friend.length==_status.enemy.length&&_status.friend.length>=dialog.versus_number.link+dialog.replace_number.link){
|
|
|
|
|
event.fill.firstChild.innerHTML='开始';
|
|
|
|
|
_status.choosefinished=true;
|
|
|
|
|
}
|
|
|
|
|
game.save('zhu',dialog.versus_zhu.link);
|
|
|
|
|
if(lib.storage.zhu){
|
2015-11-13 01:43:16 +00:00
|
|
|
|
// dialog.versus_only_zhu.parentNode.classList.remove('disabled');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
dialog.versus_main_zhu.parentNode.classList.remove('disabled');
|
|
|
|
|
}
|
|
|
|
|
else{
|
2015-11-13 01:43:16 +00:00
|
|
|
|
// dialog.versus_only_zhu.parentNode.classList.add('disabled');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
dialog.versus_main_zhu.parentNode.classList.add('disabled');
|
|
|
|
|
}
|
2015-11-13 01:43:16 +00:00
|
|
|
|
// game.save('only_zhu',dialog.versus_only_zhu.link);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
game.save('main_zhu',dialog.versus_main_zhu.link);
|
|
|
|
|
game.save('assign_enemy',dialog.versus_assign_enemy.link);
|
2015-11-18 03:39:14 +00:00
|
|
|
|
game.save('seat_order',dialog.versus_seat_order.link);
|
|
|
|
|
// game.save('cross_seat',dialog.versus_cross_seat.link);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
game.save('noreplace_end',dialog.versus_noreplace_end.link);
|
|
|
|
|
game.save('single_control',dialog.versus_single_control.link);
|
2015-11-18 03:39:14 +00:00
|
|
|
|
// if(lib.storage.cross_seat){
|
|
|
|
|
// dialog.versus_random_seat.parentNode.classList.add('disabled');
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// dialog.versus_random_seat.parentNode.classList.remove('disabled');
|
|
|
|
|
// if(lib.storage.random_seat){
|
|
|
|
|
// dialog.versus_cross_seat.parentNode.classList.add('disabled');
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// dialog.versus_cross_seat.parentNode.classList.remove('disabled');
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
switch(lib.storage.seat_order){
|
|
|
|
|
case '交叉':lib.storage.cross_seat=true;lib.storage.random_seat=false;break;
|
|
|
|
|
case '随机':lib.storage.cross_seat=false;lib.storage.random_seat=true;break;
|
|
|
|
|
default:lib.storage.cross_seat=false;lib.storage.random_seat=false;
|
2015-11-13 01:43:16 +00:00
|
|
|
|
}
|
2015-11-23 10:59:44 +00:00
|
|
|
|
// if(lib.storage.single_control){
|
|
|
|
|
// dialog.versus_control_all.parentNode.classList.remove('disabled');
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// dialog.versus_control_all.parentNode.classList.add('disabled');
|
|
|
|
|
// }
|
|
|
|
|
// game.save('control_all',dialog.versus_control_all.link);
|
2016-01-12 13:18:47 +00:00
|
|
|
|
game.saveConfig('first_less',dialog.versus_first_less.link,true);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
game.save('number',dialog.versus_number.link);
|
2015-11-18 03:39:14 +00:00
|
|
|
|
game.save('versus_reward',dialog.versus_reward.link);
|
2015-11-23 10:59:44 +00:00
|
|
|
|
game.save('versus_punish',dialog.versus_punish.link);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
game.save('replace_number',dialog.replace_number.link);
|
|
|
|
|
game.save('choice',dialog.choice.link);
|
|
|
|
|
var count,i;
|
|
|
|
|
if(dialog.buttons.length>lib.storage.choice){
|
|
|
|
|
count=dialog.buttons.length-lib.storage.choice;
|
|
|
|
|
var removed=[];
|
|
|
|
|
for(i=dialog.buttons.length-1;i>=0&&count>0;i--){
|
|
|
|
|
if(dialog.buttons[i].classList.contains('target')==false&&
|
|
|
|
|
dialog.buttons[i].classList.contains('glow')==false){
|
|
|
|
|
dialog.buttons[i].remove();
|
|
|
|
|
_status.list.remove(dialog.buttons[i].link);
|
|
|
|
|
removed.push(dialog.buttons[i].link)
|
|
|
|
|
dialog.buttons.splice(i,1);
|
|
|
|
|
count--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<removed.length;i++) _status.list.splice(lib.storage.choice,0,removed[i]);
|
|
|
|
|
}
|
|
|
|
|
else if(dialog.buttons.length<lib.storage.choice||lib.storage.choice=='∞'){
|
|
|
|
|
var list=_status.list;
|
|
|
|
|
var choice=(lib.storage.choice=='∞')?list.length:lib.storage.choice;
|
|
|
|
|
var buttons=dialog.querySelector('.buttons');
|
|
|
|
|
var button;
|
|
|
|
|
for(i=dialog.buttons.length;i<choice;i++){
|
|
|
|
|
button=ui.create.button(list[i],'character',buttons).animate('zoom')
|
|
|
|
|
dialog.buttons.push(button);
|
|
|
|
|
button.style.opacity=1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
game.pause();
|
|
|
|
|
"step 1"
|
2016-01-28 06:46:42 +00:00
|
|
|
|
_status.friendBackup=_status.friend.slice(0);
|
|
|
|
|
_status.enemyBackup=_status.enemy.slice(0);
|
|
|
|
|
|
2015-04-29 03:25:17 +00:00
|
|
|
|
_status.friendDied=[];
|
|
|
|
|
_status.enemyDied=[];
|
2015-12-15 05:13:47 +00:00
|
|
|
|
_status.totalCount=_status.friend.length;
|
|
|
|
|
_status.coinCoeff=get.coinCoeff(_status.friend);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
|
2016-01-07 09:29:44 +00:00
|
|
|
|
// ui.auto.show();
|
2015-04-29 03:25:17 +00:00
|
|
|
|
ui.wuxie.show();
|
2015-05-12 09:51:40 +00:00
|
|
|
|
ui.control.style.display='none';
|
2015-06-14 05:07:39 +00:00
|
|
|
|
setTimeout(function(){
|
|
|
|
|
ui.control.style.top='';
|
|
|
|
|
ui.control.style.display='';
|
|
|
|
|
ui.control.style.transition='';
|
|
|
|
|
},500);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
if(ui.cheat){
|
|
|
|
|
ui.cheat.close();
|
|
|
|
|
delete ui.cheat;
|
|
|
|
|
}
|
|
|
|
|
delete _status.list;
|
|
|
|
|
var num=lib.storage.number;
|
|
|
|
|
ui.create.players(num*2);
|
2015-10-08 06:16:37 +00:00
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
2015-11-06 10:05:08 +00:00
|
|
|
|
game.players[i].node.action.innerHTML='行动';
|
2015-10-08 06:16:37 +00:00
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
if(lib.storage.single_control&&lib.storage.control_all&&game.players.length>=4){
|
|
|
|
|
ui.arena.dataset.number=parseInt(ui.arena.dataset.number)+1;
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
game.players[i].dataset.position=parseInt(game.players[i].dataset.position)+1;
|
|
|
|
|
}
|
2015-10-08 06:16:37 +00:00
|
|
|
|
game.singleHandcard=true;
|
|
|
|
|
ui.arena.classList.add('single-handcard');
|
2015-12-01 05:46:28 +00:00
|
|
|
|
ui.fakeme=ui.create.div('.fakeme.avatar');
|
|
|
|
|
// ui.fakeme.line=lib.element.player.line;
|
|
|
|
|
// ui.fakemebg=ui.create.div('.avatar',ui.fakeme).hide();
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
ui.create.me();
|
2015-12-01 05:46:28 +00:00
|
|
|
|
if(ui.fakeme){
|
|
|
|
|
ui.me.appendChild(ui.fakeme);
|
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
var position,i;
|
|
|
|
|
if(lib.storage.zhu&&lib.storage.only_zhu) position=Math.ceil(num/2)-1;
|
|
|
|
|
else position=Math.floor(Math.random()*num)
|
|
|
|
|
game.friend=[];
|
|
|
|
|
game.enemy=[];
|
|
|
|
|
if(lib.storage.random_seat){
|
|
|
|
|
var players=game.players.slice(0);
|
|
|
|
|
game.friend.push(game.me);
|
|
|
|
|
players.remove(game.me);
|
|
|
|
|
for(i=0;i<num-1;i++){
|
|
|
|
|
game.friend.push(players.randomRemove());
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<num;i++){
|
|
|
|
|
game.enemy.push(players.randomRemove());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
2015-05-01 13:51:00 +00:00
|
|
|
|
for(var i in lib.skill){
|
|
|
|
|
if(lib.skill[i].changeSeat){
|
|
|
|
|
lib.skill[i]={};
|
|
|
|
|
if(lib.translate[i+'_info']){
|
|
|
|
|
lib.translate[i+'_info']='固定位置时不可用';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-11-13 01:43:16 +00:00
|
|
|
|
if(lib.storage.cross_seat){
|
|
|
|
|
for(i=0;i<game.players.length;i++){
|
|
|
|
|
if(i%2==0){
|
|
|
|
|
game.friend.push(game.players[i]);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.enemy.push(game.players[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
2015-11-13 01:43:16 +00:00
|
|
|
|
else{
|
|
|
|
|
for(i=0;i<position;i++){
|
|
|
|
|
game.friend.push(game.players[i-position+num*2]);
|
|
|
|
|
}
|
|
|
|
|
for(i=position;i<num;i++){
|
|
|
|
|
game.friend.push(game.players[i-position]);
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<num;i++){
|
|
|
|
|
game.enemy.push(game.players[num-position+i]);
|
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(((position==Math.ceil(num/2)-1&&lib.storage.zhu)||(lib.storage.zhu&&lib.storage.single_control))){
|
|
|
|
|
var dialog=ui.create.dialog('按顺序选择出场角色',[_status.friend,'character']);
|
|
|
|
|
game.me.chooseButton(dialog,num,true);
|
|
|
|
|
}
|
|
|
|
|
if(lib.storage.random_seat&&lib.storage.zhu){
|
|
|
|
|
if(lib.storage.only_zhu){
|
|
|
|
|
game.friendZhu=game.me;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.friendZhu=game.friend.randomGet();
|
|
|
|
|
}
|
|
|
|
|
game.enemyZhu=game.enemy.randomGet();
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<num;i++){
|
|
|
|
|
game.friend[i].side=_status.color;
|
|
|
|
|
game.enemy[i].side=!_status.color;
|
|
|
|
|
if(lib.storage.random_seat&&lib.storage.zhu){
|
|
|
|
|
if(game.friendZhu==game.friend[i]){
|
|
|
|
|
game.friend[i].identity='zhu';
|
|
|
|
|
game.friend[i].setIdentity(_status.color+'Zhu');
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.friend[i].identity='zhong';
|
|
|
|
|
game.friend[i].setIdentity(_status.color+'Zhong');
|
|
|
|
|
}
|
|
|
|
|
if(game.enemyZhu==game.enemy[i]){
|
|
|
|
|
game.enemy[i].identity='zhu';
|
|
|
|
|
game.enemy[i].setIdentity(!_status.color+'Zhu');
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.enemy[i].identity='zhong';
|
|
|
|
|
game.enemy[i].setIdentity(!_status.color+'Zhong');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
2015-11-13 01:43:16 +00:00
|
|
|
|
if(game.me==game.friend[i]&&lib.storage.zhu){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
game.friend[i].identity='zhu';
|
|
|
|
|
game.friend[i].setIdentity(_status.color+'Zhu');
|
|
|
|
|
game.friendZhu=game.friend[i];
|
2015-11-13 01:43:16 +00:00
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.friend[i].identity='zhong';
|
|
|
|
|
game.friend[i].setIdentity(_status.color+'Zhong');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if(lib.storage.zhu&&get.distance(game.enemy[i],game.me,'pure')==num){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
game.enemy[i].identity='zhu';
|
|
|
|
|
game.enemy[i].setIdentity(!_status.color+'Zhu');
|
|
|
|
|
game.enemyZhu=game.enemy[i];
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.enemy[i].identity='zhong';
|
|
|
|
|
game.enemy[i].setIdentity(!_status.color+'Zhong');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.friend[i].node.identity.dataset.color=get.translation(_status.color+'Color');
|
|
|
|
|
game.enemy[i].node.identity.dataset.color=get.translation(!_status.color+'Color');
|
|
|
|
|
// game.friend[i].node.identity.style.backgroundColor=get.translation(_status.color+'Color');
|
|
|
|
|
// game.enemy[i].node.identity.style.backgroundColor=get.translation(!_status.color+'Color');
|
|
|
|
|
}
|
2015-11-14 05:29:22 +00:00
|
|
|
|
if(lib.storage.zhu&&!game.enemyZhu){
|
|
|
|
|
game.enemy[0].identity='zhu';
|
|
|
|
|
game.enemy[0].setIdentity(!_status.color+'Zhu');
|
|
|
|
|
game.enemyZhu=game.enemy[0];
|
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
"step 2"
|
|
|
|
|
var num=lib.storage.number;
|
|
|
|
|
if(result&&result.buttons){
|
|
|
|
|
var list=[];
|
|
|
|
|
for(i=0;i<result.buttons.length;i++){
|
|
|
|
|
list.push(result.buttons[i].link);
|
|
|
|
|
_status.friend.remove(result.buttons[i].link);
|
|
|
|
|
}
|
|
|
|
|
_status.friend=list.concat(_status.friend);
|
|
|
|
|
}
|
|
|
|
|
for(i=0;i<num;i++){
|
|
|
|
|
game.friend[i].init(_status.friend[i]);
|
|
|
|
|
game.enemy[i].init(_status.enemy[i]);
|
|
|
|
|
|
|
|
|
|
game.friend[i].node.identity.dataset.color=get.translation(_status.color+'Color');
|
|
|
|
|
game.enemy[i].node.identity.dataset.color=get.translation(!_status.color+'Color');
|
|
|
|
|
}
|
|
|
|
|
if(lib.storage.zhu&&lib.storage.main_zhu){
|
|
|
|
|
game.friendZhu.maxHp++;
|
|
|
|
|
game.friendZhu.hp++;
|
|
|
|
|
game.friendZhu.update();
|
|
|
|
|
|
|
|
|
|
game.enemyZhu.maxHp++;
|
|
|
|
|
game.enemyZhu.hp++;
|
|
|
|
|
game.enemyZhu.update();
|
|
|
|
|
}
|
|
|
|
|
_status.friend.splice(0,num);
|
|
|
|
|
_status.enemy.splice(0,num);
|
2015-11-04 01:59:00 +00:00
|
|
|
|
if(lib.storage.single_control&&lib.storage.control_all&&game.players.length>=4){
|
2015-12-01 05:46:28 +00:00
|
|
|
|
// ui.fakemebg.show();
|
2015-04-29 03:25:17 +00:00
|
|
|
|
game.onSwapControl();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
versusPhaseLoop:function(player){
|
|
|
|
|
var next=game.createEvent('phaseLoop');
|
|
|
|
|
next.player=player;
|
|
|
|
|
next.content=function(){
|
|
|
|
|
"step 0"
|
|
|
|
|
if(lib.storage.zhu){
|
|
|
|
|
player.classList.add('acted');
|
|
|
|
|
}
|
|
|
|
|
player.phase();
|
|
|
|
|
"step 1"
|
|
|
|
|
if(lib.storage.zhu){
|
|
|
|
|
_status.currentSide=!_status.currentSide;
|
|
|
|
|
_status.round++;
|
|
|
|
|
if(_status.round>=2*Math.max(game.friend.length,game.enemy.length)){
|
|
|
|
|
_status.round=0;
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
game.players[i].classList.remove('acted');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var list=(_status.currentSide==game.me.side)?game.friend.slice(0):game.enemy.slice(0);
|
|
|
|
|
for(var i=0;i<list.length;i++){
|
|
|
|
|
if(list[i].classList.contains('acted')){
|
|
|
|
|
list.splice(i,1);i--;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(list.length==0) event.redo();
|
|
|
|
|
else if(list.length==1||(game.me!=game.friendZhu&&!lib.storage.single_control)||_status.currentSide!=game.me.side){
|
|
|
|
|
list.sort(function(a,b){
|
|
|
|
|
if(a.num('j')>b.num('j')) return 1;
|
|
|
|
|
return a.hp-b.hp;
|
|
|
|
|
})
|
|
|
|
|
event.player=list[0];
|
|
|
|
|
event.goto(0);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.me.chooseTarget('选择要行动的角色',true,function(card,player,target){
|
|
|
|
|
return (target.classList.contains('acted')==false&&target.side==game.me.side);
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
event.player=event.player.next;
|
|
|
|
|
event.goto(0);
|
|
|
|
|
}
|
|
|
|
|
"step 2"
|
|
|
|
|
event.player=result.targets[0];
|
|
|
|
|
event.goto(0);
|
|
|
|
|
}
|
|
|
|
|
},
|
2016-01-24 08:34:21 +00:00
|
|
|
|
phaseLoopJiange:function(){
|
|
|
|
|
var next=game.createEvent('phaseLoop');
|
|
|
|
|
next.num=0;
|
|
|
|
|
next.content=function(){
|
|
|
|
|
if(event.num>=8){
|
|
|
|
|
event.num-=8;
|
|
|
|
|
}
|
|
|
|
|
var player=_status.actlist[event.num];
|
|
|
|
|
if(player.isAlive()){
|
|
|
|
|
player.phase();
|
|
|
|
|
}
|
|
|
|
|
event.num++;
|
|
|
|
|
event.redo();
|
|
|
|
|
}
|
|
|
|
|
},
|
2015-04-29 03:25:17 +00:00
|
|
|
|
replacePlayer:function(player){
|
|
|
|
|
var next=game.createEvent('replacePlayer');
|
|
|
|
|
next.source=player;
|
|
|
|
|
next.content=function(){
|
|
|
|
|
"step 0"
|
|
|
|
|
var list=(source.side==game.me.side)?_status.friend:_status.enemy;
|
|
|
|
|
if(list.length==0){
|
|
|
|
|
// if(game.friend.contains(source)){
|
|
|
|
|
// game.over(false);
|
|
|
|
|
// }
|
|
|
|
|
// else{
|
|
|
|
|
// game.over(true);
|
|
|
|
|
// }
|
|
|
|
|
game.friend.remove(source);
|
|
|
|
|
game.enemy.remove(source);
|
|
|
|
|
if(game.friend.length==0) game.over(false);
|
|
|
|
|
else if(game.enemy.length==0) game.over(true);
|
|
|
|
|
if(game.friendZhu&&game.friendZhu.classList.contains('dead')&&game.friend.length){
|
|
|
|
|
game.friendZhu=game.friend[0];
|
|
|
|
|
game.friendZhu.setIdentity(_status.color+'Zhu');
|
|
|
|
|
}
|
|
|
|
|
if(game.enemyZhu&&game.enemyZhu.classList.contains('dead')&&game.enemy.length){
|
|
|
|
|
game.enemyZhu=game.enemy[0];
|
|
|
|
|
game.enemyZhu.setIdentity(!_status.color+'Zhu');
|
|
|
|
|
}
|
|
|
|
|
event.finish();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if(source.side==game.me.side&&list.length>1&&(game.me==game.friendZhu||(lib.storage.zhu&&lib.storage.single_control))&&
|
|
|
|
|
!_status.auto){
|
|
|
|
|
event.dialog=ui.create.dialog('选择替补角色',[list,'character']);
|
|
|
|
|
event.filterButton=function(){return true;};
|
|
|
|
|
event.player=game.me;
|
|
|
|
|
event.forced=true;
|
|
|
|
|
event.custom.replace.confirm=function(){
|
|
|
|
|
event.character=ui.selected.buttons[0].link;
|
|
|
|
|
event.dialog.close();
|
|
|
|
|
if(ui.confirm) ui.confirm.close();
|
|
|
|
|
delete event.player;
|
|
|
|
|
game.resume();
|
|
|
|
|
}
|
|
|
|
|
game.check();
|
|
|
|
|
game.pause();
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
event.character=list[Math.floor(Math.random()*list.length)];
|
|
|
|
|
}
|
|
|
|
|
"step 1"
|
|
|
|
|
_status.friend.remove(event.character);
|
|
|
|
|
_status.enemy.remove(event.character);
|
|
|
|
|
source.revive();
|
2015-05-05 14:57:35 +00:00
|
|
|
|
game.additionaldead.push({
|
|
|
|
|
name:source.name,
|
|
|
|
|
stat:source.stat
|
|
|
|
|
});
|
2015-11-04 01:59:00 +00:00
|
|
|
|
game.addVideo('reinit',source,[event.character,get.translation(source.side+'Color')]);
|
2015-05-05 14:57:35 +00:00
|
|
|
|
source.uninit();
|
2015-04-29 03:25:17 +00:00
|
|
|
|
source.init(event.character);
|
|
|
|
|
source.node.identity.dataset.color=get.translation(source.side+'Color');
|
|
|
|
|
source.draw(4);
|
2015-12-12 08:37:15 +00:00
|
|
|
|
_status.event.parent.parent.parent.untrigger(false,source);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
if(lib.storage.single_control&&lib.storage.control_all){
|
|
|
|
|
game.onSwapControl();
|
|
|
|
|
}
|
2015-12-28 07:30:15 +00:00
|
|
|
|
"step 2"
|
|
|
|
|
// if(_status.currentPhase==source){
|
|
|
|
|
// source.skip('phase');
|
|
|
|
|
// }
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
versusClickToSwap:function(e){
|
|
|
|
|
if(_status.dragged) return;
|
|
|
|
|
if(this.link==game.me){
|
|
|
|
|
if(!this.classList.contains('buttonclick')){
|
|
|
|
|
this.animate('buttonclick');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(_status.event.player==game.me&&!_status.auto){
|
|
|
|
|
game.me.popup('请稍后再换人');
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
}
|
|
|
|
|
else{
|
2015-05-01 08:39:13 +00:00
|
|
|
|
game.modeSwapPlayer(this.link);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
versusCheckHandcards:function(){
|
|
|
|
|
_status.clicked=true;
|
|
|
|
|
if(ui.intro){
|
|
|
|
|
ui.intro.close();
|
|
|
|
|
if(ui.intro.source=='versusCheckHandcards'){
|
|
|
|
|
delete ui.intro;
|
|
|
|
|
ui.control.show();
|
|
|
|
|
game.resume2();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.pause2();
|
|
|
|
|
ui.control.hide();
|
|
|
|
|
ui.intro=ui.create.dialog();
|
|
|
|
|
ui.intro.source='versusCheckHandcards';
|
|
|
|
|
|
|
|
|
|
ui.intro.add(ui.autoreplace);
|
|
|
|
|
var players=[];
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(game.players[i].side==game.me.side){
|
|
|
|
|
players.push(game.players[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ui.intro.add(players,true);
|
|
|
|
|
var buttons=ui.intro.querySelectorAll('.button');
|
|
|
|
|
for(var i=0;i<buttons.length;i++){
|
|
|
|
|
buttons[i].addEventListener(lib.config.touchscreen?'touchend':'click',game.versusClickToSwap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(game.players[i].side==game.me.side&&game.players[i]!=game.me){
|
|
|
|
|
ui.intro.add(get.translation(game.players[i]));
|
|
|
|
|
var cards=game.players[i].get('h');
|
|
|
|
|
if(cards.length){
|
|
|
|
|
ui.intro.add(cards,true);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
ui.intro.add('(无)');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2015-05-11 11:57:44 +00:00
|
|
|
|
versusHoverEnemy:function(){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
var uiintro=ui.create.dialog('hidden');
|
|
|
|
|
|
|
|
|
|
if(_status.enemyDied.length){
|
|
|
|
|
uiintro.add('已阵亡');
|
|
|
|
|
uiintro.add([_status.enemyDied,'character']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uiintro.add('未上场');
|
|
|
|
|
if(_status.enemy.length){
|
|
|
|
|
uiintro.add([_status.enemy,'character']);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
uiintro.add('(无)')
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-30 03:09:07 +00:00
|
|
|
|
return uiintro;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
},
|
2015-05-11 11:57:44 +00:00
|
|
|
|
versusHoverFriend:function(){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
var uiintro=ui.create.dialog('hidden');
|
|
|
|
|
|
|
|
|
|
if(_status.friendDied.length){
|
|
|
|
|
uiintro.add('已阵亡');
|
|
|
|
|
uiintro.add([_status.friendDied,'character']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
uiintro.add('未上场');
|
|
|
|
|
if(_status.friend.length){
|
|
|
|
|
uiintro.add([_status.friend,'character']);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
uiintro.add('(无)')
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-30 03:09:07 +00:00
|
|
|
|
return uiintro;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
},
|
2015-05-11 11:57:44 +00:00
|
|
|
|
versusHoverReplace:function(){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
var uiintro=ui.create.dialog('hidden');
|
|
|
|
|
|
|
|
|
|
uiintro.add(ui.autoreplace);
|
|
|
|
|
var players=[];
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(game.players[i].side==game.me.side){
|
|
|
|
|
players.push(game.players[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
uiintro.add(players,true);
|
|
|
|
|
var buttons=uiintro.querySelectorAll('.button');
|
|
|
|
|
for(var i=0;i<buttons.length;i++){
|
|
|
|
|
buttons[i].addEventListener(lib.config.touchscreen?'touchend':'click',game.versusClickToSwap);
|
|
|
|
|
}
|
|
|
|
|
|
2015-04-30 03:09:07 +00:00
|
|
|
|
return uiintro;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
},
|
2015-05-11 11:57:44 +00:00
|
|
|
|
versusHoverHandcards:function(){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
var uiintro=ui.create.dialog('hidden');
|
2015-04-30 03:09:07 +00:00
|
|
|
|
|
2015-04-29 03:25:17 +00:00
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(game.players[i].side==game.me.side&&game.players[i]!=game.me){
|
|
|
|
|
uiintro.add(get.translation(game.players[i]));
|
|
|
|
|
var cards=game.players[i].get('h');
|
|
|
|
|
if(cards.length){
|
2016-01-12 13:18:47 +00:00
|
|
|
|
uiintro.addSmall(cards,true);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
uiintro.add('(无)');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2015-04-30 03:09:07 +00:00
|
|
|
|
|
|
|
|
|
return uiintro;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
},
|
|
|
|
|
versusCheckEnemy:function(){
|
|
|
|
|
_status.clicked=true;
|
|
|
|
|
if(ui.intro){
|
|
|
|
|
ui.intro.close();
|
|
|
|
|
if(ui.intro.source=='versusCheckEnemy'){
|
|
|
|
|
delete ui.intro;
|
|
|
|
|
ui.control.show();
|
|
|
|
|
game.resume2();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.pause2();
|
|
|
|
|
ui.control.hide();
|
|
|
|
|
ui.intro=ui.create.dialog();
|
|
|
|
|
ui.intro.source='versusCheckEnemy';
|
|
|
|
|
|
|
|
|
|
if(_status.enemyDied.length){
|
|
|
|
|
ui.intro.add('已阵亡');
|
|
|
|
|
ui.intro.add([_status.enemyDied,'character']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui.intro.add('未上场');
|
|
|
|
|
if(_status.enemy.length){
|
|
|
|
|
ui.intro.add([_status.enemy,'character']);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
ui.intro.add('(无)')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
versusCheckFriend:function(){
|
|
|
|
|
_status.clicked=true;
|
|
|
|
|
if(ui.intro){
|
|
|
|
|
ui.intro.close();
|
|
|
|
|
if(ui.intro.source=='versusCheckFriend'){
|
|
|
|
|
delete ui.intro;
|
|
|
|
|
ui.control.show();
|
|
|
|
|
game.resume2();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.pause2();
|
|
|
|
|
ui.control.hide();
|
|
|
|
|
ui.intro=ui.create.dialog();
|
|
|
|
|
ui.intro.source='versusCheckFriend';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(_status.friendDied.length){
|
|
|
|
|
ui.intro.add('已阵亡');
|
|
|
|
|
ui.intro.add([_status.friendDied,'character']);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ui.intro.add('未上场');
|
|
|
|
|
if(_status.friend.length){
|
|
|
|
|
ui.intro.add([_status.friend,'character']);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
ui.intro.add('(无)')
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
versusSwapPlayer:function(){
|
|
|
|
|
if(ui.intro){
|
|
|
|
|
ui.intro.close();
|
|
|
|
|
if(ui.intro.source=='versusSwapPlayer'){
|
|
|
|
|
delete ui.intro;
|
|
|
|
|
ui.control.show();
|
|
|
|
|
game.resume2();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if((_status.event.player==game.me&&_status.paused)||_status.paused2){
|
|
|
|
|
game.me.popup('请稍后再换人');
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
_status.clicked=true;
|
|
|
|
|
if(ui.intro){
|
|
|
|
|
ui.intro.close();
|
|
|
|
|
if(ui.intro.source==this.parentNode){
|
|
|
|
|
delete ui.intro;
|
|
|
|
|
ui.control.show();
|
|
|
|
|
game.resume2();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
game.pause2();
|
|
|
|
|
ui.control.hide();
|
|
|
|
|
ui.intro=ui.create.dialog();
|
|
|
|
|
ui.intro.source='versusSwapPlayer';
|
|
|
|
|
var players=[];
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(game.players[i].side==game.me.side&&game.players[i]!=game.me){
|
|
|
|
|
players.push(game.players[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ui.intro.add(players,true);
|
|
|
|
|
var buttons=ui.intro.querySelectorAll('.button');
|
|
|
|
|
for(var i=0;i<buttons.length;i++){
|
|
|
|
|
buttons[i].addEventListener(lib.config.touchscreen?'touchend':'click',game.versusClickToSwap);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
switchAutoreplace:function(e){
|
|
|
|
|
e.stopPropagation();
|
|
|
|
|
this.classList.toggle('on');
|
|
|
|
|
game.save('autoreplaceinnerhtml',this.classList.contains('on'));
|
|
|
|
|
},
|
2015-05-03 15:17:15 +00:00
|
|
|
|
onSwapControl:function(){
|
2015-11-04 01:59:00 +00:00
|
|
|
|
game.addVideo('onSwapControl');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
var name=game.me.name;
|
|
|
|
|
if(ui.fakeme&&ui.fakeme.current!=name){
|
|
|
|
|
ui.fakeme.current=name;
|
|
|
|
|
if(ui.versushighlight&&ui.versushighlight!=game.me){
|
2015-12-01 05:46:28 +00:00
|
|
|
|
ui.versushighlight.classList.remove('current_action');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
ui.versushighlight=game.me;
|
2015-12-01 05:46:28 +00:00
|
|
|
|
game.me.classList.add('current_action');
|
2015-04-29 03:25:17 +00:00
|
|
|
|
|
2015-12-01 05:46:28 +00:00
|
|
|
|
ui.fakeme.style.backgroundImage=game.me.node.avatar.style.backgroundImage;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
},
|
2015-05-01 08:39:13 +00:00
|
|
|
|
modeSwapPlayer:function(player){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
if(lib.storage.control_all){
|
|
|
|
|
game.swapControl(player);
|
2015-05-03 15:17:15 +00:00
|
|
|
|
game.onSwapControl();
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.swapPlayer(player);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
updateLineMe:function(opacity,player){
|
|
|
|
|
if(!player){
|
|
|
|
|
player=game.me;
|
|
|
|
|
}
|
|
|
|
|
ui.lineme.width=ui.window.offsetWidth;
|
|
|
|
|
ui.lineme.height=ui.window.offsetHeight;
|
|
|
|
|
|
|
|
|
|
var ctx=ui.linemectx;
|
|
|
|
|
ctx.shadowBlur=5;
|
|
|
|
|
ctx.shadowColor='rgba(0,0,0,0.3)';
|
|
|
|
|
ctx.fillStyle='white';
|
|
|
|
|
if(typeof opacity!='number'){
|
|
|
|
|
opacity=0.5;
|
|
|
|
|
}
|
|
|
|
|
ctx.strokeStyle='rgba(255,255,255,'+opacity+')';
|
|
|
|
|
ctx.lineWidth=3;
|
|
|
|
|
ctx.setLineDash([8,2]);
|
|
|
|
|
|
|
|
|
|
ctx.beginPath();
|
|
|
|
|
|
|
|
|
|
var startx,endx,pos;
|
|
|
|
|
var endy=game.me.offsetHeight/2+game.me.offsetTop+ui.arena.offsetTop;
|
|
|
|
|
var starty=ui.me.offsetTop+ui.arena.offsetTop+ui.me.offsetHeight/2;
|
|
|
|
|
if(game.me.offsetLeft+game.me.offsetWidth/2<=ui.arena.offsetWidth/2){
|
|
|
|
|
startx=ui.me.offsetLeft+ui.arena.offsetLeft;
|
|
|
|
|
endx=game.me.offsetLeft+ui.arena.offsetLeft;
|
|
|
|
|
pos=-1;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
startx=ui.me.offsetLeft+ui.arena.offsetLeft+ui.me.offsetWidth;
|
|
|
|
|
endx=game.me.offsetWidth+game.me.offsetLeft+ui.arena.offsetLeft;
|
|
|
|
|
pos=1;
|
|
|
|
|
}
|
|
|
|
|
ctx.moveTo(startx,starty);
|
|
|
|
|
startx+=pos*ui.arena.offsetLeft/2;
|
|
|
|
|
ctx.quadraticCurveTo(startx,starty,startx,starty-(starty-endy)/2);
|
|
|
|
|
ctx.quadraticCurveTo(startx,endy,endx,endy);
|
|
|
|
|
ctx.stroke();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
translate:{
|
2016-01-24 08:34:21 +00:00
|
|
|
|
zhu:'主',
|
|
|
|
|
zhong:'忠',
|
2015-04-29 03:25:17 +00:00
|
|
|
|
trueZhu:"帅",
|
|
|
|
|
falseZhu:"将",
|
|
|
|
|
trueZhong:"兵",
|
|
|
|
|
falseZhong:"卒",
|
|
|
|
|
trueColor:"zhu",
|
|
|
|
|
falseColor:"wei",
|
|
|
|
|
versus_zhu_config:'启用主将',
|
|
|
|
|
versus_only_zhu_config:'只当主将',
|
|
|
|
|
versus_main_zhu_config:'主将死亡后结束',
|
|
|
|
|
versus_assign_enemy_config:'指定对手',
|
2015-11-13 01:43:16 +00:00
|
|
|
|
versus_cross_seat_config:'交叉座位',
|
2015-04-29 03:25:17 +00:00
|
|
|
|
versus_random_seat_config:'随机座位',
|
|
|
|
|
versus_noreplace_end_config:'无替补时结束',
|
|
|
|
|
versus_single_control_config:'单人控制',
|
2015-11-18 03:39:14 +00:00
|
|
|
|
seat_order_config:'座位排列',
|
2015-04-29 03:25:17 +00:00
|
|
|
|
versus_control_all_config:'固定控制位置',
|
2015-12-12 08:37:15 +00:00
|
|
|
|
versus_first_less_config:'先手少摸牌',
|
2015-11-18 03:39:14 +00:00
|
|
|
|
versus_reward_config:'杀敌摸牌',
|
2015-11-23 10:59:44 +00:00
|
|
|
|
versus_punish_config:'杀死队友',
|
2015-04-29 03:25:17 +00:00
|
|
|
|
versus_number_config:'对阵人数',
|
|
|
|
|
replace_number_config:'替补人数',
|
|
|
|
|
choice_config:'候选人数'
|
|
|
|
|
},
|
|
|
|
|
skill:{
|
|
|
|
|
versus_swap:{
|
|
|
|
|
trigger:{player:['phaseBegin','chooseToUseBegin','chooseToRespondBegin','chooseToDiscardBegin','chooseToCompareBegin',
|
|
|
|
|
'chooseButtonBegin','chooseCardBegin','chooseTargetBegin','chooseCardTargetBegin','chooseControlBegin',
|
|
|
|
|
'chooseBoolBegin','choosePlayerCardBegin','discardPlayerCardBegin','gainPlayerCardBegin']},
|
|
|
|
|
forced:true,
|
|
|
|
|
priority:100,
|
|
|
|
|
popup:false,
|
|
|
|
|
filter:function(event,player){
|
|
|
|
|
if(event.autochoose&&event.autochoose()) return false;
|
|
|
|
|
return !_status.auto&&player!=game.me&&player.side==game.me.side;
|
|
|
|
|
},
|
|
|
|
|
content:function(){
|
|
|
|
|
"step 0"
|
|
|
|
|
if(ui.autoreplace.innerHTML=='询问切换'){
|
|
|
|
|
game.me.chooseBool('是否切换到'+get.translation(player)+'?')
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(ui.autoreplace.classList.contains('on')){
|
|
|
|
|
if(trigger.name!='phase'){
|
2015-05-01 08:39:13 +00:00
|
|
|
|
game.modeSwapPlayer(player);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
if(ui.dialog){
|
|
|
|
|
ui.dialog.style.display='';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(trigger.name=='phase'){
|
2015-05-01 08:39:13 +00:00
|
|
|
|
game.modeSwapPlayer(player);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
event.finish();
|
|
|
|
|
}
|
|
|
|
|
"step 1"
|
|
|
|
|
if(result.bool){
|
2015-05-01 08:39:13 +00:00
|
|
|
|
game.modeSwapPlayer(player);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
if(ui.dialog){
|
|
|
|
|
ui.dialog.style.display='';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
element:{
|
|
|
|
|
player:{
|
|
|
|
|
dieSpeak:function(){
|
2016-02-14 09:04:31 +00:00
|
|
|
|
// switch(this.identity){
|
|
|
|
|
// case 'zhu': this.popup('吾降矣',2000);break;
|
|
|
|
|
// case 'zhong': this.popup('呃啊',2000);break;
|
|
|
|
|
// }
|
2015-04-29 03:25:17 +00:00
|
|
|
|
},
|
|
|
|
|
dieAfter:function(source){
|
2016-01-24 08:34:21 +00:00
|
|
|
|
if(_status.mode=='four'){
|
|
|
|
|
if(this.identity=='zhu'){
|
|
|
|
|
game.over(this.side!=game.me.side);
|
|
|
|
|
}
|
|
|
|
|
else if(source){
|
|
|
|
|
if(source.side==this.side){
|
|
|
|
|
if(source.identity=='zhu'){
|
|
|
|
|
source.discard(source.get('he'));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
var num1=0,num2=1;
|
|
|
|
|
for(var i=0;i<game.players.length;i++){
|
|
|
|
|
if(game.players[i].side==source.side){
|
|
|
|
|
num1++;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
num2++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
source.draw(2+Math.max(0,num2-num1));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else if(_status.mode=='jiange'){
|
|
|
|
|
if(get.population('wei')==0){
|
|
|
|
|
game.over(game.me.identity=='shu');
|
|
|
|
|
}
|
|
|
|
|
else if(get.population('shu')==0){
|
|
|
|
|
game.over(game.me.identity=='wei');
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
this.dieSpeak();
|
|
|
|
|
if(this.side==game.me.side){
|
|
|
|
|
_status.friendDied.push(this.name);
|
2016-01-12 13:18:47 +00:00
|
|
|
|
_status.friendCount.innerHTML='阵亡: '+get.cnNumber(_status.friendDied.length,true);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
_status.enemyDied.push(this.name);
|
2016-01-12 13:18:47 +00:00
|
|
|
|
_status.enemyCount.innerHTML='杀敌: '+get.cnNumber(_status.enemyDied.length,true);
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var list=(this.side==game.me.side)?_status.friend:_status.enemy;
|
|
|
|
|
if((list.length==0&&lib.storage.noreplace_end)||
|
2015-11-13 01:43:16 +00:00
|
|
|
|
(lib.storage.zhu&&lib.storage.main_zhu&&this.identity=='zhu'&&game.players.length>2)){
|
2015-04-29 03:25:17 +00:00
|
|
|
|
if(game.friend.contains(this)){
|
|
|
|
|
game.over(false);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.over(true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if(game.friend.length==1&&this==game.friend[0]&&_status.friend.length==0){
|
|
|
|
|
game.over(false);
|
|
|
|
|
}
|
|
|
|
|
else if(game.enemy.length==1&&this==game.enemy[0]&&_status.enemy.length==0){
|
|
|
|
|
game.over(true);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
if(source){
|
|
|
|
|
if(source.side!=this.side){
|
2015-11-23 10:59:44 +00:00
|
|
|
|
if(lib.storage.versus_reward){
|
|
|
|
|
source.draw(lib.storage.versus_reward);
|
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
else{
|
2015-11-23 10:59:44 +00:00
|
|
|
|
if(lib.storage.versus_punish=='弃牌'){
|
|
|
|
|
source.discard(source.get('he'));
|
|
|
|
|
}
|
|
|
|
|
else if(lib.storage.versus_punish=='摸牌'&&lib.storage.versus_reward){
|
|
|
|
|
source.draw(lib.storage.versus_reward);
|
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
game.delay();
|
|
|
|
|
}
|
|
|
|
|
game.replacePlayer(this);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
ai:{
|
|
|
|
|
get:{
|
|
|
|
|
attitude:function(from,to){
|
|
|
|
|
if(from.side==to.side){
|
2016-01-24 08:34:21 +00:00
|
|
|
|
if(to.identity=='zhu'&&(lib.storage.main_zhu||_status.mode=='four')) return 10;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
return 6;
|
|
|
|
|
}
|
2016-01-24 08:34:21 +00:00
|
|
|
|
if(to.identity=='zhu'&&(lib.storage.main_zhu||_status.mode=='four')) return -10;
|
2015-04-29 03:25:17 +00:00
|
|
|
|
return -6;
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
2016-03-27 06:50:39 +00:00
|
|
|
|
help:{
|
|
|
|
|
'对决模式':'<div style="margin:10px">4v4</div><ul style="margin-top:0"><li>双方各有一名主公和三名忠臣,杀死对方主公获胜<li>'+
|
|
|
|
|
'8号位游戏开始时额外摸一张牌,7、8号位可在游戏开始时置换一次手牌<li>'+
|
|
|
|
|
'杀死对方忠臣摸2+x张牌,x为对方(含刚被杀的忠臣)与己方的存活人数之差;主公杀死己方忠臣须弃置所有牌',
|
|
|
|
|
}
|
2015-04-29 03:25:17 +00:00
|
|
|
|
}
|