'use strict'; game.import('character',function(lib,game,ui,get,ai,_status){ return { name:'tw', connect:true, characterSort:{ tw:{ tw_mobile:['tw_beimihu','nashime'], tw_yijiang:['tw_caoang','tw_caohong','tw_zumao','tw_dingfeng','tw_maliang','tw_xiahouba'], tw_english:['kaisa'], }, }, character:{ tw_beimihu:['female','qun',3,['zongkui','guju','baijia','bingzhao'],['zhu']], nashime:['male','qun',3,['chijie','waishi','renshe']], tw_xiahouba:['male','shu',4,['twyanqin','twbaobian']], tw_zumao:['male','wu',4,['twtijin']], tw_caoang:['male','wei',4,['twxiaolian']], tw_dingfeng:['male','wu',4,['twqijia','twzhuchen']], tw_caohong:['male','wei',4,['twhuzhu','twliancai']], tw_maliang:['male','shu',3,['twrangyi','twbaimei']], kaisa:["male","western",4,["zhengfu"]], }, characterIntro:{ nashime:'难升米(なしめ,或なんしょうまい)是倭国大夫。景初二年六月,受女王卑弥呼之命,与都市牛利出使魏国,被魏国拜为率善中郎将。', }, card:{ }, characterFilter:{ nashime:function(mode){ return mode!='guozhan'; }, tw_xiahouba:function(mode){ return mode!='guozhan'; }, }, skill:{ twrangyi:{ audio:2, enable:'phaseUse', usable:1, filter:function(event,player){ return player.countCards('h')>0; }, filterTarget:lib.filter.notMe, delay:0, content:function(){ 'step 0' event.cards=player.getCards('h'); target.gain(event.cards,player,'giveAuto').gaintag.add('twrangyi'); target.addTempSkill('twrangyi2'); 'step 1' target.chooseToUse({ prompt:'请使用得到的一张牌,或者受到来自'+get.translation(player)+'的一点伤害', filterCard:function(card,player){ if(get.itemtype(card)!='card'||!card.hasGaintag('twrangyi')) return false; return lib.filter.filterCard(card,player,event); }, cards:cards, }); 'step 2' target.removeSkill('twrangyi'); if(!result.bool) target.damage('nocard'); }, ai:{ order:1, result:{ target:function(player,target){ var hs=player.getCards('h'); for(var i=0;i0; }, content:function(){ var cards=player.getCards('h',function(card){ return card.hasGaintag('twrangyi'); }); trigger.getParent(2).player.gain(cards,player,'giveAuto'); }, onremove:function(player){ player.removeGaintag('twrangyi'); }, }, twbaimei:{ audio:2, trigger:{ player:"damageBegin4", }, forced:true, filter:function(event,player){ if(player.countCards('h')) return false; if(event.nature) return true; return get.type(event.card,'trick')=='trick'; }, content:function(){ trigger.cancel(); }, ai:{ effect:{ target:function(card,player,target,current){ if(target.countCards('h')) return; if(get.tag(card,'natureDamage')) return 'zerotarget'; if(get.type(card)=='trick'&&get.tag(card,'damage')){ return 'zeroplayertarget'; } }, }, }, }, twhuzhu:{ audio:2, enable:'phaseUse', usable:1, filter:function(e,player){ return player.countCards('e')>0; }, filterTarget:function(card,player,target){ return target!=player&&target.countCards('h')>0 }, content:function(){ 'step 0' target.chooseCard('交给'+get.translation(player)+'一张手牌','h',true); 'step 1' target.give(result.cards,player); 'step 2' if(player.countGainableCards(player,'e')) target.gainPlayerCard(player,'e',true); 'step 3' if(target.isDamaged()&&target.hp<=player.hp){ player.chooseBool('是否令'+get.translation(target)+'回复1点体力?').set('ai',function(){ return get.recoverEffect(target,player,player); }); } 'step 4' if(result.bool) target.recover(); }, ai:{ order:8, result:{ target:function(player,target){ var eff=(target.isDamaged()&&target.hp<=player.hp)?get.recoverEffect(target,player,target):0; if(eff<=0&&!player.countGainableCards(target,'e')) return -1; return eff; }, }, }, }, twliancai:{ audio:2, trigger:{player:['turnOverEnd','phaseJieshuBegin']}, filter:function(card,player,target){ return target=='phaseJieshuBegin'||player.countCards('h')0; }, check:function(card,player){ if(card.name=='turnOver') return true; if(player.isTurnedOver()) return true; if(player.hp-player.countCards('h')>1) return true; return game.hasPlayer(function(current){ return lib.skill.twliancai.filterTarget(null,player,current)&&lib.skill.twliancai.filterAI(current); }); }, filterAI:function(target){ var player=_status.event.player; var att=get.attitude(player,target); if(target.isDamaged()&&target.countCards('e','baiyin')&&att>0) return 2*att; return -att; }, prompt2:function(card,player,target){ return card.name=='phaseJieshu'?'将武将牌翻面,然后获得一名其他角色装备区内的一张牌':'将手牌摸至与体力值相同'; }, content:function(){ 'step 0' if(event.triggername=='phaseJieshuBegin') player.turnOver(); else{ player.draw(player.hp-player.countCards('h')); event.finish(); } 'step 1' player.chooseTarget('获得一名角色装备区内的一张牌',lib.skill.twliancai.filterTarget).ai=lib.skill.twliancai.filterAI; 'step 2' if(result.bool){ player.line(result.targets,'thunder'); player.gainPlayerCard('e',true,result.targets[0]); } }, }, twqijia:{ //group:'twqijia_alka', audio:2, enable:'phaseUse', filter:function(event,player){ return player.countCards('e',function(card){ return !player.getStorage('twqijia_alka').contains(get.subtype(card)); }); }, filterTarget:function(card,player,target){ return target!=player&&player.canUse({name:'sha'},target); }, position:'e', filterCard:function(card,player){ return !player.getStorage('twqijia_alka').contains(get.subtype(card)); }, content:function(){ 'step 0' player.addTempSkill('twqijia_alka'); player.storage.twqijia_alka.push(get.subtype(cards[0])); player.useCard({name:'sha'},target,false); }, subSkill:{ alka:{ charlotte:true, onremove:function(player){ delete player.storage.twqijia_alka; delete player.storage.twzhuchen; player.unmarkSkill('twzhuchen'); }, init:function(player,skill){ if(!player.storage[skill]) player.storage[skill]=[]; if(!player.storage.twzhuchen) player.storage.twzhuchen=[]; }, mod:{ globalFrom:function(from,to,distance){ if(from.storage.twzhuchen&&from.storage.twzhuchen.contains(to)) return -Infinity; } }, }, }, check:function(card){ return 7-get.value(card); }, ai:{ order:function(){ return get.order({name:'sha'})-0.2; }, result:{ target:function(player,target){ return get.effect(target,{name:'sha'},player,player); }, }, }, }, twzhuchen:{ enable:'phaseUse', filter:function(event,player){ return player.countCards('h',lib.skill.twzhuchen.filterCard)>0; }, filterCard:function(card,player){ var name=get.name(card,player); return name=='tao'||name=='jiu'; }, filterTarget:lib.filter.notMe, content:function(){ player.addTempSkill('twqijia_alka'); player.storage.twzhuchen.add(target); player.markSkill('twzhuchen'); }, intro:{ content:function(content,player){ return '至'+get.translation(content)+'的距离视为1'; }, }, }, twxiaolian:{ audio:2, trigger:{global:'useCardToTarget'}, logTarget:'target', filter:function(event,player){ return event.card&&event.card.name=='sha'&&event.player!=player&& event.targets.length==1&&event.targets[0]!=player; }, check:function(event,player){ return get.effect(event.targets[0],event.card,event.player,player)<=get.effect(player,event.card,event.player,player); }, content:function(){ trigger.getParent().twxiaolian=trigger.targets[0]; trigger.targets.length=0; trigger.getParent().triggeredTargets2.length=0; trigger.targets.push(player); }, group:'twxiaolian_damage', subSkill:{ distance:{ sub:true, charlotte:true, init:function(player,skill){ if(!player.storage[skill]) player.storage[skill]=[]; }, mark:true, marktext:'马', intro:{ content:'cards', onunmark:'throw', }, mod:{ globalTo:function(from,to,distance){ if(from!=to&&to.storage.twxiaolian_distance) return distance+to.storage.twxiaolian_distance.length; }, }, }, damage:{ sub:true, trigger:{player:'damageEnd'}, direct:true, filter:function(event,player){ return event.getParent(2).twxiaolian!=undefined; }, content:function(){ 'step 0' var target=trigger.getParent(2).twxiaolian; event.target=target; player.chooseCard('是否将一张牌当做【马】置于'+get.translation(target)+'的武将牌旁?','he').ai=function(card){ if(get.attitude(_status.event.player,_status.event.getParent('twxiaolian_damage').target)>2) return 7-get.value(card); return 0; }; 'step 1' if(result.bool){ player.logSkill('twxiaolian',target); player.lose(result.cards,ui.special,'toStorage'); target.addSkill('twxiaolian_distance'); target.storage.twxiaolian_distance.addArray(result.cards); target.markSkill('twxiaolian_distance'); } }, }, }, }, twtijin:{ audio:2, trigger:{global:'useCardToPlayer'}, filter:function(event,player){ return event.card&&event.card.name=='sha'&&event.player!=player&&event.target!=player&& event.targets.length==1&&event.player.inRange(player); }, logTarget:'target', check:function(event,player){ return get.effect(event.targets[0],event.card,event.player,player)<=get.effect(player,event.card,event.player,player); }, content:function(){ 'step 0' trigger.targets.length=0; trigger.getParent().triggeredTargets1.length=0; trigger.targets.push(player); var next=game.createEvent('twtijin_discard',null,trigger.getParent(2)); next.player=player; next.target=trigger.player; next.setContent(function(){ if(target.isDead()||!target.countCards('he')) return; player.line(target,'green'); player.discardPlayerCard(target,true,'he'); }); }, }, twyanqin:{ forbid:['guozhan'], audio:2, trigger:{player:'phaseBegin'}, direct:true, content:function(){ 'step 0' var list=[]; if(player.group!='wei') list.push('wei2'); if(player.group!='shu') list.push('shu2'); list.push('cancel2'); player.chooseControl(list).set('ai',function(){ return list.randomGet(); }).set('prompt',get.prompt2('twyanqin')); 'step 1' if(result.control!='cancel2'){ player.logSkill('twyanqin'); var group=result.control.slice(0,3); player.changeGroup(group); } }, }, twbaobian:{ audio:2, trigger:{source:'damageBegin2'}, filter:function(event,player){ var card=event.card; if(!card||(card.name!='sha'&&card.name!='juedou')) return false; return event.player.group==player.group||event.player.countCards('h')>event.player.hp }, check:function(event,player){ var att=get.attitude(player,event.player); if(event.player.group==player.group) return att>0; return att<0; }, logTarget:'player', content:function(){ var target=trigger.player; if(target.group==player.group){ trigger.cancel(); var num=target.maxHp-target.countCards('h'); if(num) target.draw(num); } else{ player.discardPlayerCard(target,'h',true,target.countCards('h')-target.hp) } }, }, renshe:{ audio:2, trigger:{player:'damageEnd'}, direct:true, content:function(){ 'step 0' var choiceList=['令一名其他角色与你各摸一张牌','令自己下个出牌阶段可以多发动一次【外使】']; if(lib.skill.chijie.filter&&lib.skill.chijie.filter({},player)) choiceList.push('将自己的势力变更为场上存在的一个其他势力'); player.chooseControl('cancel2').set('prompt',get.prompt('renshe')).set('choiceList',choiceList).set('ai',function(){ if(game.hasPlayer(function(current){ return get.attitude(player,current)>0||current.hasSkillTag('nogain'); })) return 0; return 1; }); 'step 1' if(result.control=='cancel2') event.finish(); else{ event.index=result.index; player.logSkill('renshe'); if(event.index==0){ player.chooseTarget('请选择一名角色,与其各摸一张牌',lib.filter.notMe,true).ai=function(target){ if(target.hasSkillTag('nogain')) return 0.1; return get.attitude(_status.event.player,target); }; } else if(result.index==1){ player.storage.waishi++; event.finish(); } else{ var next=game.createEvent('renshe_changeGroup'); next.player=player; next.renshe=true; next.setContent(lib.skill.chijie.content); event.finish(); } } 'step 2' if(result.bool){ player.line(result.targets[0],'green'); game.asyncDraw([player,result.targets[0]].sortBySeat()); } else event.finish(); 'step 3' game.delay(); }, }, waishi:{ audio:2, group:'waishi_afterstory', subSkill:{ afterstory:{ trigger:{player:'phaseUseEnd'}, forced:true, silent:true, popup:false, content:function(){player.storage.waishi=1}, }, }, init:function(player,skill){ player.storage[skill]=1; }, enable:'phaseUse', filter:function(event,player){ return typeof player.storage.waishi!='number'||player.storage.waishi>0; }, filterTarget:function(card,player,target){ return target!=player&&target.countCards('h')>=ui.selected.cards.length; }, filterCard:true, position:'he', check:function(card){ if(!game.hasPlayer(function(current){ return current!=_status.event.player&¤t.countCards('h')>ui.selected.cards.length; })) return 0; return 6-get.value(card); }, selectCard:function(){ if(!ui.selected.targets.length) return [1,game.countGroup()]; return [1,Math.min(ui.selected.targets[0].countCards('h'),game.countGroup())]; }, discard:false, lose:false, delay:0, content:function(){ 'step 0' if(typeof player.storage.waishi!='number') player.storage.waishi=1; player.storage.waishi--; player.lose(cards,ui.special); player.choosePlayerCard(target,true,'h',cards.length).chooseonly=true; 'step 1' event.cards2=result.cards; target.lose(event.cards2,ui.special); 'step 2' player.gain(event.cards2); target.gain(cards); player.$give(cards.length,target); target.$give(event.cards2.length,player); 'step 3' game.delay(1.2); 'step 4' if(target.countCards('h')>player.countCards('h')||player.group==target.group) player.draw(); }, ai:{ result:{ player:function(player,target){ if(player.countCards('h')