'use strict'; game.import('mode',function(lib,game,ui,get,ai,_status){ return { name:'doudizhu', start:function(){ "step 0" 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(); } else if(!_status.connectMode){ game.prepareArena(3); } "step 1" event.replacePile=function(){ var map={ shuiyanqijunx:'shuiyanqijuny', bingliang:'binglinchengxia', fangtian:'toushiche', wutiesuolian:'toushiche', }; for(var i=0;i3) num++; if(lib.character[player.name2]&&get.infoHp(lib.character[player.name2][2])>3) num++; } return num; }; } else if(_status.mode=='binglin'){ next.num=function(player){ return (player==game.zhu?5:4); }; } if(_status.mode!='online'&&_status.connectMode&&lib.configOL.change_card) game.replaceHandcards(game.players.slice(0)); game.phaseLoop(game.zhu||_status.firstAct||game.me); game.zhu.showGiveup(); }, game:{ canReplaceViewpoint:()=>true, recommendDizhu:[ 're_guojia','re_huanggai','re_lvbu','re_guanyu','re_sunquan','re_xusheng','re_wuyi','re_sunben', 'xuyou','zhangchunhua','caochong','zhangsong','zhongyao','wangyi', 'caochun','maliang','sp_diaochan','quyi','sp_zhaoyun','shamoke', 'lijue','liuzan','wenyang','shen_lvmeng','shen_ganning', 'jiakui','wangyuanji','lingcao','miheng', 'sp_key_yuri','key_hinata','key_rin','key_kyousuke', 'ns_chendao','jiakui','haozhao', ], addRecord:function(bool){ if(typeof bool=='boolean'){ var data=lib.config.gameRecord.doudizhu.data; var identity=game.me.identity; if(!data[identity]){ data[identity]=[0,0]; } if(bool){ data[identity][0]++; } else{ data[identity][1]++; } var list=['zhu','fan']; var str=''; for(var i=0;i'; } } lib.config.gameRecord.doudizhu.str=str; game.saveConfig('gameRecord',lib.config.gameRecord); } }, getState:function(){ var state={}; for(var i in lib.playerOL){ var player=lib.playerOL[i]; state[i]={identity:player.identity}; } return state; }, updateState:function(state){ for(var i in state){ var player=lib.playerOL[i]; if(player){ player.identity=state[i].identity; } } }, updateRoundNumber:function(){ if(_status.mode=='online'){ game.broadcastAll(function(num1,num2,top,bonusNum){ if(ui.cardPileNumber){ var str=num1+'轮 公共牌堆: '+num2; if(game.me&&game.me.storage.doudizhu_cardPile&&game.me.storage.doudizhu_cardPile.length) str+=(' 个人牌堆: '+game.me.storage.doudizhu_cardPile.length); if(bonusNum) str+=('
本场叫价: '+bonusNum*100); ui.cardPileNumber.innerHTML=str; } _status.pileTop=top; },game.roundNumber,ui.cardPile.childNodes.length,ui.cardPile.firstChild,game.bonusNum); return; } game.broadcastAll(function(num1,num2,top){ if(ui.cardPileNumber) ui.cardPileNumber.innerHTML=num1+'轮 剩余牌: '+num2; _status.pileTop=top; },game.roundNumber,ui.cardPile.childNodes.length,ui.cardPile.firstChild); }, getRoomInfo:function(uiintro){ uiintro.add('
双将模式:'+(lib.configOL.double_character?'开启':'关闭')); // uiintro.add('
屏蔽弱将:'+(lib.configOL.ban_weak?'开启':'关闭')); // var last=uiintro.add('
屏蔽强将:'+(lib.configOL.ban_strong?'开启':'关闭')); if(lib.configOL.banned.length){ uiintro.add('
禁用武将:'+get.translation(lib.configOL.banned)); } if(lib.configOL.bannedcards.length){ uiintro.add('
禁用卡牌:'+get.translation(lib.configOL.bannedcards)); } uiintro.style.paddingBottom='8px'; }, getVideoName:function(){ var str=get.translation(game.me.name); if(game.me.name2){ str+='/'+get.translation(game.me.name2); } var namex; switch(_status.mode){ case 'normal':namex='休闲斗地主';break; case 'kaihei':namex='开黑斗地主';break; case 'huanle':namex='欢乐斗地主';break; case 'binglin':namex='兵临城下';break; case 'online':namex='智斗三国';break; } var name=[ str, namex+' - '+lib.translate[game.me.identity+'2'] ]; return name; }, showIdentity:function(me){ for(var i=0;i1) return; if(me==game.zhu){ game.over(true); } else{ game.over(false); } } else { if(me==game.zhu){ game.over(false); } else{ game.over(true); } } }, checkOnlineResult:function(player){ if(game.zhu.isAlive()){ return player.identity=='zhu'; } else return player.identity=='fan'; }, chooseCharacterZhidou:function(){ var next=game.createEvent('chooseCharacter'); next.setContent(function(){ "step 0" game.no_continue_game=true; lib.init.onfree(); "step 1" ui.arena.classList.add('choose-character'); var i; var groups=[]; event.list=[]; event.map={}; var chara=(get.config('character_online')||lib.characterOnline); for(i in chara){ var list=chara[i]; for(var j=0;j=3){ groups.push(i); event.list.addArray(list); } } event.list.randomSort(); _status.characterlist=event.list.slice(0); event.controls=['不叫地主','一倍','两倍','三倍']; for(var player of game.players){ var id=player.playerid; player._group=groups.randomRemove(1)[0]; event.map[id]=chara[player._group].randomGets(4); player.storage.doudizhu_cardPile=get.cards(20).sort(function(a,b){ if(a.name!=b.name) return lib.sort.card(a.name,b.name); else if(a.suit!=b.suit) return lib.suit.indexOf(a)-lib.suit.indexOf(b); else return a.number-b.number; }); } event.dialog=ui.create.dialog('你的选将框与底牌',[event.map[game.me.playerid],'character'],game.me.storage.doudizhu_cardPile); event.start=game.players.randomGet(); event.current=event.start; game.delay(7); "step 2" event.current.classList.add('glow_phase'); if(event.current==game.me) event.dialog.content.firstChild.innerHTML='是否叫地主?'; else{ event.dialog.content.firstChild.innerHTML='请等待其他玩家叫地主'; game.delay(2); } event.current.chooseControl(event.controls).set('ai',function(){ return _status.event.getParent().controls.randomGet(); }); "step 3" event.current.classList.remove('glow_phase'); event.current._control=result.control; event.current.chat(result.control); if(result.control=='三倍'){ game.bonusNum=3; game.zhu=event.current; return; } else if(result.control!='不叫地主'){ event.controls.splice(1,event.controls.indexOf(result.control)); event.tempDizhu=event.current; if(result.control=='二倍') game.bonusNum=2; } event.current=event.current.next; if(event.current==event.start&&(event.start==event.tempDizhu||event.start._control=='不叫地主')){ game.zhu=event.tempDizhu||event.start.previous; } else if(event.current==event.start.next&&event.current._control){ game.zhu=event.tempDizhu; } else event.goto(2); if(event.current==event.start.previous&&!event.tempDizhu) event.controls.remove('不叫地主'); "step 4" game.updateRoundNumber(); for(var player of game.players){ player.identity=player==game.zhu?'zhu':'fan'; player.showIdentity(); } event.dialog.content.firstChild.innerHTML='请选择'+get.cnNumber(game.me==game.zhu?2:1)+'张武将牌'; game.me.chooseButton(event.dialog,true,game.me==game.zhu?2:1).set('filterButton',function(button){ return typeof button.link=='string'; }); "step 5" game.me.init(result.links[0],result.links[1]); for(var player of game.players){ if(player!=game.me){ if(player==game.zhu){ var list=event.map[player.playerid].randomGets(2); player.init(list[0],list[1]); } else player.init(event.map[player.playerid].randomGet()); } player.markSkill('doudizhu_cardPile'); } game.zhu.hp=4; game.zhu.maxHp=4; game.zhu.update(); for(var i=0;i队友的选将框
'); list.push([event.map[friend.playerid],'character']); } game.me.chooseButton(list,true).set('list',event.map[game.me.playerid]).set('filterButton',function(button){ return _status.event.list.contains(button.link); }); "step 6" game.me.init(result.links[0]); for(var player of game.players){ if(player!=game.me) player.init(event.map[player.playerid].randomGet()); if(player==game.zhu){ player.addSkill(game.zhuSkill); } else player.addSkill('binglin_neihong'); } game.zhu.hp++; game.zhu.maxHp++; game.zhu.update(); for(var i=0;i0.5?'不叫':'叫地主'; }); if(event.current==game.me){ event.dialog.content.childNodes[0].innerHTML='是否抢地主?'; } "step 2" event.current.chat(result.control); if(result.control=='叫地主'||event.current==event.start.next){ game.zhu=result.control=='叫地主'?event.current:event.current.next; for(var player of game.players){ player.identity=player==game.zhu?'zhu':'fan'; player.showIdentity(); } event.dialog.close(); event.map[game.zhu.playerid].addArray(event.list.randomRemove(3)); } else{ event.current=event.current.next; event.goto(1); game.delay(1.5); } "step 3" game.me.chooseButton(['请选择你的武将',[event.map[game.me.playerid],'character']],true); "step 4" game.me.init(result.links[0]); for(var player of game.players){ if(player!=game.me) player.init(event.map[player.playerid].randomGet()); } game.zhu.hp++; game.zhu.maxHp++; game.zhu.update(); for(var i=0;i'; td.addEventListener(lib.config.touchscreen?'touchend':'click',function(){ if(_status.dragged) return; if(_status.justdragged) return; _status.tempNoButton=true; setTimeout(function(){ _status.tempNoButton=false; },500); var link=this.link; if(game.zhu.name){ if(link!='random'){ _status.event.parent.fixedseat=get.distance(game.me,game.zhu,'absolute'); } game.zhu.uninit(); delete game.zhu.isZhu; delete game.zhu.identityShown; } var current=this.parentNode.querySelector('.bluebg'); if(current){ current.classList.remove('bluebg'); } current=seats.querySelector('.bluebg'); if(current){ current.classList.remove('bluebg'); } if(link=='random'){ link=['zhu','fan'].randomGet(); for(var i=0;i0.5?'不叫':'叫地主'; }); "step 2" event.current.chat(result.control); if(result.control=='叫地主'||event.current==event.start.next){ game.zhu=result.control=='叫地主'?event.current:event.current.next; for(var player of game.players){ player.identity=player==game.zhu?'zhu':'fan'; player.showIdentity(); player.identityShown=true; } game.broadcastAll('closeDialog',event.videoId) event.map[game.zhu.playerid].addArray(event.list.randomRemove(3)); } else{ event.current=event.current.next; event.goto(1); } "step 3" var list=[]; var str='选择角色'; for(var i=0;i队友的选将框
'); dialog.push([event.map[friend.playerid],'character']); } list.push([game.players[i],dialog,true,function(){return Math.random()},function(button){ return _status.event.player._characterChoice.contains(button.link); }]); } game.me.chooseButtonOL(list,function(player,result){ if(game.online||player==game.me) player.init(result.links[0]); }); "step 4" for(var i in lib.playerOL){ if(!result[i]||result[i]=='ai'||!result[i].links||!result[i].links.length){ result[i]=event.map[i].randomGet(); } else{ result[i]=result[i].links[0]; } if(!lib.playerOL[i].name){ lib.playerOL[i].init(result[i]); } } game.zhu.maxHp++; game.zhu.hp++; game.zhu.update(); game.broadcast(function(result,zhu){ for(var i in result){ if(!lib.playerOL[i].name){ lib.playerOL[i].init(result[i]); } } game.zhu=zhu; zhu.maxHp++; zhu.hp++; zhu.update(); setTimeout(function(){ ui.arena.classList.remove('choose-character'); },500); },result,game.zhu); for(var player of game.players){ if(player==game.zhu){ player.addSkill(game.zhuSkill); } else player.addSkill(['binglin_shaxue','binglin_neihong']); } for(var i=0;i=3){ groups.push(i); event.list.addArray(list); } } event.list.randomSort(); _status.characterlist=event.list.slice(0); event.controls=['不叫地主','一倍','两倍','三倍']; for(var player of game.players){ var id=player.playerid; player._group=groups.randomRemove(1)[0]; event.map[id]=chara[player._group].randomGets(3); player.storage.doudizhu_cardPile=get.cards(20).sort(function(a,b){ if(a.name!=b.name) return lib.sort.card(a.name,b.name); else if(a.suit!=b.suit) return lib.suit.indexOf(a)-lib.suit.indexOf(b); else return a.number-b.number; }); player.markSkill('doudizhu_cardPile'); } event.start=game.players.randomGet(); event.current=event.start; event.videoId=lib.status.videoId++; game.broadcastAll(function(map,id){ ui.create.dialog('你的选将框和底牌',[map[game.me.playerid],'character'],game.me.storage.doudizhu_cardPile).videoId=id; },event.map,event.videoId); game.delay(4); "step 1" game.broadcastAll(function(id,current){ var dialog=get.idDialog(id); if(dialog){ if(game.me==current) dialog.content.firstChild.innerHTML='是否叫地主?'; else dialog.content.firstChild.innerHTML='请等待其他玩家叫地主'; } },event.videoId,event.current); if(event.current!=game.me&&!event.current.isOnline()) game.delay(2); event.current.chooseControl(event.controls).set('ai',function(){ return _status.event.getParent().controls.randomGet(); }); "step 2" event.current._control=result.control; event.current.chat(result.control); if(result.control=='三倍'){ game.bonusNum=3; game.zhu=event.current; return; } else if(result.control!='不叫地主'){ event.controls.splice(1,event.controls.indexOf(result.control)); event.tempDizhu=event.current; if(result.control=='二倍') game.bonusNum=2; } event.current=event.current.next; if(event.current==event.start&&(event.start==event.tempDizhu||event.start._control=='不叫地主')){ game.zhu=event.tempDizhu||event.start.previous; } else if(event.current==event.start.next&&event.current._control){ game.zhu=event.tempDizhu; } else event.goto(1); if(event.current==event.start.previous&&!event.tempDizhu) event.controls.remove('不叫地主'); "step 3" for(var player of game.players){ player.identity=player==game.zhu?'zhu':'fan'; player.showIdentity(); player.identityShown=true; } game.broadcastAll('closeDialog',event.videoId); var list=[]; for(var i=0;i5){ num=5; } if(num2>2){ num2=2; } for(var i=0;i14; }, content:function(){ player.loseHp(); }, }, zhuSkill_xiangyang:{ trigger:{player:'phaseEnd'}, charlotte:true, direct:true, content:function(){ 'step 0' player.chooseControl('摸牌阶段','出牌阶段','cancel2').set('prompt','襄阳:是否执行一个额外的阶段?'); 'step 1' if(result.control!='cancel2'){ player.logSkill(event.name); var next=player[result.index?'phaseUse':'phaseDraw'](); event.next.remove(next); trigger.next.push(next); } }, }, zhuSkill_jiangling:{ trigger:{player:'phaseUseBegin'}, direct:true, charlotte:true, content:function(){ 'step 0' player.chooseControl('加目标','多刀','取消').set('prompt',get.prompt2('zhuSkill_jiangling')).set('ai',()=>(3-game.countPlayer())); 'step 1' if(result.index<2){ player.logSkill('zhuSkill_jiangling'); player.addTempSkill('zhuSkill_jiangling'+result.index,'phaseUseAfter'); game.log(player,'选择了','#y'+result.control,'的效果'); } }, }, zhuSkill_jiangling0:{ trigger:{player:'useCard2'}, direct:true, charlotte:true, filter:function(event,player){ if(event.card.name!='sha'&&get.type(event.card)!='trick') return false; if(!event.targets||event.targets.length!=1) return false; var info=get.info(event.card); if(info.allowMultiple==false) return false; if(event.targets&&!info.multitarget){ if(game.hasPlayer(function(current){ return !event.targets.contains(current)&&lib.filter.targetEnabled2(event.card,player,current)&&lib.filter.targetInRange(event.card,player,current); })){ return true; } } return false; }, content:function(){ 'step 0' var prompt2='为'+get.translation(trigger.card)+'增加一个目标' player.chooseTarget(get.prompt('zhuSkill_jiangling'),function(card,player,target){ var player=_status.event.player; if(_status.event.targets.contains(target)) return false; return lib.filter.targetEnabled2(_status.event.card,player,target)&&lib.filter.targetInRange(_status.event.card,player,target); }).set('prompt2',prompt2).set('ai',function(target){ var trigger=_status.event.getTrigger(); var player=_status.event.player; return get.effect(target,trigger.card,player,player)*(_status.event.targets.contains(target)?-1:1); }).set('targets',trigger.targets).set('card',trigger.card); 'step 1' if(result.bool){ if(!event.isMine()&&!event.isOnline()) game.delayx(); event.targets=result.targets; } else{ event.finish(); } 'step 2' if(event.targets){ player.logSkill('zhuSkill_jiangling',event.targets); if(trigger.targets.contains(event.targets[0])) trigger.targets.removeArray(event.targets); else{ //trigger.directHit.addArray(event.targets); trigger.targets.addArray(event.targets); } } }, }, zhuSkill_jiangling1:{ charlotte:true, mod:{ cardUsable:function(card,player){ if(card.name=='sha'||get.type(card)=='trick') return Infinity; }, }, }, zhuSkill_fancheng:{ enable:'phaseUse', limited:true, charlotte:true, skillAnimation:true, animationColor:'gray', content:function(){ 'step 0' player.awakenSkill('zhuSkill_fancheng'); player.chooseControl('杀','其他').set('prompt','选择要强化的伤害').set('ai',()=>get.rand(0,1)); 'step 1' player.addSkill('zhuSkill_fancheng'+result.index); game.log(player,'本局游戏内',result.index?'#g杀以外':'#y杀','的伤害+1'); }, ai:{ order:100, result:{player:100}, }, }, zhuSkill_fancheng0:{ trigger:{source:'damageBegin2'}, forced:true, charlotte:true, filter:function(event,player){ return event.player!=player&&event.card&&event.card.name=='sha'&&event.getParent().name=='sha'; }, logTarget:'player', content:function(){ trigger.num++; }, mark:true, marktext:'殺', intro:{content:'因执行【杀】的效果对其他角色造成的伤害+1'}, }, zhuSkill_fancheng1:{ trigger:{source:'damageBegin2'}, forced:true, charlotte:true, filter:function(event,player){ return event.player!=player&&(!event.card||event.card.name!='sha'); }, logTarget:'player', content:function(){ trigger.num++; }, mark:true, marktext:'谋', intro:{content:'不因【杀】对其他角色造成的伤害+1'}, }, binglin_shaxue:{ init:function(player,skill){ player.addMark(skill,3,false); }, trigger:{player:'damageBegin3'}, forced:true, charlotte:true, filter:function(event,player){ return event.source&&player!=event.source&&player.identity==event.source.identity&&player.countMark('binglin_shaxue')>0; }, content:function(){ trigger.cancel(); player.removeMark('binglin_shaxue',1,false); trigger.source.removeMark('binglin_shaxue',1,false); }, intro:{content:'剩余次数:#'}, ai:{ viewHandcard:true, skillTagFilter:function(player,tag,arg){ return player!=arg&&arg.hasSkill('binglin_shaxue'); }, }, }, binglin_neihong:{charlotte:true}, toushiche_skill:{ trigger:{player:'phaseJieshuBegin'}, forced:true, equipSkill:true, filter:function(event,player){ return lib.skill.toushiche_skill.logTarget(null,player).length>0; }, logTarget:function(event,player){ var hs=player.countCards('h'); return game.filterPlayer(function(current){ return current!=player&¤t.countCards('h')>hs; }); }, content:function(){ 'step 0' event.targets=lib.skill.toushiche_skill.logTarget(null,player).sortBySeat(); 'step 1' var target=targets.shift(); if(target.countCards('h')>0) target.chooseToDiscard('h',true); if(targets.length) event.redo(); }, }, online_gongshoujintui:{ enable:'chooseToUse', filter:function(event,player){ var cards=player.getCards('hs'); for(var i of cards){ var name=get.name(i,player); if(name=='gongshoujianbei'){ if(event.filterCard({ name:'wanjian', isCard:true, cards:[i], },player,event)||event.filterCard({ name:'taoyuan', isCard:true, cards:[i], },player,event)) return true; } if(name=='jintuiziru'){ if(event.filterCard({ name:'nanman', isCard:true, cards:[i], },player,event)||event.filterCard({ name:'wugu', isCard:true, cards:[i], },player,event)) return true; } } return false; }, chooseButton:{ dialog:function(event,player){ var list=[]; if(player.countCards('hs','gongshoujianbei')){ list.push(['锦囊','','wanjian']); list.push(['锦囊','','taoyuan']); } if(player.countCards('hs','jintuiziru')){ list.push(['锦囊','','nanman']); list.push(['锦囊','','wugu']); } return ui.create.dialog('攻守兼备/进退自如',[list,'vcard'],'hidden'); }, filter:function(button,player){ var name=button.link[2]; var rawname=((name=='wanjian'||name=='taoyuan')?'gongshoujianbei':'jintuiziru'); var cards=player.getCards('hs'); var evt=_status.event.getParent(); for(var i of cards){ if(get.name(i,player)==rawname&&evt.filterCard({ name:name, isCard:true, cards:[i], },player,evt)) return true; } return false; }, check:function(button){ return _status.event.player.getUseValue({name:button.link[2],isCard:true}); }, backup:function(links){ var name=links[0][2]; var rawname=((name=='wanjian'||name=='taoyuan')?'gongshoujianbei':'jintuiziru'); return { popname:true, viewAs:{name:name,isCard:true}, filterCard:{name:rawname}, ai1:()=>1, } }, prompt:function(links){ var name=links[0][2]; var rawname=((name=='wanjian'||name=='taoyuan')?'gongshoujianbei':'jintuiziru'); return '将一张'+get.translation(rawname)+'当做'+get.translation(name)+'使用'; } }, ai:{ order:10, result:{ player:1, }, }, }, doudizhu_cardPile:{ intro:{ content:'cardCount', }, }, kaihei:{ enable:'phaseUse', filter:function(event,player){ return player==game.zhu&&game.hasPlayer(function(current){ return lib.skill.kaihei.filterTarget(null,player,current); }); }, filterTarget:function(card,player,target){ return player!=target&&!target.storage.kaihei&&target.countGainableCards(player,'he')>0; }, content:function(){ 'step 0' player.gainPlayerCard(target,[1,2],'he',true); target.storage.kaihei=true; 'step 1' if(!result.bool||!result.cards.length){ event.finish();return; } var num=result.cards.length; var hs=player.getCards('he'); if(hs.length){ if(hs.length<=num) event._result={bool:true,cards:hs}; else player.chooseCard('he',true,num,'选择交给'+get.translation(target)+get.cnNumber(num)+'张牌'); } else event.finish(); 'step 2' if(result.bool&&result.cards&&result.cards.length) player.give(result.cards,target); }, ai:{ viewHandcard:true, skillTagFilter:function(player,tag,target){ if(player==target||player.identity!='fan'||target.identity!='fan') return false; }, }, }, feiyang:{ trigger:{player:'phaseJudgeBegin'}, charlotte:true, direct:true, filter:function(event,player){ return _status.mode!='online'&&_status.mode!='binglin'&&player==game.zhu&&player.countCards('j')&&player.countCards('h')>1; }, content:function(){ "step 0" player.chooseToDiscard('h',2,get.prompt('feiyang'),'弃置两张手牌,然后弃置判定区里的一张牌').set('logSkill','feiyang').set('ai',function(card){ if(_status.event.goon) return 6-get.value(card); return 0; }).set('goon',player.hasCard(function(card){ return get.effect(player,{ name:card.viewAs||card.name, cards:[card], },player,player)<0; },'j')); "step 1" if(result.bool){ player.discardPlayerCard(player,'j',true); } }, }, bahu:{ trigger:{player:'phaseZhunbeiBegin'}, charlotte:true, forced:true, filter:function(event,player){ return _status.mode!='online'&&_status.mode!='binglin'&&player==game.zhu; }, content:function(){ player.draw(); }, mod:{ cardUsable:function(card,player,num){ if(_status.mode!='online'&&_status.mode!='binglin'&&player==game.zhu&&card.name=='sha') return num+1; }, }, }, diqi_skill:{ trigger:{player:'damageBegin2'}, filter:function(event,player){ var card=player.getEquip('diqi'); return get.itemtype(card)=='card'&&lib.filter.cardDiscardable(card,player,'diqi_skill'); }, check:function(event,player){ return event.num>=Math.min(player.hp,2); }, prompt2:function(event,player){ return '弃置'+get.translation(player.getEquip('diqi'))+'并防止即将受到的'+get.cnNumber(event.num)+'点伤害'; }, content:function(){ player.discard(player.getEquip('diqi')); trigger.cancel(); }, ai:{ filterDamage:true, skillTagFilter:function(player,tag,arg){ if(arg&&arg.player){ if(arg.player.hasSkillTag('jueqing',false,player)) return false; } }, }, }, online_aozhan:{ trigger:{player:'phaseBefore'}, forced:true, popup:false, firstDo:true, filter:function(event,player){ return !_status._aozhan&&game.roundNumber>10; }, content:function(){ var color=get.groupnature(player.group,"raw"); if(player.isUnseen()) color='fire'; player.$fullscreenpop('鏖战模式',color); game.broadcastAll(function(){ _status._aozhan=true; ui.aozhan=ui.create.div('.touchinfo.left',ui.window); ui.aozhan.innerHTML='鏖战模式'; if(ui.time3) ui.time3.style.display='none'; ui.aozhanInfo=ui.create.system('鏖战模式',null,true); lib.setPopped(ui.aozhanInfo,function(){ var uiintro=ui.create.dialog('hidden'); uiintro.add('鏖战模式'); var list=[ '从第11轮开始,游戏将进入〔鏖战模式〕。', '在鏖战模式下,任何角色均不是非转化的【桃】的合法目标。【桃】可以被当做【杀】或【闪】使用或打出。', ]; var intro='
    '; for(var i=0;i'+intro+'
'); var ul=uiintro.querySelector('ul'); if(ul){ ul.style.width='180px'; } uiintro.add(ui.create.div('.placeholder')); return uiintro; },250); game.playBackgroundMusic(); }); game.removeGlobalSkill('online_aozhan'); game.countPlayer(function(current){current.addSkill('aozhan')}); }, }, online_juzhong:{ trigger:{global:'useCard'}, direct:true, ruleSkill:true, filter:function(event,player){ return _status.mode=='online'&&!event.all_excluded&&event.player.isFriendOf(player)&&event.player!=player&&lib.skill.online_juzhong.infos[event.card.name]&&player.hasCard(function(card){ if(_status.connectMode) return true; return get.name(card,player)==event.card.name; },'h'); }, content:function(){ 'step 0' player.chooseToDiscard('是否响应【聚众】?',get.translation(trigger.player)+'使用了'+get.translation(trigger.card)+'。你可弃置一张名称相同的牌,令'+lib.skill.online_juzhong.infos[trigger.card.name][0],function(card,player){ return get.name(card,player)==_status.event.getTrigger().card.name; }).set('ai',lib.skill.online_juzhong.infos[trigger.card.name][2]).logSkill=['_juzhong',trigger.player]; 'step 1' if(result.bool){ lib.skill.online_juzhong.infos[trigger.card.name][1](); if(!event.goon) event.finish(); } else event.finish(); 'step 2' trigger.player.chooseTarget('你可选择一名角色,弃置其的一张牌',function(card,player,target){ return target.countDiscardableCards(player,'he')>0; }).set('ai',function(target){ var player=_status.event.player; return get.effect(target,{name:'guohe_copy2'},player,player); }); 'step 3' if(result.bool){ var target=result.targets[0]; trigger.player.line(target,'green'); trigger.player.discardPlayerCard(target,true,'he'); } }, infos:{ sha:['此【杀】的伤害值基数+1。',function(){ var evt=_status.event._trigger; if(!evt.baseDamage) evt.baseDamage=1; evt.baseDamage++; },function(card){ var evt=_status.event.getTrigger(); if(!evt.targets.length) return 0; if(evt.targets[0].hasShan()||evt.targets[0].hasSkillTag('filterDamage',null,{ player:evt.targets[0], card:evt.card, })) return 0; return 1; }], shan:['其可弃置一名角色的一张牌。',function(){ _status.event.goon=true; },function(card){ if(game.zhu.countCards('he',function(card){ return get.value(card,game.zhu)>=6; })) return 7-get.value(card); if(game.zhu.countCards('he',function(card){ return get.value(card,game.zhu)>0 })) return 5-get.value(card); return 0; }], tao:['其摸两张牌。',function(){ _status.event._trigger.player.draw(2); },function(card){ return 6-get.value(card); }], jiu:['其本回合的伤害值或回复值+1。',function(){ var player=_status.event._trigger.player; player.addTempSkill('juzhong_jiu'); player.addMark('juzhong_jiu',1,false); },function(card){ return 6-get.value(card); }], }, ai:{ viewHandcard:true, skillTagFilter:function(player,tag,target){ if(_status.mode!='online'||player==target||player.identity!=target.identity) return false; }, }, }, juzhong_jiu:{ trigger:{ player:'recoverBegin', source:'damageBegin1', }, forced:true, popup:false, content:function(){ trigger.num+=player.countMark('juzhong_jiu'); }, onremove:true, intro:{content:'本回合的伤害值和回复值+#'}, }, online_zhadan_button:{ trigger:{ global:'gameDrawAfter', player:['gainEnd','loseEnd'], }, firstDo:true, forced:true, charlotte:true, popup:false, silent:true, filter:function(event,player){ if(_status.mode!='online'||(player!=game.me&&!player.isOnline())) return; if(event.name!='lose') return !player.hasZhadan&&player.countCards('hs','zhadan')>0; return player.hasZhadan&&!player.countCards('hs','zhadan'); }, content:function(){ if(!player.hasZhadan){ player.hasZhadan=true; if(player==game.me) lib.skill.online_zhadan_button.initZhadan(); else player.send(function(){lib.skill.online_zhadan_button.initZhadan()}); } else{ delete player.hasZhadan; if(player==game.me) lib.skill.online_zhadan_button.removeZhadan(); else player.send(function(){lib.skill.online_zhadan_button.removeZhadan()}); } }, initZhadan:function(){ ui.zhadan_button=ui.create.control('激活炸弹','stayleft',function(){ if(this.classList.contains('hidden')) return; this.classList.toggle('glow'); if(this.classList.contains('glow')&&_status.event.type=='zhadan'&& _status.event.isMine()&&ui.confirm&&_status.imchoosing){ ui.click.cancel(ui.confirm.lastChild); } }); }, removeZhadan:function(){ if(ui.zhadan_button){ ui.zhadan_button.remove(); delete ui.zhadan_button; } }, }, online_zhadan:{ trigger:{player:'useCard'}, priority:5, popup:false, forced:true, filter:function(event,player){ return game.hasPlayer(function(current){ return current.hasCard(function(card){ if(get.name(card)!='zhadan') return false; return lib.filter.cardEnabled(card,player,'forceEnable'); },'hs'); }); }, forceLoad:true, content:function(){ 'step 0' event.source=trigger.player; event.card=trigger.card; event.targets=trigger.targets; event._global_waiting=true; event.filterCard=function(card,player){ if(get.name(card)!='zhadan'||get.itemtype(card)!='card') return false; return lib.filter.cardEnabled(card,player,'forceEnable'); }; event.send=function(player,card,source,targets,id,id2,skillState){ if(skillState){ player.applySkills(skillState); } if(player==game.me&&ui.zhadan_button&&!ui.zhadan_button.classList.contains('glow')){ _status.event._result={bool:false}; if(game.online){ _status.event._resultid=id; game.resume(); } return; } var str=get.translation(source); if(targets&&targets.length){ str+='对'+get.translation(targets); } str+='使用了'; str+=get.translation(card); str+=',是否对其使用【炸弹】?'; var next=player.chooseToUse({ filterCard:function(card,player){ if(get.name(card)!='zhadan'||get.itemtype(card)!='card') return false; return lib.filter.cardEnabled(card,player,'forceEnable'); }, prompt:str, _global_waiting:true, ai1:function(card){ var evt=_status.event.getParent('_zhadan')._trigger,player=_status.event.player; if(!evt) return 0; if(get.attitude(player,evt.player)>0) return 0; var eff=0; if(!targets.length) return Math.random()-0.5; for(var i of targets) eff-=get.effect(i,evt.card,evt.player,player); return eff-8; }, source:source, source2:targets, id:id, id2:id2, type:'zhadan', }); next.set('respondTo',[source,card]); if(game.online){ _status.event._resultid=id; game.resume(); } else{ next.nouse=true; } }; 'step 1' var list=game.filterPlayer(function(current){ return current.hasCard(function(card){ if(get.name(card)!='zhadan') return false; return lib.filter.cardEnabled(card,player,'forceEnable'); },'hs'); }); event.list=list; event.id=get.id(); list.sort(function(a,b){ return get.distance(event.source,a,'absolute')-get.distance(event.source,b,'absolute'); }); 'step 2' if(event.list.length==0){ event.finish(); } else if(_status.connectMode&&(event.list[0].isOnline()||event.list[0]==game.me)){ event.goto(4); } else{ event.current=event.list.shift(); event.send(event.current,event.card,event.source,event.targets,event.id,trigger.parent.id); } 'step 3' if(result.bool){ event.zhadanresult=event.current; event.zhadanresult2=result; if(event.current!=game.me&&!event.current.isOnline()) game.delayx(); event.goto(8); } else{ event.goto(2); } 'step 4' var id=event.id; var sendback=function(result,player){ if(result&&result.id==id&&!event.zhadanresult&&result.bool){ event.zhadanresult=player; event.zhadanresult2=result; game.broadcast('cancel',id); if(_status.event.id==id&&_status.event.name=='chooseToUse'&&_status.paused){ return (function(){ event.resultOL=_status.event.resultOL; ui.click.cancel(); if(ui.confirm) ui.confirm.close(); }); } } else{ if(_status.event.id==id&&_status.event.name=='chooseToUse'&&_status.paused){ return (function(){ event.resultOL=_status.event.resultOL; }); } } }; var withme=false; var withol=false; var list=event.list; for(var i=0;inum1) num1=num; if(numnum2){ choices.push('令'+str+'将手牌弃置至'+get.cnNumber(num2)+'张'); event.num2=num2; } if(!choices.length) event.finish(); else if(choices.length==1) event._result={index:0}; else player.chooseControl().set('choiceList',choices).set('ai',function(){ var evt=_status.event.getParent(); return get.attitude(evt.player,evt.target)>0?0:1; }); 'step 1' if(result.index+event.addIndex==0){ target.drawTo(event.num1); } else target.chooseToDiscard(true,'h',target.countCards('h')-event.num2); }, ai:{ order:6, value:4, useful:2, tag:{ draw:1, loseCard:1, }, result:{ target:function(player,target,card,isLink){ var num1=0,num2=Infinity,str=get.translation(target); game.countPlayer(function(current){ var num=current.countCards('h',function(cardx){ if(ui.selected.cards.contains(cardx)) return false; if(card.cards&&card.cards.contains(cardx)) return false; return true; }); if(num>num1) num1=num; if(numnum){ if(get.attitude(player,target)>0) return (num1-num)/1.2; } if(num20) return (num2-num)/1.2; } return 0; } } } }, shuiyanqijuny:{ fullskin:true, cardimage:'shuiyanqijunx', enable:true, filterTarget:true, type:'trick', selectTarget:[1,2], targetprompt:['受伤弃牌','受伤摸牌'], contentBefore:function(){ var evt=event.getParent(),target=evt.stocktargets[0]; evt.shuiyanqijun_target=target; }, content:function(){ target.damage('thunder'); if(target!=event.getParent().shuiyanqijun_target) target.draw(); else target.chooseToDiscard('he',true); }, ai:{ order:6, value:4, useful:2, tag:{ damage:1, thunderDamage:1, natureDamage:1, loseCard:1, }, result:{ target:function(player,target){ if(!ui.selected.targets.length) return -1.5; return -0.5 } } } }, luojingxiashi:{ fullskin:true, enable:true, type:'trick', selectTarget:-1, filterTarget:function(card,player,target){ return target!=player&&target.isDamaged(); }, content:function(){ target.damage(); }, ai:{ order:3, value:4, useful:2, tag:{ loseCard:1, }, result:{ target:-1.5, } } }, binglinchengxia:{ fullskin:true, type:'delay', filterTarget:function(card,player,target){ return (lib.filter.judge(card,player,target)&&player!=target); }, judge:function(card){ if(get.suit(card)=='diamond') return 0; return -3; }, effect:function(){ 'step 0' if(result.bool==false){ if(!player.countCards('e',function(card){ return lib.filter.cardDiscardable(card,player,'shuiyanqijuny'); })){ player.damage('nosource'); event.finish(); return; } else player.chooseControl('discard_card','take_damage',function(event,player){ if(get.damageEffect(player,event.player,player)>=0){ return 'take_damage'; } if(player.hp>=3&&player.countCards('e')>=2){ return 'take_damage'; } return 'discard_card'; }); } else event.finish(); 'step 1' if(result.control=='discard_card'){ player.discard(player.getCards('e',function(card){ return lib.filter.cardDiscardable(card,player,'shuiyanqijuny'); })); } else player.damage('nosource'); }, ai:{ order:1, value:3, useful:2, tag:{ damage:1, loseCard:1, }, result:{ target:function(player,target,card,isLink){ var es=target.getCards('e'); if(!es.length) return -1.5; var val=0; for(var i of es) val+=get.value(i,target); return -Math.min(1.5,val/5); } } } }, toushiche:{ fullskin:true, type:'equip', subtype:'equip1', distance:{attackFrom:-3}, ai:{ basic:{ equipValue:2.5 } }, skills:['toushiche_skill'] }, gongshoujianbei:{ fullskin:true, type:'trick', }, jintuiziru:{ fullskin:true, type:'trick', }, diqi:{ fullskin:true, type:"equip", subtype:"equip2", skills:['diqi_skill'], destroy:'diqi_skill', ai:{ basic:{ equipValue:6 }, }, }, zhadan:{ audio:true, fullskin:true, type:'trick', ai:{ basic:{ useful:[6,4], value:[6,4], }, result:{player:1}, }, notarget:true, content:function(){ var evt=event.getParent(2)._trigger; evt.targets.length=0; evt.all_excluded=true; game.log(evt.card,'的效果被炸弹抵消了'); }, }, jiwangkailai:{ audio:true, fullskin:true, type:'trick', enable:function(card,player){ var hs=player.getCards('h',function(cardx){ return cardx!=card&&(!card.cards||!card.cards.contains(cardx)); }); if(!hs.length) return false; var use=true,discard=true; for(var i of hs){ if(use&&!game.checkMod(i,player,'unchanged','cardEnabled2',player)) use=false; if(discard&&!lib.filter.cardDiscardable(i,player,'jiwangkailai')) discard=false; if(!use&&!discard) return false; } return true; }, selectTarget:-1, toself:true, filterTarget:function(card,player,target){ return target==player; }, modTarget:true, content:function(){ 'step 0' var hs=player.getCards('h'); if(hs.length){ var use=true,discard=true; for(var i of hs){ if(use&&!game.checkMod(i,player,'unchanged','cardEnabled2',player)) use=false; if(discard&&!lib.filter.cardDiscardable(i,player,'jiwangkailai')) discard=false; if(!use&&!discard) break; } if(use&&discard) player.chooseControl().set('prompt','继往开来:请选择一项').set('choiceList',[ '弃置所有手牌,然后摸等量的牌', '将所有手牌当做一张普通锦囊牌使用', ]).set('ai',function(){ if(_status.event.player.countCards('h')>2) return 0; return 1; }); else if(use) event._result={index:1}; else if(discard) event._result={index:0}; else event.finish(); } else event.finish(); 'step 1' var cards=player.getCards('h'); if(result.index==0){ player.discard(cards); player.draw(cards.length); event.finish(); } else{ var list=[]; for(var i of lib.inpile){ if(i!='jiwangkailai'&&get.type(i)=='trick'&&lib.filter.filterCard({name:i,cards:cards},player)) list.push(['锦囊','',i]); } if(list.length){ player.chooseButton(['继往开来:选择要使用的牌',[list,'vcard']],true).set('ai',function(button){ var player=_status.event.player; return player.getUseValue({name:button.link[2],cards:player.getCards('h')}); }); } else event.finish(); } 'step 2' if(result.bool) player.chooseUseTarget({name:result.links[0][2]},player.getCards('h'),true); }, ai:{ basic:{ order:0.5, useful:3, value:5 }, result:{ target:function(player,target){ if(target.needsToDiscard(1)||!target.countCards('h',function(card){ return get.value(card,player)>=5.5; })) return 1; return 0; }, }, tag:{ draw:2 } } }, }, characterOnline:{ wei:[ 're_caocao','re_guojia','re_simayi','re_xiahoudun','xuzhu','re_zhangliao','re_zhenji','ol_xiahouyuan','dianwei','re_xunyu','zhanghe', 'yujin_yujin','re_caozhang','wangyi','guohuai','hanhaoshihuan','chenqun','re_caoxiu','guohuanghou','sunziliufang','xunyou','xinxianying', 'sp_caiwenji','caoang','caochun','caohong','sp_caoren','chenlin','sp_jiaxu','litong','sp_pangde','simalang','wanglang', 'kuailiangkuaiyue','wangji','sp_simazhao','sp_wangyuanji','yuejin','zangba','xinpi','liuye','simashi','zhuling','duji','caoanmin', ], shu:[ 're_guanyu','re_huangyueying','re_liubei','re_machao','re_zhangfei','zhaoyun','re_huangzhong','re_weiyan','re_pangtong','ol_sp_zhugeliang', 're_menghuo','re_zhurong','re_fazheng','re_masu','guanxingzhangbao','xin_liaohua','old_madai','re_jianyong','wuyi','zhangsong','zhoucang', 'liuchen','xiahoushi','re_zhangyi','liyan','guanyinping','guansuo','mayunlu','mazhong','mizhu','sunqian','xiahouba','zhangxingcai', 'wangping','yanyan','chendao','ganfuren','re_maliang','dengzhi','lifeng','zhangyì', ], wu:[ 're_ganning','re_huanggai','re_sunquan','re_sunshangxiang','re_zhouyu','old_zhoutai','re_xiaoqiao','re_taishici','sunjian','re_zhangzhang', 're_lingtong','re_wuguotai','xin_xusheng','re_bulianshi','re_chengpu','handang','xin_panzhangmazhong','xin_zhuran','guyong','zhuhuan','cenhun','sundeng','xuezong', 'daxiaoqiao','heqi','kanze','sunhao','re_sunluyu','sunshao','zhugejin','zumao','dingfeng','sunliang','zhoufei', 'weiwenzhugezhi','xf_sufei','xugong','lingcao','sunru','lvdai','panjun','yanjun','zhoufang', ], qun:[ 're_diaochan','re_gongsunzan','re_huatuo','re_huaxiong','re_lvbu','ol_pangde','re_yanwen','jiaxu','gaoshun','xin_liubiao','chengong', 're_gongsunyuan','guotufengji','dongbai','fuwan','liuxie','sp_machao','tadun','yanbaihu','yuanshu','zhangbao','yl_luzhi','huangfusong','sp_ganning','huangjinleishi', 're_panfeng','guosi','sp_liuqi','mangyachang','gaolan','lvkuanglvxiang','xunchen','sp_zhanghe','re_hansui','re_hejin','zhujun','ol_dingyuan','hanfu','wangrong', 'dongcheng','gongsunkang','hucheer','sp_sufei','yj_xuhuang','yj_zhanghe','yj_zhangliao','liuyao','wangcan','sp_taishici','caimao','jiling', ], key:[ 'sp_key_yuri','key_akane','key_akiko','key_ao','key_harukakanata','key_haruko','key_hinata','key_kengo','key_komari','key_kotori','key_kyoko','key_nagisa','key_noda','key_rei','key_rin','key_rumi','key_ryoichi','key_sasami','key_shiorimiyuki','key_shiroha','key_shizuku','key_tomoya','key_tsumugi','key_umi','key_yoshino','key_youta','key_yukine','key_nao','key_misuzu', ], }, online_cardPile:[ ['spade',1,'guding'], ['spade',1,'zhadan'], ['spade',2,'tengjia'], ['spade',2,'cixiong'], ['spade',3,'jiu'], ['spade',3,'guohe'], ['spade',4,'sha','thunder'], ['spade',4,'guohe'], ['spade',5,'sha','thunder'], ['spade',5,'qinglong'], ['spade',6,'sha','thunder'], ['spade',6,'jiwangkailai'], ['spade',7,'sha','thunder'], ['spade',7,'jintuiziru'], ['spade',8,'sha','thunder'], ['spade',8,'sha'], ['spade',9,'jiu'], ['spade',9,'sha'], ['spade',10,'gongshoujianbei'], ['spade',10,'sha'], ['spade',11,'tiesuo'], ['spade',11,'shunshou'], ['spade',12,'tiesuo'], ['spade',12,'zhangba'], ['spade',13,'wuxie'], ['spade',13,'dawanma'], ['club',1,'baiyin'], ['club',1,'zhuge'], ['club',2,'tengjia'], ['club',2,'bagua'], ['club',3,'jiu'], ['club',3,'sha'], ['club',4,'jintuiziru'], ['club',4,'sha'], ['club',5,'sha','thunder'], ['club',5,'dilu'], ['club',6,'sha','thunder'], ['club',6,'sha'], ['club',7,'sha','thunder'], ['club',7,'sha'], ['club',8,'sha','thunder'], ['club',8,'sha'], ['club',9,'jiu'], ['club',9,'sha'], ['club',10,'tiesuo'], ['club',10,'sha'], ['club',11,'tiesuo'], ['club',11,'sha'], ['club',12,'tiesuo'], ['club',12,'wuxie'], ['club',13,'tiesuo'], ['club',13,'jiedao'], ['club',13,'wuxie'], ['heart',1,'wuxie'], ['heart',1,'gongshoujianbei'], ['heart',1,'zhadan'], ['heart',2,'huogong'], ['heart',2,'shan'], ['heart',3,'huogong'], ['heart',3,'wuzhong'], ['heart',4,'sha','fire'], ['heart',4,'tao'], ['heart',5,'tao'], ['heart',5,'chitu'], ['heart',6,'tao'], ['heart',6,'jiwangkailai'], ['heart',7,'sha','fire'], ['heart',7,'tao'], ['heart',8,'shan'], ['heart',8,'wuzhong'], ['heart',9,'shan'], ['heart',9,'tao'], ['heart',10,'sha','fire'], ['heart',10,'sha'], ['heart',11,'shan'], ['heart',11,'wuzhong'], ['heart',12,'shan'], ['heart',12,'guohe'], ['heart',13,'wuxie'], ['heart',13,'zhuahuang'], ['diamond',1,'zhuque'], ['diamond',1,'juedou'], ['diamond',2,'tao'], ['diamond',2,'shan'], ['diamond',3,'tao'], ['diamond',3,'shan'], ['diamond',4,'sha','fire'], ['diamond',4,'shunshou'], ['diamond',5,'sha','fire'], ['diamond',5,'guanshi'], ['diamond',6,'shan'], ['diamond',6,'sha'], ['diamond',7,'shan'], ['diamond',7,'shan'], ['diamond',8,'shan'], ['diamond',8,'shan'], ['diamond',9,'jiu'], ['diamond',9,'shan'], ['diamond',10,'shan'], ['diamond',10,'sha'], ['diamond',11,'shan'], ['diamond',11,'shan'], ['diamond',12,'huogong'], ['diamond',12,'tao'], ['diamond',13,'xiliu'], ['diamond',13,'sha'], ['diamond',13,'wuxie'] ], help:{ '斗地主':'
游戏规则
  • 游戏人数
    游戏人数为3人(地主x1 + 农民x2)。
  • 胜利条件
    农民:地主死亡。
    地主:所有农民死亡且自己存活。'+ '
  • 死亡奖惩
    当有农民死亡时,若另一名农民存活,则其可以选择摸两张牌或回复1点体力。
  • 地主专属技能
    地主可以使用专属技能〖飞扬〗和〖跋扈〗。
    〖飞扬〗判定阶段开始时,若你的判定区有牌,则你可以弃置两张手牌,然后弃置你判定区的一张牌。每回合限一次。
    〖跋扈〗锁定技,准备阶段开始时,你摸一张牌。出牌阶段,你可以多使用一张【杀】。
', } }; });