'use strict'; mode.boss={ element:{ player:{ dieAfter:function(){ if(this!=game.boss){ this.storage.boss_chongzheng=0; } if(this==game.boss||game.players.length==1){ game.checkResult(); } }, } }, game:{ reserveDead:true, checkResult:function(){ if(game.boss==game.me){ game.over(game.boss.isAlive()); } else{ game.over(!game.boss.isAlive()); } }, getVideoName:function(){ var str=get.translation(game.me.name); if(game.me.name2){ str+='/'+get.translation(game.me.name2); } var str2='挑战'; if(game.me!=game.boss){ str2+=' - '+get.translation(game.boss); } var name=[str,str2]; return name; }, start:function(){ var next=game.createEvent('game',false); next.content=function(){ "step 0" if(lib.db&&!_status.characterLoaded){ _status.waitingForCharacters=true; game.pause(); } "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; } for(var i in lib.skill){ if(lib.skill[i].changeSeat){ lib.skill[i]={}; if(lib.translate[i+'_info']){ lib.translate[i+'_info']='此模式下不可用'; } } } lib.init.css('layout/mode','boss'); game.delay(0.1); "step 2" var bosslist=ui.create.div('#bosslist.hidden'); event.bosslist=bosslist; bosslist.ontouchmove = ui.click.touchScroll; bosslist.style.WebkitOverflowScrolling='touch'; if(!lib.config.touchscreen&&lib.config.mousewheel){ bosslist._scrollspeed=30; bosslist._scrollnum=10; bosslist.onmousewheel=ui.click.mousewheel; } var bosslistlinks={}; var toggleBoss=function(bool){ game.saveConfig(this._link.config._name,bool,true); var node=bosslistlinks[this._link.config._name]; if(bool){ node.style.display=''; } else{ node.style.display='none'; } }; var onpause=function(){ ui.window.classList.add('bosspaused'); } var onresume=function(){ ui.window.classList.remove('bosspaused'); } game.onpause=onpause; game.onpause2=onpause; game.onresume=onresume; game.onresume2=onresume; ui.create.div(bosslist); event.current=null; var list=[]; for(var i in lib.character){ var info=lib.character[i]; if(info[4].contains('boss')&&!lib.config.banned.contains(i)){ var cfg=i+'_bossconfig'; if(get.config(cfg)==undefined){ game.saveConfig(cfg,true,true); } lib.translate[cfg+'_config']=lib.translate[i]; lib.config.current_mode.push([cfg,get.config(cfg),toggleBoss]); lib.mode.boss.config[cfg]={ name:get.translation(i), onclick:toggleBoss, init:true, } var player=ui.create.player(bosslist).init(i); list.push(player); player.node.hp.classList.add('text'); player.node.hp.dataset.condition=''; player.node.hp.innerHTML=info[2]; player.setIdentity(player.name); player.node.identity.dataset.color=info[5]; bosslistlinks[cfg]=player; player.classList.add('bossplayer'); if(lib.storage.current==i){ event.current=player; player.classList.add('highlight'); } if(!get.config(cfg)){ player.style.display='none'; } } } if(!event.current){ event.current=bosslist.childNodes[1]; event.current.classList.add('highlight'); } ui.create.div(bosslist); lib.translate.boss_pangtong='涅槃凤雏'; ui.create.cards(); game.finishCards(); ui.arena.dataset.number=8; ui.control.style.transitionProperty='opacity'; ui.control.classList.add('bosslist'); setTimeout(function(){ ui.control.style.transitionProperty=''; },1000); ui.window.appendChild(bosslist); setTimeout(function(){ if(event.current){ var left=event.current.offsetLeft-(ui.window.offsetWidth-180)/2; if(bosslist.scrollLeft0){ td.innerHTML='剩余'+get.cnNumber(game.bossinfo.chongzheng-game.dead[i].storage.boss_chongzheng)+'回合'; } else{ td.innerHTML='无法重整' } } if(!added){ uiintro.add('
(无重整角色)
'); uiintro.add(ui.create.div('.placeholder.slim')) } else{ uiintro.add(table); } return uiintro; },180); ui.arena.appendChild(boss); ui.refresh(boss); boss.classList.remove('highlight'); boss.classList.remove('bossplayer'); boss.style.left=''; boss.style.top=''; boss.style.position=''; event.bosslist.delete(); game.arrangePlayers(); for(var i=0;i0){ if(player.hp0?player.node.handcards1:player.node.handcards2; card.fix(); card.animate('start'); position.insertBefore(card,position.firstChild); player.$draw(); game.log(player,'摸了一张牌'); } player.update(); if(player.storage.boss_chongzheng>=game.bossinfo.chongzheng){ player.revive(player.hp); } } if(game.bossinfo.loopType==2){ game.boss.chongzheng=true; } } else{ player.phase(); } "step 1" if(game.bossinfo.loopType==2){ if(event.player==game.boss){ if(!_status.last||_status.last.nextSeat==game.boss){ event.player=game.boss.nextSeat; } else{ event.player=_status.last.nextSeat; } } else{ _status.last=player; event.player=game.boss; } } else{ event.player=event.player.nextSeat; } event.goto(0); } }, onSwapControl:function(){ if(game.me==game.boss) return; game.addVideo('onSwapControl'); var name=game.me.name; if(ui.fakeme&&ui.fakeme.current!=name){ ui.fakeme.current=name; if(ui.versushighlight&&ui.versushighlight!=game.me){ ui.versushighlight.classList.remove('current_action'); } ui.versushighlight=game.me; game.me.classList.add('current_action'); // game.me.line(ui.fakeme,{opacity:0.5,dashed:true}); ui.fakeme.style.backgroundImage=game.me.node.avatar.style.backgroundImage; // ui.fakeme.style.backgroundSize='cover'; } ui.updatehl(); }, modeSwapPlayer:function(player){ game.swapControl(player); game.onSwapControl(); }, chooseCharacter:function(func){ var next=game.createEvent('chooseCharacter',false); next.showConfig=true; next.customreplacetarget=func; next.ai=function(player,list){ if(get.config('double_character')){ player.init(list[0],list[1]); } else{ player.init(list[0]); } } next.content=function(){ "step 0" var i; var list=[]; event.list=list; for(i in lib.character){ if(lib.character[i][4].contains('minskin')) continue; if(lib.character[i][4].contains('boss')) continue; if(lib.character[i][4].contains('hiddenboss')) 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.forbidboss.contains(i)) continue; if(lib.config.banned.contains(i)) continue; if(get.config('ban_weak')&&lib.config.forbidsingle.contains(i)) continue; 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; list.push(i); } list.randomSort(); var dialog=ui.create.dialog('选择参战角色','hidden'); dialog.classList.add('fixed'); ui.window.appendChild(dialog); dialog.classList.add('bosscharacter'); dialog.add('0/3'); dialog.add([list.slice(0,20),'character']); dialog.noopen=true; var next=game.me.chooseButton(dialog,true); next._triggered=null; next.custom.replace.target=event.customreplacetarget; next.selectButton=[3,3]; next.custom.add.button=function(){ if(ui.cheat2&&ui.cheat2.backup) return; _status.event.dialog.content.childNodes[1].innerHTML= ui.selected.buttons.length+'/3'; }; event.changeDialog=function(){ if(ui.cheat2&&ui.cheat2.dialog==_status.event.dialog){ return; } if(game.changeCoin){ game.changeCoin(-10); } list.randomSort(); _status.event.dialog.close(); _status.event.dialog=ui.create.dialog('选择参战角色','hidden'); ui.window.appendChild(_status.event.dialog); _status.event.dialog.classList.add('bosscharacter'); _status.event.dialog.classList.add('fixed'); _status.event.dialog.add('0/3'); _status.event.dialog.add([list.slice(0,20),'character']); game.uncheck(); game.check(); }; ui.create.cheat=function(){ _status.createControl=ui.cheat2||event.asboss; ui.cheat=ui.create.control('更换',event.changeDialog); delete _status.createControl; }; event.dialogxx=ui.create.characterDialog(); event.dialogxx.classList.add('bosscharacter'); event.dialogxx.classList.add('fixed'); ui.create.cheat2=function(){ _status.createControl=event.asboss; 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; ui.window.appendChild(this.backup); delete this.backup; game.uncheck(); game.check(); if(ui.cheat){ ui.cheat.style.opacity=1; } if(ui.cheat2x){ ui.cheat2x.close(); delete ui.cheat2x; } } else{ if(game.changeCoin){ game.changeCoin(-50); } ui.cheat2x=ui.create.groupControl(_status.event.parent.dialogxx); this.backup=_status.event.dialog; _status.event.dialog.close(); _status.event.dialog=_status.event.parent.dialogxx; this.dialog=_status.event.dialog; ui.window.appendChild(this.dialog); game.uncheck(); game.check(); if(ui.cheat){ ui.cheat.style.opacity=0.6; } } }); delete _status.createControl; } if(!ui.cheat&&get.config('change_choice')) ui.create.cheat(); if(!ui.cheat2&&get.config('free_choose')) ui.create.cheat2(); event.asboss=ui.create.control('应战',function(){ event.boss=true; event.enemy=[]; for(var i=0;i