diff --git a/character/huicui.js b/character/huicui.js index 2a0d86b01..ace0bb41f 100644 --- a/character/huicui.js +++ b/character/huicui.js @@ -127,32 +127,32 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, async content(event,trigger,player){ await player.showHandcards(get.translation(player)+'发动了【抚黎】'); + const getNum=(type)=>{ + let num=['basic','trick','equip'].indexOf(type); + if(num===-1) num=3; + return num; + }; const types=player.getDiscardableCards(player,'h').filter(card=>{ return !player.getStorage('dcfuli').includes(get.type2(card)); }).reduce((list,card)=>list.add(get.type2(card)),[]).sort((a,b)=>{ - const getNum=(type)=>{ - let num=['basic','trick','equip'].indexOf(type); - if(num==-1) num=3; - return num; - }; return getNum(a)-getNum(b); }); if(types.length){ const {result:{control}}=await player.chooseControl(types).set('ai',()=>{ const player=get.event('player'),types=get.event('controls').slice(); - return types.sort((a,b)=>{ - const getNum=(type)=>{ - const cards=player.getDiscardableCards(player,'h').filter(card=>get.type2(card)==type); - const countCards=(target,player,cards)=>{ - return target.countCards('h')-(target==player?cards.length:0); - }; - const max=game.findPlayer(target=>{ - return !game.hasPlayer(target2=>{ - return countCards(target2,player,cards)>countCards(target,player,cards); - }); - }).countCards('h'); - return Math.min(max,cards.reduce((sum,card)=>sum+get.cardNameLength(card),0))/cards.length; + const getNum=(type)=>{ + const cards=player.getDiscardableCards(player,'h').filter(card=>get.type2(card)==type); + const countCards=(target,player,cards)=>{ + return target.countCards('h')-(target==player?cards.length:0); }; + const max=game.findPlayer(target=>{ + return !game.hasPlayer(target2=>{ + return countCards(target2,player,cards)>countCards(target,player,cards); + }); + }).countCards('h'); + return Math.min(max,cards.reduce((sum,card)=>sum+get.cardNameLength(card),0))/cards.length; + }; + return types.sort((a,b)=>{ return getNum(b)-getNum(a); })[0]; }).set('prompt','弃置一种类别的所有手牌,然后摸这些牌的名字字数之和的牌'); @@ -177,7 +177,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.line(target); target.addSkill('dcfuli_range'); target.addMark('dcfuli_range',1,false); - player.when('phaseBegin').then(()=>{ + player.when(['phaseBegin','dieBegin']).then(()=>{ target.removeMark('dcfuli_range',1,false); if(!target.hasMark('dcfuli_range')) target.removeSkill('dcfuli_range'); }).vars({target:target}); @@ -226,12 +226,19 @@ game.import('character',function(lib,game,ui,get,ai,_status){ forced:true, async content(event,trigger,player){ const list=lib.inpile.filter(name=>{ - if(name=='shandian') return false; + if(get.type(name)==='delay') return false; const card=new lib.element.VCard({name:name}); return get.tag(card,'damage')&&player.hasUseTarget(card); }); if(list.length){ - const {result:{bool,links}}=await player.chooseButton(['###德化###