From 3fb178ed3ad16921d89a591a74f0a0d3c394792f Mon Sep 17 00:00:00 2001 From: mengxinzxz <2223529500@qq.com> Date: Tue, 6 Feb 2024 10:31:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DOL=E6=B7=B3=E4=BA=8E=E7=90=BC?= =?UTF-8?q?=E3=80=90=E5=AE=BF=E5=AE=88=E3=80=91=E5=8F=AA=E8=83=BD=E4=BA=A4?= =?UTF-8?q?=E8=A3=85=E5=A4=87=E7=89=8C=E7=9A=84bug=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96OL=E6=B7=B3=E4=BA=8E=E7=90=BC=E3=80=90=E5=AE=BF?= =?UTF-8?q?=E5=AE=88=E3=80=91=E5=92=8C=E5=8D=81=E5=91=A8=E5=B9=B4=E6=B7=B3?= =?UTF-8?q?=E4=BA=8E=E7=90=BC=E3=80=90=E7=B2=AE=E8=90=A5=E3=80=91=E7=9A=84?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/huicui.js | 121 ++++++++++++++++++-------------------------- character/sp2.js | 85 ++++++++++++++----------------- 2 files changed, 86 insertions(+), 120 deletions(-) diff --git a/character/huicui.js b/character/huicui.js index 5034fee81..1a7bc1787 100644 --- a/character/huicui.js +++ b/character/huicui.js @@ -11004,83 +11004,58 @@ game.import('character',function(lib,game,ui,get,ai,_status){ reliangying:{ audio:2, trigger:{player:'phaseDiscardBegin'}, + filter(event,player){ + return player.hasMark('recangchu'); + }, direct:true, - content:function(){ - 'step 0' - var map={}; - var list=[]; - for(var i=1;i<=player.countMark('recangchu');i++){ - var cn=get.cnNumber(i,true); - map[cn]=i; - list.push(cn); - } - list.push('cancel2'); - event.map=map; - player.chooseControl(list).set('prompt',get.prompt('reliangying')).set('prompt2','摸至多'+get.cnNumber(player.countMark('recangchu'))+'张牌,然后交给等量的角色各一张牌').set('ai',function(){ - var player=_status.event.player; - var num=Math.min(player.countMark('recangchu'),game.countPlayer(function(current){ - return get.attitude(player,current)>0; - })); - if(num>0) return get.cnNumber(num,true); + async content(event,trigger,player){ + const draws=Array.from({length:player.countMark('recangchu')}).map((_,i)=>get.cnNumber(i+1)+'张'); + const {result:{control}}=await player.chooseControl(draws,'cancel2').set('prompt',get.prompt('reliangying')) + .set('prompt2','摸至多'+get.cnNumber(player.countMark('recangchu'))+'张牌,然后交给等量的角色各一张牌').set('ai',()=>{ + const player=get.event('player'); + const num=Math.min(player.countMark('recangchu'),game.countPlayer(current=>get.attitude(player,current)>0)); + if(num>0) return get.cnNumber(num)+'张'; return 'cancel2'; }); - 'step 1' - if(result.control=='cancel2'){event.finish();return;} - player.logSkill('reliangying'); - var num=event.map[result.control]||1; - event.num=num; - player.draw(num); - 'step 2' - var num=Math.min(event.num,player.countCards('he'),game.countPlayer(function(target){ - return target!=player; - })); - if(num){ - player.chooseCardTarget({ - prompt:'将'+get.cnNumber(num)+'张牌交给其他角色', - prompt2:'操作提示:先按顺序选中所有要给出的牌,然后再按顺序选择等量的目标角色。可少选一张牌,并将此牌留给自己', - selectCard:[num-1,num], - selectTarget:function(){ - return ui.selected.cards.length; - }, - filterTarget:function(card,player,target){ - return target!=player; - }, - filterOk:function(){ - return ui.selected.cards.length==ui.selected.targets.length; - }, - complexSelect:true, - position:'he', - ai1:function(card){ - if(game.countPlayer(function(current){ - return target!=_status.event.player&&get.attitude(_status.event.player,target)>0; - })<=ui.selected.cards.length) return 0; - if(card.name=='shan') return 1; - return Math.random(); - }, - ai2:function(target){ - if(!target) return 1; - return Math.sqrt(5-Math.min(4,target.countCards('h')))*get.attitude(_status.event.player,target); - }, - forced:true, - }); - } - else event.finish(); - 'step 3' - if(result.bool&&result.cards.length>0){ - var list=[]; - for(var i=0;itarget!=player)); + await player.draw(num); + let list=[]; + while(max-list.length>0){ + const {result:{bool,cards,targets}}=await player.chooseCardTarget({ + prompt:'粮营:将'+get.cnNumber(max-1)+'至'+get.cnNumber(max)+'张牌交给其他角色', + position:'he', + animate:false, + filterCard(card,player){ + return !get.event('list').some(list=>list[1]==card); + }, + filterTarget(card,player,target){ + return target!=player&&!get.event('list').some(list=>list[0]==target); + }, + ai1(card){ + if(card.name=='shan') return 1; + return Math.random(); + }, + ai2(target){ + return get.attitude(get.event('player'),target); + }, + }).set('list',list).set('forced',max-list.length>1); + if(bool){ + list.push([targets[0],cards[0]]); + player.addGaintag(cards,'olsujian_given'); + } + else break; + } + if(list.length){ + await game.loseAsync({ + gain_list:list, + player:player, + cards:list.slice().map(list=>list[1]), + giver:player, + animate:'giveAuto', + }).setContent('gaincardMultiple'); } - game.loseAsync({ - gain_list:list, - player:player, - cards:result.cards, - giver:player, - animate:'giveAuto', - }).setContent('gaincardMultiple'); } }, }, diff --git a/character/sp2.js b/character/sp2.js index b9fcef965..055c19936 100644 --- a/character/sp2.js +++ b/character/sp2.js @@ -8098,57 +8098,48 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, sushou:{ + audio:2, trigger:{player:'phaseDiscardBegin'}, frequent:true, - audio:2, - content:function(){ - 'step 0' - player.draw(1+player.countMark('cangchu')); - 'step 1' - var num=Math.min(player.countCards('h'),game.countPlayer(function(target){ - return target!=player&&target.isFriendOf(player); - })); + async content(event,trigger,player){ + await player.draw(1+player.countMark('cangchu')); + const num=Math.min(player.countCards('h'),player.countCards('he'),game.countPlayer(target=>target!=player&&target.isFriendOf(player))); if(num){ - player.chooseCardTarget({ - prompt:'是否将任意张手牌交给其他己方角色?', - prompt2:'操作提示:先按顺序选中所有要给出的手牌,然后再按顺序选择等量的目标角色', - selectCard:[1,num], - selectTarget:function(){ - return ui.selected.cards.length; - }, - filterTarget:function(card,player,target){ - return target!=player&&target.isFriendOf(player); - }, - complexSelect:true, - filterOk:function(){ - return ui.selected.cards.length==ui.selected.targets.length; - }, - ai1:function(card){ - if(card.name=='shan') return 1; - return Math.random(); - }, - ai2:function(target){ - return Math.sqrt(5-Math.max(4,target.countCards('h')))*get.attitude(_status.event.player,target); - }, - }); - } - else event.finish(); - 'step 2' - if(result.bool&&result.cards.length>0){ - var list=[]; - for(var i=0;i0){ + const {result:{bool,targets,cards}}=await player.chooseCardTarget({ + prompt:'宿守:你可以交给友方角色各一张牌', + position:'he', + animate:false, + filterCard(card,player){ + return !get.event('list').some(list=>list[1]==card); + }, + filterTarget(card,player,target){ + return target!=player&&target.isFriendOf(player)&&!get.event('list').some(list=>list[0]==target); + }, + ai1(card){ + if(card.name=='shan') return 1; + return Math.random(); + }, + ai2(target){ + return get.attitude(get.event('player'),target); + }, + }).set('list',list); + if(bool){ + list.push([targets[0],cards[0]]); + player.addGaintag(cards,'olsujian_given'); + } + else break; + } + if(list.length){ + await game.loseAsync({ + gain_list:list, + player:player, + cards:list.slice().map(list=>list[1]), + giver:player, + animate:'giveAuto', + }).setContent('gaincardMultiple'); } - game.loseAsync({ - gain_list:list, - player:player, - cards:result.cards, - giver:player, - animate:'giveAuto', - }).setContent('gaincardMultiple'); } }, },