修复OL淳于琼【宿守】只能交装备牌的bug,优化OL淳于琼【宿守】和十周年淳于琼【粮营】的操作逻辑

This commit is contained in:
mengxinzxz 2024-02-06 10:31:18 +08:00
parent 1210283357
commit 3fb178ed3a
2 changed files with 86 additions and 120 deletions

View File

@ -11004,84 +11004,59 @@ game.import('character',function(lib,game,ui,get,ai,_status){
reliangying:{ reliangying:{
audio:2, audio:2,
trigger:{player:'phaseDiscardBegin'}, trigger:{player:'phaseDiscardBegin'},
filter(event,player){
return player.hasMark('recangchu');
},
direct:true, direct:true,
content:function(){ async content(event,trigger,player){
'step 0' const draws=Array.from({length:player.countMark('recangchu')}).map((_,i)=>get.cnNumber(i+1)+'张');
var map={}; const {result:{control}}=await player.chooseControl(draws,'cancel2').set('prompt',get.prompt('reliangying'))
var list=[]; .set('prompt2','摸至多'+get.cnNumber(player.countMark('recangchu'))+'张牌,然后交给等量的角色各一张牌').set('ai',()=>{
for(var i=1;i<=player.countMark('recangchu');i++){ const player=get.event('player');
var cn=get.cnNumber(i,true); const num=Math.min(player.countMark('recangchu'),game.countPlayer(current=>get.attitude(player,current)>0));
map[cn]=i; if(num>0) return get.cnNumber(num)+'张';
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);
return 'cancel2'; return 'cancel2';
}); });
'step 1' if(control!='cancel2'){
if(result.control=='cancel2'){event.finish();return;}
player.logSkill('reliangying'); player.logSkill('reliangying');
var num=event.map[result.control]||1; const num=draws.indexOf(control)+1,max=Math.min(num,player.countCards('he'),game.countPlayer(target=>target!=player));
event.num=num; await player.draw(num);
player.draw(num); let list=[];
'step 2' while(max-list.length>0){
var num=Math.min(event.num,player.countCards('he'),game.countPlayer(function(target){ const {result:{bool,cards,targets}}=await player.chooseCardTarget({
return target!=player; prompt:'粮营:将'+get.cnNumber(max-1)+'至'+get.cnNumber(max)+'张牌交给其他角色',
}));
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', position:'he',
ai1:function(card){ animate:false,
if(game.countPlayer(function(current){ filterCard(card,player){
return target!=_status.event.player&&get.attitude(_status.event.player,target)>0; return !get.event('list').some(list=>list[1]==card);
})<=ui.selected.cards.length) return 0; },
filterTarget(card,player,target){
return target!=player&&!get.event('list').some(list=>list[0]==target);
},
ai1(card){
if(card.name=='shan') return 1; if(card.name=='shan') return 1;
return Math.random(); return Math.random();
}, },
ai2:function(target){ ai2(target){
if(!target) return 1; return get.attitude(get.event('player'),target);
return Math.sqrt(5-Math.min(4,target.countCards('h')))*get.attitude(_status.event.player,target);
}, },
forced:true, }).set('list',list).set('forced',max-list.length>1);
}); if(bool){
list.push([targets[0],cards[0]]);
player.addGaintag(cards,'olsujian_given');
} }
else event.finish(); else break;
'step 3'
if(result.bool&&result.cards.length>0){
var list=[];
for(var i=0;i<result.targets.length;i++){
var target=result.targets[i];
var card=result.cards[i];
list.push([target,card]);
player.line(target);
} }
game.loseAsync({ if(list.length){
await game.loseAsync({
gain_list:list, gain_list:list,
player:player, player:player,
cards:result.cards, cards:list.slice().map(list=>list[1]),
giver:player, giver:player,
animate:'giveAuto', animate:'giveAuto',
}).setContent('gaincardMultiple'); }).setContent('gaincardMultiple');
} }
}
}, },
}, },
reshishou:{ reshishou:{

View File

@ -8098,58 +8098,49 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
}, },
sushou:{ sushou:{
audio:2,
trigger:{player:'phaseDiscardBegin'}, trigger:{player:'phaseDiscardBegin'},
frequent:true, frequent:true,
audio:2, async content(event,trigger,player){
content:function(){ await player.draw(1+player.countMark('cangchu'));
'step 0' const num=Math.min(player.countCards('h'),player.countCards('he'),game.countPlayer(target=>target!=player&&target.isFriendOf(player)));
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);
}));
if(num){ if(num){
player.chooseCardTarget({ let list=[];
prompt:'是否将任意张手牌交给其他己方角色?', while(num-list.length>0){
prompt2:'操作提示:先按顺序选中所有要给出的手牌,然后再按顺序选择等量的目标角色', const {result:{bool,targets,cards}}=await player.chooseCardTarget({
selectCard:[1,num], prompt:'宿守:你可以交给友方角色各一张牌',
selectTarget:function(){ position:'he',
return ui.selected.cards.length; animate:false,
filterCard(card,player){
return !get.event('list').some(list=>list[1]==card);
}, },
filterTarget:function(card,player,target){ filterTarget(card,player,target){
return target!=player&&target.isFriendOf(player); return target!=player&&target.isFriendOf(player)&&!get.event('list').some(list=>list[0]==target);
}, },
complexSelect:true, ai1(card){
filterOk:function(){
return ui.selected.cards.length==ui.selected.targets.length;
},
ai1:function(card){
if(card.name=='shan') return 1; if(card.name=='shan') return 1;
return Math.random(); return Math.random();
}, },
ai2:function(target){ ai2(target){
return Math.sqrt(5-Math.max(4,target.countCards('h')))*get.attitude(_status.event.player,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 event.finish(); else break;
'step 2'
if(result.bool&&result.cards.length>0){
var list=[];
for(var i=0;i<result.targets.length;i++){
var target=result.targets[i];
var card=result.cards[i];
list.push([target,card]);
player.line(target);
} }
game.loseAsync({ if(list.length){
await game.loseAsync({
gain_list:list, gain_list:list,
player:player, player:player,
cards:result.cards, cards:list.slice().map(list=>list[1]),
giver:player, giver:player,
animate:'giveAuto', animate:'giveAuto',
}).setContent('gaincardMultiple'); }).setContent('gaincardMultiple');
} }
}
}, },
}, },
liangying:{ liangying:{