'use strict'; mode.brawl={ start:function(){ if(!lib.storage.scene){ lib.storage.scene={}; } var dialog=ui.create.dialog('hidden'); dialog.classList.add('fixed'); dialog.classList.add('scroll1'); dialog.classList.add('scroll2'); dialog.classList.add('fullwidth'); dialog.classList.add('fullheight'); dialog.classList.add('noupdate'); dialog.classList.add('character'); dialog.contentContainer.style.overflow='visible'; dialog.style.overflow='hidden'; dialog.content.style.height='100%'; dialog.contentContainer.style.transition='all 0s'; dialog.open(); var packnode=ui.create.div('.packnode',dialog); lib.setScroll(packnode); var clickCapt=function(){ var active=this.parentNode.querySelector('.active'); if(active){ if(active==this) return; for(var i=0;i'+active.nodes[1].innerHTML+''); var ul=uiintro.querySelector('ul'); if(ul){ ul.style.width='180px'; } uiintro.add(ui.create.div('.placeholder')); return uiintro; },250); _status.brawl=info.content; game.switchMode(info.mode); if(info.init){ info.init(); } } }); start.style.position='absolute'; start.style.left='auto'; start.style.right='10px'; start.style.top='auto'; start.style.bottom='10px'; start.style.width='80px'; start.style.height='80px'; start.style.lineHeight='80px'; start.style.margin='0'; start.style.padding='5px'; start.style.fontSize='72px'; start.style.zIndex=3; start.style.transition='all 0s'; game.addScene=function(name,clear){ var scene=lib.storage.scene[name]; var brawl={ name:name, intro:scene.intro, mode:'identity', }; for(var i in lib.brawl.scene.template){ brawl[i]=get.copy(lib.brawl.scene.template[i]); } if(!scene.gameDraw){ brawl.content.noGameDraw=true; } brawl.content.scene=scene; lib.brawl['scene_'+name]=brawl; var node=createNode('scene_'+name); if(clear) game.addSceneClear(); clickCapt.call(node); }; game.removeScene=function(name){ delete lib.storage.scene[name]; game.save('scene',lib.storage.scene); for(var i=0;i7){ setTimeout(function(){ while(node.nodes.length>5){ node.nodes.shift().delete(); } },500); } }; if(init){ node.nodes=[]; for(var i=0;i<5;i++){ func(); } } node.showcaseinterval=setInterval(func,1000); }, content:{ cardPile:function(list){ var num=Math.ceil(list.length/10); while(num--){ list.push([['heart','diamond','club','spade'].randomGet(),Math.ceil(Math.random()*13),'du']); } return list; } }, }, daozhiyueying:{ name:'导师月英', mode:'identity', intro:'牌堆中所有非延时锦囊牌数量翻倍;移除拥有集智技能的角色', showcase:function(init){ var node=this; var player1,player2; if(init){ player1=ui.create.player(null,true).init('huangyueying'); player2=ui.create.player(null,true).init('re_huangyueying'); player1.style.left='20px'; player1.style.top='20px'; player1.style.transform='scale(0.9)'; player1.node.count.innerHTML='2'; player1.node.count.dataset.condition='mid'; player2.style.left='auto'; player2.style.right='20px'; player2.style.top='20px'; player2.style.transform='scale(0.9)'; player2.node.count.innerHTML='2'; player2.node.count.dataset.condition='mid'; this.appendChild(player1); this.appendChild(player2); this.player1=player1; this.player2=player2; } else{ player1=this.player1; player2=this.player2; } var rect1=player1.getBoundingClientRect(); var rect2=player2.getBoundingClientRect(); var left1=rect1.left+rect1.width/2-ui.arena.offsetLeft; var left2=rect2.left+rect2.width/2-ui.arena.offsetLeft; var top1=rect1.top+rect1.height/2-ui.arena.offsetTop; var top2=rect2.top+rect2.height/2-ui.arena.offsetTop; var createCard=function(wuxie){ var card; if(wuxie){ card=game.createCard('wuxie','noclick'); card.style.transform='scale(0.9)'; } else{ card=ui.create.card(null,'noclick',true); } card.style.opacity=0; card.style.position='absolute'; card.style.zIndex=2; card.style.margin=0; return card; } var func=function(){ game.linexy([left1,top1,left2,top2]); var card=createCard(true); card.style.left='43px'; card.style.top='58px'; node.appendChild(card); ui.refresh(card); card.style.opacity=1; card.style.transform='scale(0.9) translate(137px,152px)'; setTimeout(function(){ card.delete(); },1000); player1.node.count.innerHTML='1'; setTimeout(function(){ if(!node.showcaseinterval) return; player1.node.count.innerHTML='2'; var card=createCard(); card.style.left='43px'; card.style.top='58px'; card.style.transform='scale(0.9) translate(137px,152px)'; node.appendChild(card); ui.refresh(card); card.style.opacity=1; card.style.transform='scale(0.9)'; setTimeout(function(){ card.delete(); },1000); },300); setTimeout(function(){ if(!node.showcaseinterval) return; player2.node.count.innerHTML='1'; game.linexy([left2,top2,left1,top1]); var card=createCard(true); card.style.left='auto'; card.style.right='43px'; card.style.top='58px'; node.appendChild(card); ui.refresh(card); card.style.opacity=1; card.style.transform='scale(0.9) translate(-137px,152px)'; setTimeout(function(){ card.delete(); },700); setTimeout(function(){ if(!node.showcaseinterval) return; player2.node.count.innerHTML='2'; var card=createCard(); card.style.left='auto'; card.style.right='43px'; card.style.top='58px'; card.style.transform='scale(0.9) translate(-137px,152px)'; node.appendChild(card); ui.refresh(card); card.style.opacity=1; card.style.transform='scale(0.9)'; setTimeout(function(){ card.delete(); },700); },300); },1000); }; node.showcaseinterval=setInterval(func,2200); func(); }, init:function(){ for(var i in lib.character){ var skills=lib.character[i][3] if(skills.contains('jizhi')||skills.contains('rejizhi')||skills.contains('lingzhou')){ delete lib.character[i]; } } }, content:{ cardPile:function(list){ var list2=[]; for(var i=0;i=5){ num=0; } var card=game.createCard('sha','noclick'); card.style.left='calc(50% - 52px)'; card.style.top='68px'; card.style.position='absolute'; card.style.margin=0; card.style.zIndex=2; card.style.opacity=0; node.appendChild(card); ui.refresh(card); card.style.opacity=1; card.style.transform='translate('+dx+'px,'+dy+'px)'; setTimeout(function(){ card.delete(); },700); },700); }, init:function(){ lib.skill.weiwoduzun={ mark:true, intro:{ content:'杀造成的伤害+1' }, group:['weiwoduzun_damage','weiwoduzun_lose'], subSkill:{ damage:{ trigger:{source:'damageBegin'}, forced:true, filter:function(event){ return event.card&&event.card.name=='sha'&&event.notLink(); }, content:function(){ trigger.num++; } }, lose:{ trigger:{player:'damageEnd'}, forced:true, filter:function(event){ return event.source&&event.source.isAlive(); }, content:function(){ player.removeSkill('weiwoduzun'); trigger.source.addSkill('weiwoduzun'); } } } }; lib.translate.weiwoduzun='战神'; lib.translate.weiwoduzun_bg='尊'; }, content:{ cardPile:function(list){ var num=0; for(var i=0;i4){ setTimeout(function(){ while(node.nodes.length>3){ node.nodes.shift().delete(); } },500); } }; node.list=[]; if(init){ node.nodes=[]; for(var i=0;i<3;i++){ func(); } } node.showcaseinterval=setInterval(func,1000); }, init:function(){ var map={}; var map3=[]; var list1=['司','夏','诸']; var list2=['马','侯','葛']; var exclude=['界','新','大']; for(var i in lib.character){ if(lib.filter.characterDisabled(i)) continue; var surname=lib.translate[i]; for(var j=0;j7){ nodes[i].index=0; } setPos(nodes[i]); } },1000); }, content:{ gameStart:function(){ var target=(_status.mode=='zhong')?game.zhong:game.zhu; if(get.config('double_character')){ target.init(game.me.name,game.me.name2); } else{ target.init(game.me.name); } target.hp++; target.maxHp++; target.update(); }, chooseCharacterAi:function(player,list,list2,back){ if(player==game.zhu){ return; } else{ if(get.config('double_character')){ player.init(game.me.name,game.me.name2); } else{ player.init(game.me.name); } } }, chooseCharacter:function(list,list2,num){ if(game.me!=game.zhu){ return list.slice(0,list2); } else{ if(_status.event.zhongmode){ return list.slice(0,6); } else{ return list.concat(list2.slice(0,num)); } } } } }, // baiyudujiang:{ // name:'白衣渡江', // mode:'versus', // submode:'2v2', // intro:[ // '玩家在选将时可从6-8张的武将牌里选择两张武将牌,一张面向大家可见(加入游戏),另一张是隐藏面孔(暗置)', // '选择的两张武将牌需满足以下至少两个条件:1.性别相同;2.体力上限相同;3.技能数量相同', // '每名玩家在其回合开始或回合结束时,可以选择将自己的武将牌弃置,然后使用暗置的武将牌进行剩余的游戏' // ], // content:{ // submode:'two', // chooseCharacterNum:2, // chooseCharacterAfter:function(){ // // } // } // } scene:{ name:'创建场景', mode:'identity', intro:'
场景名称:
场景说明:
', content:{ submode:'normal' }, nostart:true, fullshow:true, template:{ init:function(){ game.saveConfig('double_character',false,'identity'); _status.brawl.playerNumber=_status.brawl.scene.players.length; }, showcase:function(init){ if(init){ var name=lib.brawl[this.link].name; var scene=lib.storage.scene[name]; ui.create.node('button','编辑场景',this,function(){ _status.sceneToLoad=scene; game.switchScene(); }); ui.create.node('button','删除场景',this,function(){ if(confirm('确定删除'+name+'?')){ game.removeScene(name); } },{marginLeft:'6px'}); ui.create.node('button','导出扩展',this,function(){ var str='{name:"'+name+'",content:function(){\nif(lib.config.mode=="brawl"){\n'+ 'if(!lib.storage.scene) lib.storage.scene={};\n'+ 'if(!lib.storage.scene["'+name+'"]) lib.storage.scene["'+name+'"]='+get.stringify(scene)+ '\n}}\n}'; var extension={'extension.js':'game.import("extension",'+str+')'}; game.importExtension(extension,null,name); },{marginLeft:'6px'}); } }, content:{ submode:'normal', noAddSetting:true, identityShown:true, orderedPile:true, cardPile:function(list){ list.randomSort(); var scene=_status.brawl.scene; var inpile=[]; for(var i=0;i=0;i--){ list.unshift(parseInfo(scene.cardPileTop[i])); } for(var i=0;igame.players[i].maxHp){ game.players[i].hp=game.players[i].maxHp; } } if(info.hp){ game.players[i].hp=info.hp; if(game.players[i].hp>game.players[i].maxHp){ game.players[i].maxHp=game.players[i].hp; } } game.players[i].update(); } var scene=_status.brawl.scene; var over=function(str){ switch(str){ case 'win':game.over(true);break; case 'lose':game.over(false);break; case 'tie':game.over('平局');break; } } if(scene.turns){ var turns=scene.turns[0]; lib.onphase.push(function(){ turns--; if(turns<0){ over(scene.turns[1]); } }); } if(scene.washes){ var washes=scene.washes[0]; lib.onwash.push(function(){ washes--; if(washes<=0){ over(scene.washes[1]); } }); } }, chooseCharacterBefore:function(){ var scene=_status.brawl.scene; var playercontrol=[]; var maxpos=0; for(var i=0;ibb?1:-1; } return a>b?1:-1; }); list.unshift(['random','自选主将']); var name1=ui.create.selectlist(list,list[0],line2); name1.style.marginLeft='3px'; name1.style.marginRight='3px'; name1.style.maxWidth='80px'; list[0][1]='自选副将'; list.unshift(['none','无副将']); var name2=ui.create.selectlist(list,list[0],line2); name2.style.marginLeft='3px'; name2.style.marginRight='3px'; name2.style.maxWidth='80px'; var capt9=ui.create.div(style2,'','编辑牌堆',this); capt9.style.display='none'; var capt2=ui.create.div(style2,'','添加卡牌',this); var line3=ui.create.div(style2,this); line3.style.display='none'; capt1.style.display='none'; capt2.style.display='none'; var line5=ui.create.div(style2,this); line5.style.display='none'; var pileaddlist=[]; for(var i=0;i替换牌堆'); line11.style.display='none'; var replacepile=ui.create.node('input',line11); replacepile.type='checkbox'; ui.create.node('span',line11,'开局摸牌',{marginLeft:'10px'}); var gameDraw=ui.create.node('input',line11); gameDraw.type='checkbox'; gameDraw.checked=true; var capt_t=ui.create.div(style2,'','牌堆顶',this); var line6_t=ui.create.div(style2,this); var capt_b=ui.create.div(style2,'','牌堆底',this); var line6_b=ui.create.div(style2,this); var capt_d=ui.create.div(style2,'','弃牌堆',this); var line6_d=ui.create.div(style2,this); line6_d.style.marginBottom='10px'; capt_t.style.display='none'; capt_b.style.display='none'; capt_d.style.display='none'; var line4=ui.create.div(style2,this); line4.style.display='none'; line4.style.marginTop='20px'; var resetCharacter=function(){ // line1.style.display='block'; editPile.disabled=false; // editCode.disabled=false; saveButton.disabled=false; // exportButton.disabled=false; line7.style.display='block'; line2.style.display='none'; line2_t.style.display='none'; line3.style.display='none'; line4.style.display='none'; line5.style.display='none'; line6_h.style.display='none'; line6_e.style.display='none'; line6_j.style.display='none'; capt1.style.display='none'; capt2.style.display='none'; capt_h.style.display='none'; capt_e.style.display='none'; capt_j.style.display='none'; name1.value='random'; name2.value='none'; identity.value='fan'; position.value='0'; hp.value=''; maxHp.value=''; line6_h.innerHTML=''; line6_e.innerHTML=''; line6_j.innerHTML=''; cardpileaddname.value='random'; cardpileaddsuit.value='random'; cardpileaddnumber.value='random'; linked.checked=false; turnedover.checked=false; playercontrol.checked=false; }; var createCharacter=function(info){ var player=ui.create.player(null,true); player._customintro=function(uiintro){ if(info.handcards.length){ uiintro.addText('手牌',true); var hs=ui.create.div('.buttons'); for(var i=0;i=8){ addCharacter.disabled=true; } return player; }; ui.create.div('.menubutton.large','确定',line4,style3,function(){ var info={ name:name1.value, name2:name2.value, identity:identity.value, position:parseInt(position.value), hp:parseInt(hp.value), maxHp:parseInt(maxHp.value), linked:linked.checked, turnedover:turnedover.checked, playercontrol:playercontrol.checked, handcards:[], equips:[], judges:[] }; for(var i=0;i=8){ addCharacter.disabled=true; } else{ addCharacter.disabled=false; } // editCode.disabled=false; saveButton.disabled=false; // exportButton.disabled=false; cardpileaddname.value='random'; cardpileaddsuit.value='random'; cardpileaddnumber.value='random'; line8.style.display='none'; capt8.style.display='none'; capt9.style.display='none'; line9.style.display='none'; line10.style.display='none'; line11.style.display='none'; line3.style.display='none'; line7.style.display='block'; line6_t.style.display='none'; line6_b.style.display='none'; line6_d.style.display='none'; capt_t.style.display='none'; capt_b.style.display='none'; capt_d.style.display='none'; if(all===true){ replacepile.checked=false; gameDraw.checked=true; turns.value='1'; turnsresult.value='none'; washes.value='1'; washesresult.value='none'; line6_t.innerHTML=''; line6_b.innerHTML=''; line6_d.innerHTML=''; } } ui.create.div('.menubutton.large','确定',line9,style3,resetStatus); game.addSceneClear=function(){ resetCharacter(); resetStatus(true); scenename.value=''; sceneintro.value=''; line7.innerHTML=''; delete _status.currentScene; }; game.loadScene=function(scene){ resetCharacter(); resetStatus(true); scenename.value=scene.name; sceneintro.value=scene.intro; _status.currentScene=scene.name; line7.innerHTML=''; if(scene.replacepile) replacepile.checked=true; if(scene.gameDraw) gameDraw.checked=true; else gameDraw.checked=false; if(scene.turns){ turns.value=scene.turns[0].toString(); turnsresult.value=scene.turns[1]; } if(scene.washes){ washes.value=scene.washes[0].toString(); washesresult.value=scene.washes[1]; } for(var i=0;i