'use strict'; character.shenhua={ connect:true, character:{ xiahouyuan:['male','wei',4,['shensu']], caoren:['male','wei',4,['jushou','jiewei']], huangzhong:['male','shu',4,['xinliegong']], weiyan:['male','shu',4,['xinkuanggu','qimou']], xiaoqiao:['female','wu',3,['tianxiang','hongyan']], zhoutai:['male','wu',4,['buqu','fenji']], zhangjiao:['male','qun',3,['leiji','guidao','huangtian'],['zhu']], sp_zhangjiao:['male','qun',3,['releiji','guidao','huangtian'],['zhu']], // yuji:['male','qun',3,['guhuo']], // xin_yuji:['male','qun',3,['guhuo']], sp_zhugeliang:['male','shu',3,['huoji','bazhen','kanpo']], pangtong:['male','shu',3,['lianhuan','niepan']], xunyu:['male','wei',3,['quhu','jieming']], dianwei:['male','wei',4,['qiangxi']], taishici:['male','wu',4,['tianyi']], yanwen:['male','qun',4,['shuangxiong']], yuanshao:['male','qun',4,['luanji','xueyi'],['zhu']], pangde:['male','qun',4,['mashu','mengjin']], menghuo:['male','shu',4,['huoshou','zaiqi']], zhurong:['female','shu',4,['juxiang','lieren']], caopi:['male','wei',3,['xingshang','fangzhu','songwei'],['zhu']], xuhuang:['male','wei',4,['duanliang']], lusu:['male','wu',3,['haoshi','dimeng']], sunjian:['male','wu',4,['yinghun']], dongzhuo:['male','qun',8,['jiuchi','roulin','benghuai','baonue'],['zhu']], jiaxu:['male','qun',3,['luanwu','wansha','weimu']], jiangwei:['male','shu',4,['tiaoxin','zhiji']], liushan:['male','shu',3,['xiangle','fangquan','ruoyu'],['zhu']], zhanghe:['male','wei',4,['qiaobian']], dengai:['male','wei',4,['tuntian','zaoxian']], sunce:['male','wu',4,['jiang','hunzi','zhiba'],['zhu']], zhangzhang:['male','wu',3,['zhijian','guzheng']], caiwenji:['female','qun',3,['beige','duanchang']], zuoci:['male','qun',3,['huashen','xinsheng']], }, perfectPair:{ yuanshao:['yanwen'], menghuo:['zhurong'], }, skill:{ qimou:{ unique:true, enable:'phaseUse', filter:function(event,player){ return !player.storage.qimou; }, init:function(player){ player.storage.qimou=false; }, mark:true, intro:{ content:'limited' }, skillAnimation:'legend', animationColor:'metal', content:function(){ 'step 0' var shas=player.get('h','sha'); var num; if(player.hp>=4&&shas.length>=3){ num=3; } else if(player.hp>=3&&shas.length>=2){ num=2; } else{ num=1 } player.unmarkSkill('qimou'); player.storage.qimou=true; player.chooseControl('一','二','三','四','五','六',function(){ return get.cnNumber(_status.event.goon,true); }).set('prompt','失去任意点体力').set('goon',num); 'step 1' var num; switch(result.control){ case '一':num=1;break; case '二':num=2;break; case '三':num=3;break; case '四':num=4;break; case '五':num=5;break; case '六':num=6;break; } player.storage.qimou=num; player.loseHp(num); player.addTempSkill('qimou2','phaseAfter'); }, ai:{ order:2, result:{ player:function(player){ if(player.hp==1) return 0; var shas=player.get('h','sha'); if(!shas.length) return 0; var card=shas[0]; if(!lib.filter.cardEnabled(card,player)) return 0; if(lib.filter.cardUsable(card,player)) return 0; var mindist; if(player.hp>=4&&shas.length>=3){ mindist=4; } else if(player.hp>=3&&shas.length>=2){ mindist=3; } else{ mindist=2; } for(var i=0;i0){ return 1; } } return 0; } } } }, qimou2:{ onremove:function(player){ delete player.storage.qimou; }, mod:{ cardUsable:function(card,player,num){ if(typeof player.storage.qimou=='number'&&card.name=='sha'){ return num+player.storage.qimou; } }, attackFrom:function(from,to,distance){ if(typeof from.storage.qimou=='number'){ return distance-from.storage.qimou; } } } }, xinkuanggu:{ trigger:{source:'damageEnd'}, filter:function(event,player){ return get.distance(player,event.player)<=1; }, direct:true, audio:'kuanggu', content:function(){ 'step 0' var controls=['draw_card','cancel2']; if(player.hp=3&&player.num('h')=player.hp) player.addTempSkill('xinliegong2','shaAfter'); } }, xinliegong2:{ trigger:{source:'damageBegin'}, filter:function(event){ return event.card&&event.card.name=='sha'&&event.notLink(); }, forced:true, audio:false, content:function(){ trigger.num++; } }, tiaoxin:{ audio:4, enable:'phaseUse', usable:1, filterTarget:function(card,player,target){ return target.canUse({name:'sha'},player)&&target.num('he'); }, content:function(){ "step 0" target.chooseToUse({name:'sha'},player,-1,'挑衅:对'+get.translation(player)+'使用一张杀,或令其弃置你的一张牌').set('targetRequired',true); "step 1" if(result.bool==false&&target.num('he')>0){ player.discardPlayerCard(target,'he',true); } else{ event.finish(); } }, ai:{ order:4, expose:0.2, result:{ target:-1, player:function(player,target){ if(target.num('h')==0) return 0; if(target.num('h')==1) return -0.1; if(player.hp<=2) return -2; if(player.num('h','shan')==0) return -1; return -0.5; } }, threaten:1.1 } }, zhiji:{ skillAnimation:true, audio:2, unique:true, priority:-10, trigger:{player:'phaseBegin'}, forced:true, filter:function(event,player){ if(player.storage.zhiji) return false; return player.num('h')==0; }, content:function(){ "step 0" player.chooseControl('zhiji_recover','zhiji_draw',function(event,player){ if(player.hp>=2) return 'zhiji_draw'; return 'zhiji_recover'; }); "step 1" if(result.control=='zhiji_draw'){ player.draw(2); } else{ player.recover(); } "step 2" player.loseMaxHp(); player.storage.zhiji=true; if(player.hp>player.maxHp) player.hp=player.maxHp; player.update(); player.addSkill('guanxing'); game.createTrigger('phaseBegin','guanxing',player,trigger); } }, xiangle:{ audio:2, trigger:{target:'useCardToBefore'}, forced:true, filter:function(event,player){ return event.card.name=='sha'; }, content:function(){ "step 0" var eff=ai.get.effect(player,trigger.card,trigger.player,trigger.player); trigger.player.chooseToDiscard(function(card){ return get.type(card)=='basic'; }).set('ai',function(card){ if(_status.event.eff>0){ return 10-ai.get.value(card); } return 0; }).set('eff',eff); "step 1" if(result.bool==false){ trigger.finish(); trigger.untrigger(); } }, ai:{ effect:{ target:function(card,player,target,current){ if(card.name=='sha'){ if(_status.event.name=='xiangle') return; var bs=player.get('h',{type:'basic'}); if(bs.length<2) return 0; if(player.hasSkill('jiu')||player.hasSkill('tianxianjiu')) return; if(bs.length<=3&&player.num('h','sha')<=1){ for(var i=0;i0&&!player.hasSkill('fangquan3'); }, direct:true, content:function(){ "step 0" var fang=player.hp>=2&&player.num('h')<=player.hp+1; player.chooseTarget(get.prompt('fangquan'),function(card,player,target){ return target!=player; }).set('ai',function(target){ if(!_status.event.fang) return -1; if(target.num('j','lebu')) return -1; return ai.get.attitude(player,target)-4; }).set('fang',fang); "step 1" if(result.bool){ player.logSkill('fangquan',result.targets); trigger.untrigger(); trigger.finish(); player.addSkill('fangquan2'); player.storage.fangquan=result.targets[0]; } } }, fangquan2:{ trigger:{player:'phaseEnd'}, forced:true, popup:false, audio:false, content:function(){ "step 0" player.chooseToDiscard(true); "step 1" var target=player.storage.fangquan; target.markSkillCharacter('fangquan',player,'放权','进行一个额外回合'); target.phase(); target.addSkill('fangquan3'); player.removeSkill('fangquan2'); delete player.storage.fangquan; } }, fangquan3:{ trigger:{player:'phaseAfter'}, forced:true, popup:false, audio:false, content:function(){ player.unmarkSkill('fangquan'); player.removeSkill('fangquan3'); } }, ruoyu:{ skillAnimation:true, audio:2, unique:true, zhuSkill:true, keepSkill:true, trigger:{player:'phaseBegin'}, forced:true, filter:function(event,player){ if(!player.hasZhuSkill('ruoyu'))return false; if(player.storage.ruoyu) return false; for(var i=0;i0; }, direct:true, frequent:true, content:function(){ "step 0" if(player.num('j')==0&&(!event.isMine()||!lib.config.autoskilllist.contains('qiaobian1'))){ event.finish(); } else{ var next=player.chooseToDiscard('是否发动巧变跳过判定阶段?'); next.set('ai',ai.get.unuseful2); next.set('logSkill','qiaobian'); } "step 1" if(result.bool){ trigger.untrigger(); trigger.finish(); } } }, qiaobian2:{ audio:2, trigger:{player:'phaseDrawBefore'}, filter:function(event,player){ return player.num('h')>0; }, direct:true, content:function(){ "step 0" var check,i,num=0,num2=0; for(i=0;i=2&&num2>0); player.chooseCardTarget({ ai1:function(card){ var evt=_status.event; if(!evt.check) return 0; return 6-ai.get.useful(card); }, ai2:function(target){ var evt=_status.event; if(!evt.check) return 0; return 1-ai.get.attitude(evt.player,target); }, filterTarget:function(card,player,target){ return target.num('h')>0; }, selectTarget:[0,2], filterCard:lib.filter.cardDiscardable, prompt:'是否发动巧变跳过摸牌阶段?', check:check, target:target }); "step 1" if(result.bool){ player.logSkill('qiaobian',result.targets); player.discard(result.cards); event.targets=result.targets; } else{ event.finish(); } "step 2" game.delay(); "step 3" for(var i=0;i0; }, direct:true, content:function(){ "step 0" var check; for(var i=0;i0&&game.players[i].num('j')){ check=true;break; } } if(!check){ if(player.num('h')>player.hp+1){ check=false; } else if(player.num('h',{name:['wuzhong']})){ check=false; } else{ check=true; } } player.chooseCardTarget({ ai1:function(card){ if(!_status.event.check) return 0; return 7-ai.get.useful(card); }, ai2:function(target){ if(!_status.event.check) return 0; var player=_status.event.player; if(ui.selected.targets.length==0){ if(target.num('j')&&ai.get.attitude(player,target)>0) return 10; if(ai.get.attitude(player,target)<0){ for(var i=0;i0){ if((target.get('e','1')&&!game.players[i].get('e','1'))|| (target.get('e','2')&&!game.players[i].get('e','2'))|| (target.get('e','3')&&!game.players[i].get('e','3'))|| (target.get('e','4')&&!game.players[i].get('e','4'))|| (target.get('e','5')&&!game.players[i].get('e','5'))) return -ai.get.attitude(player,target); } } } return 0; } return -ai.get.attitude(player,target)*ai.get.attitude(player,ui.selected.targets[0]); }, multitarget:true, filterTarget:function(card,player,target){ if(ui.selected.targets.length){ var from=ui.selected.targets[0]; var judges=from.get('j'); for(var i=0;i0; } }, selectTarget:2, filterCard:lib.filter.cardDiscardable, prompt:'是否发动巧变跳过出牌阶段?', targetprompt:['被移走','移动目标'], check:check, target:target }); "step 1" if(!result.bool){ event.finish(); return; } trigger.untrigger(); trigger.finish(); player.discard(result.cards); player.logSkill('qiaobian',result.targets,false); player.line2(result.targets); event.targets=result.targets; "step 2" game.delay(); "step 3" if(targets.length==2){ player.choosePlayerCard('ej',function(button){ var player=_status.event.player; var targets0=_status.event.targets0; var targets1=_status.event.targets1; if(ai.get.attitude(player,targets0)>ai.get.attitude(player,targets1)){ return get.position(button.link)=='j'?10:0; } else{ if(get.position(button.link)=='j') return -10; return ai.get.equipValue(button.link); } },targets[0]).set('targets0',targets[0]).set('targets1',targets[1]).set('filterButton',function(button){ var targets1=_status.event.targets1; if(get.position(button.link)=='j'){ return !targets1.hasJudge(button.link.viewAs||button.link.name); } else{ return !targets1.num('e',{subtype:get.subtype(button.link)}); } }); } else{ event.finish(); } "step 4" if(result.bool){ var link=result.links[0]; if(get.position(link)=='e'){ event.targets[1].equip(link); } else if(link.viewAs){ event.targets[1].addJudge({name:link.viewAs},[link]); } else{ event.targets[1].addJudge(link); } event.targets[0].$give(link,event.targets[1]) game.delay(); } }, ai:{ expose:0.2 } }, qiaobian4:{ audio:2, trigger:{player:'phaseDiscardBefore'}, direct:true, filter:function(event,player){ return player.num('h')>0; }, content:function(){ "step 0" var discard=player.num('h')>player.hp; var next=player.chooseToDiscard('是否发动巧变跳过弃牌阶段?'); next.logSkill='qiaobian'; next.ai=function(card){ if(discard){ return 100-ai.get.useful(card); } else{ return -1; } }; "step 1" if(result.bool){ trigger.untrigger(); trigger.finish(); } } }, tuntian:{ audio:2, trigger:{player:'loseEnd'}, frequent:true, filter:function(event,player){ if(player==_status.currentPhase) return false; for(var i=0;i=0){ hasfriend=true;break; } } if(!hasfriend) return; if(get.tag(card,'respondSha')||get.tag(card,'respondShan')){ if(ai.get.attitude(player,target)>0&&card.name=='juedou') return; if(target.num('h')==0) return 2; return [0.5,target.num('h','sha')+target.num('h','shan')]; } } }, threaten:function(player,target){ if(target.num('h')==0) return 2; return 0.5; } } }, zaoxian:{ skillAnimation:true, audio:2, unique:true, trigger:{player:'phaseBegin'}, forced:true, filter:function(event,player){ if(player.storage.tuntian) return player.storage.tuntian.length>=3&&!player.storage.zaoxian; }, content:function(){ player.loseMaxHp(); player.addSkill('jixi'); player.storage.zaoxian=true; } }, jixi:{ audio:2, enable:'phaseUse', filter:function(event,player){ return player.storage.tuntian.length>0; }, chooseButton:{ dialog:function(event,player){ return ui.create.dialog('急袭',player.storage.tuntian,'hidden'); }, backup:function(links,player){ return { filterCard:function(){return false}, selectCard:-1, viewAs:{name:'shunshou'}, cards:links, onuse:function(result,player){ result.cards=lib.skill.jixi_backup.cards; var card=result.cards[0]; player.storage.tuntian.remove(card); player.syncStorage('tuntian'); if(!player.storage.tuntian.length){ player.unmarkSkill('tuntian'); } else{ player.markSkill('tuntian'); } player.logSkill('jixi',result.targets); } } }, prompt:function(links,player){ return '选择急袭的目标'; } }, ai:{ order:10, result:{ player:function(player){ return player.storage.tuntian.length-1; } } } }, jiang:{ audio:2, trigger:{player:['shaBefore','juedouBefore'],target:['shaBefore','juedouBefore']}, filter:function(event,player){ if(event.card.name=='juedou') return true; return get.color(event.card)=='red'; }, frequent:true, content:function(){ player.draw(); }, ai:{ effect:{ target:function(card,player,target){ if(card.name=='sha'&&get.color(card)=='red') return [1,0.6]; }, player:function(card,player,target){ if(card.name=='sha'&&get.color(card)=='red') return [1,1]; } } } }, hunzi:{ skillAnimation:true, audio:2, unique:true, trigger:{player:'phaseBegin'}, filter:function(event,player){ return player.hp==1; }, forced:true, priority:3, content:function(){ player.loseMaxHp(); player.addSkill('reyingzi'); player.addSkill('yinghun'); player.removeSkill('hunzi'); player.storage.hunzi=true; game.createTrigger('phaseBegin','yinghun',player,trigger); }, ai:{ threaten:function(player,target){ if(target.hp==1) return 2; return 0.5; }, maixie:true, effect:{ target:function(card,player,target){ var hasfriend=false; for(var i=0;i=0){ hasfriend=true;break; } } if(!hasfriend) return; if(get.tag(card,'damage')==1&&target.hp==2&&!target.isTurnedOver()&& _status.currentPhase!=target&&get.distance(_status.currentPhase,target,'absolute')<=3) return [0.5,1]; } } } }, hunzi2:{ unique:true, trigger:{player:'phaseBefore'}, filter:function(event,player){ return player.hp==1; }, forced:true, popup:false, content:function(){ player.addTempSkill('yinghun','phaseAfter'); }, }, zhiba:{ unique:true, global:'zhiba2', zhuSkill:true, }, zhiba2:{ audio:2, forceaudio:true, enable:'phaseUse', filter:function(event,player){ if(player.group!='wu'||player.num('h')==0) return false; return game.hasPlayer(function(target){ return target!=player&&target.hasZhuSkill('zhiba',player)&&target.num('h')>0; }); }, filterTarget:function(card,player,target){ return target!=player&&target.hasZhuSkill('zhiba',player)&&target.num('h')>0; }, usable:1, content:function(){ "step 0" if(target.storage.hunzi){ target.chooseBool('是否拒绝制霸拼点?').set('choice',ai.get.attitude(target,player)<=0); } else{ event.forced=true; } "step 1" if(!event.forced&&!result.bool){ game.log(target,'拒绝了拼点'); target.chat('拒绝'); event.finish(); return; } player.chooseToCompare(target,function(card){ if(card.name=='du') return 20; var player=get.owner(card); var target=_status.event.getParent().target; if(player!=target&&ai.get.attitude(player,target)>0){ return -get.number(card); } return get.number(card); }); "step 2" if(result.bool==false){ target.gain([result.player,result.target]); target.$gain2([result.player,result.target]); } }, ai:{ basic:{ order:1 }, expose:0.2, result:{ target:function(player,target){ if(player.num('h','du')&&ai.get.attitude(player,target)<0) return -1; if(player.num('h')<=player.hp) return 0; var maxnum=0; var cards2=target.get('h'); for(var i=0;imaxnum){ maxnum=cards2[i].number; } } if(maxnum>10) maxnum=10; if(maxnum<5&&cards2.length>1) maxnum=5; var cards=player.get('h'); for(var i=0;i0; }, filterCard:function(card){ return get.type(card)=='equip'; }, check:function(card){ var player=_status.currentPhase; if(player.num('he',{subtype:get.subtype(card)})>1){ return 11-ai.get.equipValue(card); } return 6-ai.get.value(card); }, filterTarget:function(card,player,target){ if(target.isMin()) return false; return player!=target&&!target.get('e',get.subtype(card)[5]); }, content:function(){ target.equip(cards[0]); player.draw(); }, discard:false, prepare:function(cards,player,targets){ player.$give(cards,targets[0],false); }, ai:{ basic:{ order:10 }, result:{ target:3, }, threaten:1.3 } }, guzheng:{ audio:2, unique:true, gainable:true, trigger:{global:'phaseDiscardEnd'}, filter:function(event,player){ if(event.player!=player&&event.player.classList.contains('dead')==false&& event.cards&&event.cards.length){ for(var i=0;i0){ if(du&&num<=3){ return false; } return true; } if(du) return true; return num>2; }, direct:true, content:function(){ "step 0" game.delay(); "step 1" event.cards=trigger.cards.slice(0); for(var i=0;iatt2&&att1>=0; }, content:function(){ "step 0" var next=player.chooseToDiscard('he',get.prompt('beige')); next.set('ai',ai.get.unuseful2); next.set('logSkill','beige'); "step 1" if(result.bool){ trigger.player.judge(); } else{ event.finish(); } "step 2" switch(get.suit(result.card)){ case 'heart':trigger.player.recover();break; case 'diamond':trigger.player.draw(2);break; case 'club':trigger.source.chooseToDiscard('he',2,true);break; case 'spade':trigger.source.turnOver();break; } }, ai:{ expose:0.3 } }, duanchang:{ audio:4, forbid:['boss'], trigger:{player:'dieBegin'}, forced:true, filter:function(event){ return event.source!=undefined; }, content:function(){ trigger.source.clearSkills(); }, ai:{ threaten:function(player,target){ if(target.hp==1) return 0.2; return 1.5; }, effect:{ target:function(card,player,target,current){ var hasfriend=false; for(var i=0;i=0){ hasfriend=true;break; } } if(!hasfriend) return; if(target.hp<=1&&get.tag(card,'damage')) return [1,0,0,-2]; } } } }, huashen:{ unique:true, forbid:['guozhan'], init:function(player){ player.storage.huashen={ list:[], owned:{}, player:player, } }, get:function(player,num){ if(typeof num!='number') num=1; while(num--){ var name=player.storage.huashen.list.randomRemove(); var skills=lib.character[name][3].slice(0); for(var i=0;i
【'+get.translation(skill)+ '】
'+lib.translate[skill+'_info']+'
'); } } }, mark:true }, huashen1:{ trigger:{global:['gameStart','phaseBefore']}, forced:true, popup:false, priority:10, filter:function(event,player){ return !player.storage.huasheninited; }, content:function(){ for(var i in lib.character){ if(i.indexOf('stone_')==0) continue; var add=false; for(var j=0;j0; }, content:function(){ for(var i=0;i=2; } return true; }, content:function(){ "step 0" trigger.untrigger(); trigger.finish(); event.cards=get.cards(player.maxHp-player.hp); player.showCards(event.cards); "step 1" var num=0; for(var i=0;i1; }, priority:5, content:function(){ "step 0" player.chooseToCompare(trigger.player); "step 1" if(result.bool&&trigger.player.num('he')){ player.gainPlayerCard(trigger.player,true,'he'); } } }, xingshang:{ audio:2, unique:true, gainable:true, trigger:{global:'dieEnd'}, priority:5, filter:function(event){ return event.playerCards&&event.playerCards.length>0 }, check:function(event){ for(var i=0;i0){ if(target.classList.contains('turnedover')) return 1000-target.num('h'); if(player.maxHp-player.hp<3) return -1; return 100-target.num('h'); } else{ if(target.classList.contains('turnedover')) return -1; if(player.maxHp-player.hp>=3) return -1; return 1+target.num('h'); } } "step 1" if(result.bool){ player.logSkill('fangzhu',result.targets); result.targets[0].draw(player.maxHp-player.hp); result.targets[0].turnOver(); } }, ai:{ maixie:true, effect:{ target:function(card,player,target){ if(get.tag(card,'damage')){ if(player.hasSkill('jueqing')) return [1,-2]; if(target.hp<=1) return; var hastarget=false; var hasfriend=false; var turnfriend=false; for(var i=0;i0&&game.players[i].isTurnedOver()){ hastarget=true; turnfriend=true; } if(game.players[i]!=target&&ai.get.attitude(game.players[i],target)>=0){ hasfriend=true; } } if(ai.get.attitude(player,target)>0&&!hastarget) return; if(!hasfriend) return; if(turnfriend||target.hp==target.maxHp) return [0.5,1]; if(target.hp>1) return [1,1]; } } } } }, songwei:{ unique:true, global:'songwei2', zhuSkill:true, }, songwei2:{ audio:2, forceaudio:true, trigger:{player:'judgeEnd'}, filter:function(event,player){ if(player.group!='wei') return false; if(get.color(event.result.card)!='black') return false; return game.hasPlayer(function(target){ return player!=target&&target.hasZhuSkill('songwei',player); }); }, direct:true, content:function(){ 'step 0' var list=[]; for(var i=0;i0); } else{ event.finish(); } 'step 2' if(result.bool){ player.logSkill('songwei',event.current); event.current.draw(); } event.goto(1); } }, duanliang:{ group:['duanliang1','duanliang2'], ai:{ threaten:1.2 } }, duanliang1:{ audio:2, enable:'chooseToUse', filterCard:function(card){ if(get.type(card)!='basic'&&get.type(card)!='equip') return false; return get.color(card)=='black'; }, filter:function(event,player){ return player.num('he',{type:['basic','equip'],color:'black'}) }, position:'he', viewAs:{name:'bingliang'}, prompt:'将一黑色的基本牌或装备牌当兵粮寸断使用', check:function(card){return 6-ai.get.value(card)}, ai:{ order:9 } }, duanliang2:{ mod:{ targetInRange:function(card,player,target){ if(card.name=='bingliang'){ if(get.distance(player,target)<=2) return true; } } } }, haoshi:{ audio:2, trigger:{player:'phaseDrawBegin'}, threaten:1.4, check:function(event,player){ if(player.num('h')<=1) return true; var min=[]; var temp=player.next.num('h'); for(var i=0;i0) return true; } return false; }, content:function(){ trigger.num+=2; player.addSkill('haoshi2'); }, ai:{ threaten:2, ai:{ noh:true, skillTagFilter:function(player,tag){ if(tag=='noh'){ if(player.num('h')!=2) return false; } } } } }, haoshi2:{ trigger:{player:'phaseDrawEnd'}, forced:true, popup:false, audio:false, content:function(){ "step 0" player.removeSkill('haoshi2'); if(player.num('h')<=5){ event.finish(); return; } var temp=player.next.num('h'); for(var i=0;i3) list.push(game.players[i]); } list.sort(function(a,b){ return a.num('h')-b.num('h'); }); if(list.length==0) return -1; var from=list[0]; list.length=0; for(var i=0;i=list[0].num('h')) return -1; for(var i=0;i=2) return -1; if(ui.selected.cards.length3) list.push(game.players[i]); } list.sort(function(a,b){ return a.num('h')-b.num('h'); }); if(target==list[0]) return ai.get.attitude(player,target); return -ai.get.attitude(player,target); } else{ var from=ui.selected.targets[0]; for(var i=0;i=list[0].num('h')) return -ai.get.attitude(player,target); for(var i=0;i=2) return -ai.get.attitude(player,target); if(target==list[i]) return ai.get.attitude(player,target); return -ai.get.attitude(player,target); } } } } } } }, yinghun:{ audio:2, audioname:['sunce'], trigger:{player:'phaseBegin'}, filter:function(event,player){ return player.hp0){ return 10+ai.get.attitude(_status.event.player,target); } if(player.maxHp-player.hp==1){ return -1; } return 1; }); "step 1" if(result.bool){ player.logSkill('yinghun',result.targets); event.target=result.targets[0]; player.chooseControl('yinghun_true','yinghun_false',function(event,player){ if(ai.get.attitude(player,event.target)>0) return 'yinghun_true'; return 'yinghun_false'; }) } else{ event.finish(); } "step 2" if(result.control=='yinghun_true'){ event.target.draw(player.maxHp-player.hp); event.target.chooseToDiscard(true,'he'); } else{ event.target.draw(); event.target.chooseToDiscard(player.maxHp-player.hp,true,'he'); } }, ai:{ threaten:function(player,target){ if(target.hp==1) return 2; if(target.hp==2) return 1.5; return 0.5; }, maixie:true, effect:{ target:function(card,player,target){ if(target.maxHp<=3) return; if(get.tag(card,'damage')){ if(target.hp==target.maxHp) return [0,1]; } if(get.tag(card,'recover')&&player.hp>=player.maxHp-1) return [0,0]; } } } }, jiuchi:{ audio:2, enable:'chooseToUse', filterCard:function(card){ return get.suit(card)=='spade'; }, viewAs:{name:'jiu'}, viewAsFilter:function(player){ if(!player.num('h',{suit:'spade'})) return false; }, prompt:'将一张黑桃手牌当酒使用', check:function(card){ if(_status.event.type=='dying') return 1; return 4-ai.get.value(card); }, ai:{ skillTagFilter:function(player){ return player.num('h',{suit:'spade'})>0&&player.hp<=0; }, threaten:1.5, save:true, } }, roulin:{ audio:2, trigger:{player:'shaBegin',target:'shaBegin'}, forced:true, filter:function(event,player){ if(event.directHit) return false; if(player==event.player){ return event.target.sex=='female'; } return event.player.sex=='female'; }, check:function(event,player){ return player==event.player; }, content:function(){ "step 0" var next=trigger.target.chooseToRespond({name:'shan'}); next.autochoose=lib.filter.autoRespondShan; next.ai=function(card){ if(trigger.target.num('h','shan')>1){ return ai.get.unuseful2(card); } return -1; }; "step 1" if(result.bool==false){ trigger.untrigger(); trigger.directHit=true; } } }, benghuai:{ audio:4, trigger:{player:'phaseEnd'}, forced:true, check:function(){ return false; }, filter:function(event,player){ for(var i=0;i0); } else{ event.finish(); } 'step 2' if(result.bool){ player.logSkill('baonue',event.current); player.judge(function(card){ if(get.suit(card)=='spade') return 4; return 0; }); } else{ event.goto(1); } 'step 3' if(result.suit=='spade'){ event.current.recover(); } event.goto(1); } }, luanwu:{ audio:2, unique:true, enable:'phaseUse', filter:function(event,player){ return !player.storage.luanwu; }, init:function(player){ player.storage.luanwu=false; }, mark:true, intro:{ content:'limited' }, skillAnimation:'epic', animationColor:'thunder', prepare:function(cards,player){ player.line(game.players); for(var i=0;i0) att=1; if(att<0) att=-1; if(game.players[i]!=player&&game.players[i].hp<=3){ if(game.players[i].num('h')==0) num+=att/game.players[i].hp; else if(game.players[i].num('h')==1) num+=att/2/game.players[i].hp; else if(game.players[i].num('h')==2) num+=att/4/game.players[i].hp; } if(game.players[i].hp==1) num+=att*1.5; } // console.log(num); if(player.hp==1){ return -num; } if(player.hp==2){ return -game.players.length/4-num; } return -game.players.length/3-num; } } } }, wansha:{ locked:true, global:'wansha2' }, wansha2:{ mod:{ cardSavable:function(card,player){ if(!_status.currentPhase) return; if(_status.currentPhase.get('s').contains('wansha')&&_status.currentPhase!=player){ if(card.name=='tao'&&_status.event.dying!=player) return false; } } } }, weimu:{ mod:{ targetEnabled:function(card){ if((get.type(card)=='trick'||get.type(card)=='delay')&& get.color(card)=='black') return false; } } }, huoji:{ audio:2, enable:'chooseToUse', filterCard:function(card){ return get.color(card)=='red'; }, viewAs:{name:'huogong',nature:'fire'}, viewAsFilter:function(player){ if(!player.num('h',{color:'red'})) return false; }, prompt:'将一张红色牌当火攻使用', check:function(card){ var player=_status.currentPhase; if(player.num('h')>player.hp){ return 6-ai.get.value(card); } return 4-ai.get.value(card) } }, bazhen:{ audio:2, inherit:'bagua_skill', filter:function(event,player){ if(!event.filterCard({name:'shan'})) return false; if(event.getParent().player.num('s','unequip')) return false; if(player.get('e','2')) return false; return true; }, ai:{ effect:{ target:function(card,player,target){ if(player==target&&get.subtype(card)=='equip2'){ if(ai.get.equipValue(card)<=8) return 0; } if(target.get('e','2')) return; if(player.hasSkill('unequip')) return; if(get.tag(card,'respondShan')) return [0.5,0]; } } } }, kanpo:{ audio:2, enable:'chooseToUse', filterCard:function(card){ return get.color(card)=='black'; }, viewAsFilter:function(player){ return player.num('h',{color:'black'})>0; }, viewAs:{name:'wuxie'}, prompt:'将一张黑色手牌当无懈可击使用', check:function(card){return 8-ai.get.value(card)}, threaten:1.2 }, lianhuan:{ group:['lianhuan1','lianhuan2'] }, lianhuan1:{ audio:2, enable:'phaseUse', filter:function(event,player){ return player.num('h',{suit:'club'})>0; }, filterCard:function(card){ return get.suit(card)=='club'; }, viewAs:{name:'tiesuo'}, prompt:'将一张梅花牌当铁锁连环使用', check:function(card){return 4-ai.get.value(card)} }, lianhuan2:{ audio:2, enable:'phaseUse', filter:function(event,player){ return player.num('h',{suit:'club'})>0; }, filterCard:function(card){ return get.suit(card)=='club'; }, check:function(card){ return 5-ai.get.useful(card); }, content:function(){ player.draw(); }, discard:false, prompt:'将要重铸的牌置于弃牌堆并摸一张牌', delay:0.5, prepare:function(cards,player){ player.$throw(cards,1000); }, ai:{ basic:{ order:1 }, result:{ player:1, }, } }, niepan:{ audio:2, unique:true, enable:'chooseToUse', mark:true, skillAnimation:true, animationStr:'涅盘', animationColor:'fire', init:function(player){ player.storage.niepan=false; }, filter:function(event,player){ if(event.type!='dying') return false; if(player!=event.dying) return false; if(player.storage.niepan) return false; return true; }, content:function(){ 'step 0' player.hp=Math.min(3,player.maxHp); player.discard(player.get('hej')); player.draw(3); player.unmarkSkill('niepan'); player.storage.niepan=true; 'step 1' if(player.isLinked()) player.link(); 'step 2' if(player.isTurnedOver()) player.turnOver(); }, ai:{ order:1, skillTagFilter:function(player){ if(player.storage.niepan) return false; if(player.hp>0) return false; }, save:true, result:{ player:10 }, threaten:function(player,target){ if(!target.storage.niepan) return 0.6; } }, intro:{ content:'limited' } }, quhu:{ audio:2, enable:'phaseUse', usable:1, filter:function(event,player){ if(player.num('h')==0) return false; for(var i=0;iplayer.hp&&game.players[i].num('h')) return true; } return false; }, filterTarget:function(card,player,target){ return target.hp>player.hp&&target.num('h')>0; }, content:function(){ "step 0" player.chooseToCompare(target); "step 1" if(result.bool){ if(game.hasPlayer(function(player){ return player!=target&&get.distance(target,player,'attack')<=1; })){ player.chooseTarget(function(card,player,target){ var source=_status.event.source; return target!=source&&get.distance(source,target,'attack')<=1; },true).set('ai',function(target){ return ai.get.damageEffect(target,_status.event.source,player); }).set('source',target); } else{ event.finish(); } } else{ player.damage(target); event.finish(); } "step 2" if(result.bool&&result.targets&&result.targets.length){ target.line(result.targets[0],'green'); result.targets[0].damage(target); } }, ai:{ order:0.5, result:{ target:function(player,target){ var att=ai.get.attitude(player,target); var oc=(target.num('h')==1); if(att>0&&oc) return 0; for(var i=0;i0){ return att>0?att/2:att-(oc?5:0); } } } return 0; }, player:function(player,target){ if(target.hasSkill('jueqing')) return -10; var mn=1; var hs=player.get('h'); for(var i=0;i2){ max=Math.max(Math.min(5,game.players[i].hp)-game.players[i].num('h'),max); } } switch(max){ case 0:return mn==13?0:-20; case 1:return mn>=12?0:-15; case 2:return 0; case 3:return 1; default:return max; } } }, expose:0.2 } }, jieming:{ audio:2, trigger:{player:'damageEnd'}, direct:true, filter:function(event,player){ return event.num>0 }, content:function(){ "step 0" player.chooseTarget(get.prompt('jieming'),[1,trigger.num],function(card,player,target){ return target.num('h')2){ return Math.min(5,target.maxHp)-target.num('h'); } return att/3; }); "step 1" if(result.bool){ player.logSkill('jieming',result.targets); for(var i=0;i1){ if(player.hasSkill('jueqing')) return [1,-2]; var max=0; for(var i=0;i0){ max=Math.max(Math.min(5,game.players[i].hp)-game.players[i].num('h'),max); } } switch(max){ case 0:return 2; case 1:return 1.5; case 2:return [1,2]; default:return [0,max]; } } if((card.name=='tao'||card.name=='caoyao')&& target.hp>1&&target.num('h')<=target.hp) return [0,0]; } }, } }, qiangxi:{ audio:2, enable:'phaseUse', usable:1, filterCard:function(card){ return get.subtype(card)=='equip1'; }, selectCard:[0,1], filterTarget:function(card,player,target){ if(player==target) return false; return get.distance(player,target,'attack')<=1; }, content:function(){ "step 0" if(cards.length==0){ player.loseHp(); } "step 1" target.damage(); }, check:function(card){ return 10-ai.get.value(card); }, position:'he', ai:{ order:8, result:{ player:function(player,target){ if(player.get('e','1')) return 0; if(player.hp>=target.hp) return -0.9; if(player.hp<=2) return -10; return -2; }, target:function(player,target){ if(!player.get('e','1')){ if(player.hp<2) return 0; if(player.hp==2&&target.hp>=2) return 0; if(target.hp>player.hp) return 0; } return ai.get.damageEffect(target,player); } } }, threaten:1.3 }, tianyi:{ audio:2, enable:'phaseUse', usable:1, filterTarget:function(card,player,target){ return player!=target&&target.num('h')>0; }, filter:function(event,player){ return player.num('h')>0; }, content:function(){ "step 0" player.chooseToCompare(target); "step 1" if(result.bool){ player.addTempSkill('tianyi2','phaseAfter'); } else{ player.addTempSkill('tianyi3','phaseAfter'); } }, ai:{ order:function(name,player){ var cards=player.get('h'); if(player.num('h','sha')==0){ return 1; } for(var i=0;i11&&ai.get.value(cards[i])<7){ return 9; } } return lib.card.sha.ai.order-1; }, result:{ player:function(player){ if(player.num('h','sha')>0) return 0.6; var num=player.num('h'); if(num>player.hp) return 0; if(num==1) return -2; if(num==2) return -1; return -0.7; }, target:function(player,target){ var num=target.num('h'); if(num==1) return -1; if(num==2) return -0.7; return -0.5 }, }, threaten:1.3 } }, tianyi2:{ mod:{ targetInRange:function(card,player,target,now){ if(card.name=='sha') return true; }, selectTarget:function(card,player,range){ if(card.name=='sha'&&range[1]!=-1) range[1]++; }, cardUsable:function(card,player,num){ if(card.name=='sha') return num+1; } }, }, tianyi3:{ mod:{ cardEnabled:function(card){if(card.name=='sha') return false} } }, shuangxiong:{ audio:true, trigger:{player:'phaseDrawBefore'}, check:function(event,player){ if(player.num('h')>player.hp) return true; if(player.num('h')>3) return true; return false; }, content:function(){ "step 0" player.judge(ui.special); "step 1" player.gain(result.card); player.$gain2(result.card); player.addTempSkill('shuangxiong2','phaseAfter'); player.storage.shuangxiong=get.color(result.card); trigger.untrigger(); trigger.finish(); } }, shuangxiong2:{ audio:true, enable:'phaseUse', viewAs:{name:'juedou'}, filterCard:function(card,player){ return get.color(card)!=player.storage.shuangxiong; }, check:function(card){ return 6-ai.get.value(card); }, ai:{ basic:{ order:10 } } }, luanji:{ audio:2, enable:'phaseUse', viewAs:{name:'wanjian'}, filterCard:function(card,player){ if(ui.selected.cards.length){ return get.suit(card)==get.suit(ui.selected.cards[0]); } var cards=player.get('h'); for(var i=0;i0; }, check:function(event,player){ return ai.get.attitude(player,event.target)<0; }, content:function(){ player.discardPlayerCard('he',trigger.target,true); } }, jiewei:{ trigger:{player:'turnOverEnd'}, direct:true, audio:2, content:function(){ 'step 0' player.chooseToUse(function(card){ if(!lib.filter.cardEnabled(card,_status.event.player,_status.event)){ return false; } var type=get.type(card,'trick'); return type=='trick'||type=='equip'; },'是否使用一张锦囊牌或装备牌?').set('logSkill','jiewei'); 'step 1' if(result.bool){ var goon=false; var type=get.type(result.card||result.cards[0]); for(var i=0;i0; } else{ return target.num('j')>0; } }); next.set('ai',function(target){ if(type=='equip'){ return -ai.get.attitude(player,target); } else{ return ai.get.attitude(player,target); } }); next.set('type',type); event.type=type; } else{ event.finish(); } } else{ event.finish(); } 'step 2' if(event.type&&result.bool&&result.targets&&result.targets.length){ player.line(result.targets,'green'); if(event.type=='equip'){ player.discardPlayerCard(result.targets[0],'e',true); } else{ player.discardPlayerCard(result.targets[0],'j',true); } } } }, releiji:{ audio:2, trigger:{player:'respond'}, filter:function(event,player){ return event.card.name=='shan'; }, direct:true, content:function(){ "step 0"; player.chooseTarget(get.prompt('releiji')).ai=function(target){ if(target.hasSkill('hongyan')) return 0; return ai.get.damageEffect(target,_status.event.player,_status.event.player,'thunder'); }; "step 1" if(result.bool){ player.logSkill('releiji',result.targets,'thunder'); event.target=result.targets[0]; event.target.judge(function(card){ var suit=get.suit(card); if(suit=='spade') return -4; if(suit=='club') return -2; return 0; }); } else{ event.finish(); } "step 2" if(result.suit=='club'){ event.target.damage('thunder'); player.recover(); } else if(result.suit=='spade'){ event.target.damage(2,'thunder'); } }, ai:{ effect:{ target:function(card,player,target,current){ if(get.tag(card,'respondShan')){ var hastarget=false; for(var i=0;i2){ if(!target.hasSkill('guidao')) return 0; return [0,hastarget?target.num('h')/4:0]; } if(target.num('h')>3||(be&&target.num('h')>=2)){ return [0,0]; } if(target.num('h')==0){ return [1.5,0]; } if(target.num('h')==1&&!be){ return [1.2,0]; } if(!target.hasSkill('guidao')) return [1,0.05]; return [1,Math.min(0.5,(target.num('h')+be)/4)]; } } } } }, shensu:{ group:['shensu1','shensu2'] }, shensu1:{ audio:2, trigger:{player:'phaseBegin'}, direct:true, content:function(){ "step 0" player.addSkill('shensu3'); var check= player.num('h')>2; player.chooseTarget(get.prompt('shensu'),function(card,player,target){ if(player==target) return false; return player.canUse({name:'sha'},target); }).ai=function(target){ if(!check) return 0; return ai.get.effect(target,{name:'sha'},_status.event.player); } "step 1" if(result.bool){ player.logSkill('shensu1',result.targets); player.useCard({name:'sha'},result.targets[0],false); player.skip('phaseJudge'); player.skip('phaseDraw'); } player.removeSkill('shensu3'); } }, shensu2:{ audio:2, trigger:{player:'phaseUseBefore'}, direct:true, filter:function(event,player){ return player.num('he',{type:'equip'})>0; }, content:function(){ "step 0" player.addSkill('shensu3'); var check=player.num('h')<=player.hp; player.chooseCardTarget({ prompt:get.prompt('shensu'), filterCard:function(card,player){ return get.type(card)=='equip'&&lib.filter.cardDiscardable(card,player) }, position:'he', filterTarget:function(card,player,target){ if(player==target) return false; return player.canUse({name:'sha'},target); }, ai1:function(card){ if(!_status.event.check) return 0; return 6-ai.get.value(card); }, ai2:function(target){ if(!_status.event.check) return 0; return ai.get.effect(target,{name:'sha'},_status.event.player); }, check:check }); "step 1" if(result.bool){ player.logSkill('shensu2',result.targets); player.discard(result.cards[0]); player.useCard({name:'sha'},result.targets[0]); trigger.untrigger(); trigger.finish(); } player.removeSkill('shensu3'); } }, shensu3:{ mod:{ targetInRange:function(card,player,target,now){ return true; } }, }, jushou:{ audio:true, trigger:{player:'phaseEnd'}, content:function(){ player.draw(3); player.turnOver(); }, ai:{ effect:{ target:function(card,player,target){ if(card.name=='guiyoujie') return [0,1]; } } }, }, liegong:{ audio:2, trigger:{player:'shaBegin'}, check:function(event,player){ return ai.get.attitude(player,event.target)<=0; }, filter:function(event,player){ var length=event.target.num('h'); return (length>=player.hp||length<=get.attackRange(player)); }, content:function(){ trigger.directHit=true; } }, kuanggu:{ audio:2, trigger:{source:'damageEnd'}, forced:true, filter:function(event,player){ return get.distance(player,event.player)<=1; }, content:function(){ player.recover(trigger.num); } }, tianxiang:{ audio:2, trigger:{player:'damageBefore'}, direct:true, filter:function(event,player){ return player.num('h',{suit:'heart'})>0&&event.num>0; }, content:function(){ "step 0" player.chooseCardTarget({ filterCard:function(card,player){ return get.suit(card)=='heart'&&lib.filter.cardDiscardable(card,player); }, filterTarget:function(card,player,target){ return player!=target; }, ai1:function(card){ return 10-ai.get.value(card); }, ai2:function(target){ var att=ai.get.attitude(_status.event.player,target); var trigger=_status.event.getTrigger(); var da=0; if(_status.event.player.hp==1){ da=10; } if(trigger.num>1){ if(target.maxHp>5&&target.hp>1) return -att/10+da; return -att+da; } var eff=ai.get.damageEffect(target,trigger.source,target,trigger.nature); if(att==0) return 0.1+da; if(eff>=0&&trigger.num==1){ return att+da; } if(target.hp==target.maxHp) return -att+da; if(target.hp==1){ if(target.maxHp<=4&&!target.hasSkillTag('maixie')){ if(target.maxHp<=3){ return -att+da; } return -att/2+da; } return da; } if(target.hp==target.maxHp-1){ if(target.hp>2||target.hasSkillTag('maixie')) return att/5+da; if(att>0) return 0.02+da; return 0.05+da; } return att/2+da; }, prompt:'天香:弃置一张红桃牌转移伤害' }); "step 1" if(result.bool){ player.logSkill('tianxiang',result.targets); trigger.untrigger(); trigger.player=result.targets[0]; trigger.player.addSkill('tianxiang2'); player.discard(result.cards[0]); } else{ event.finish(); } "step 2" trigger.trigger('damageBefore'); }, ai:{ effect:{ target:function(card,player,target){ if(player.hasSkill('jueqing')) return; if(get.tag(card,'damage')&&target.num('h')>1) return 0.7; } }, threaten:function(player,target){ if(target.num('h')==0) return 2; } } }, tianxiang2:{ trigger:{player:['damageAfter','damageCancelled']}, forced:true, popup:false, audio:false, content:function(){ if(player.hp0&&player.hp<=0}, content:function(){ "step 0" event.card=get.cards()[0]; if(player.storage.buqu==undefined) player.storage.buqu=[]; player.storage.buqu.push(event.card); player.syncStorage('buqu'); player.showCards(player.storage.buqu,'不屈') player.markSkill('buqu'); "step 1" for(var i=0;i2; }, content:function(){ "step 0" player.line(trigger.player,'green'); player.loseHp(); "step 1" trigger.player.draw(2); }, }, leiji:{ audio:2, trigger:{player:'respond'}, filter:function(event,player){ return event.card.name=='shan'; }, direct:true, content:function(){ "step 0"; player.chooseTarget(get.prompt('leiji')).ai=function(target){ if(target.hasSkill('hongyan')) return 0; return ai.get.damageEffect(target,_status.event.player,_status.event.player,'thunder'); }; "step 1" if(result.bool){ player.logSkill('leiji',result.targets,'thunder'); event.target=result.targets[0]; event.target.judge(function(card){ if(get.suit(card)=='spade') return -4; return 0; }); } else{ event.finish(); } "step 2" if(result.bool==false){ event.target.damage(2,'thunder'); } }, ai:{ mingzhi:false, effect:{ target:function(card,player,target,current){ if(get.tag(card,'respondShan')){ var hastarget=false; for(var i=0;i0; }, direct:true, content:function(){ "step 0" player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+ get.translation(trigger.player.judging[0])+','+get.prompt('guidao'),'he',function(card){ return get.color(card)=='black'; }).set('ai',function(card){ var trigger=_status.event.getTrigger(); var player=_status.event.player; var judging=_status.event.judging; var result=trigger.judge(card)-trigger.judge(judging); var attitude=ai.get.attitude(player,trigger.player); if(attitude==0||result==0) return 0; if(attitude>0){ return result; } else{ return -result; } }).set('judging',trigger.player.judging[0]); "step 1" if(result.bool){ player.respond(result.cards,'highlight'); } else{ event.finish(); } "step 2" if(result.bool){ player.logSkill('guidao'); player.$gain2(trigger.player.judging[0]); player.gain(trigger.player.judging[0]); trigger.player.judging[0]=result.cards[0]; if(!get.owner(result.cards[0],'judge')){ trigger.position.appendChild(result.cards[0]); } game.log(trigger.player,'的判定牌改为',result.cards[0]); } "step 3" game.delay(2); }, ai:{ tag:{ rejudge:1 } } }, guhuo:{ enable:'phaseUse', usable:1, audio:2, filter:function(event,player){ return player.num('h')>0 }, chooseButton:{ dialog:function(){ var list=['sha','tao','jiu','taoyuan','wugu','juedou','huogong','jiedao','tiesuo','guohe','shunshou','wuzhong','wanjian','nanman']; for(var i=0;i=3&&player.hp>=3) return 0; for(var i=0;i