修复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,83 +11004,58 @@ 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'); const num=draws.indexOf(control)+1,max=Math.min(num,player.countCards('he'),game.countPlayer(target=>target!=player));
var num=event.map[result.control]||1; await player.draw(num);
event.num=num; let list=[];
player.draw(num); while(max-list.length>0){
'step 2' const {result:{bool,cards,targets}}=await player.chooseCardTarget({
var num=Math.min(event.num,player.countCards('he'),game.countPlayer(function(target){ prompt:'粮营:将'+get.cnNumber(max-1)+'至'+get.cnNumber(max)+'张牌交给其他角色',
return target!=player; position:'he',
})); animate:false,
if(num){ filterCard(card,player){
player.chooseCardTarget({ return !get.event('list').some(list=>list[1]==card);
prompt:'将'+get.cnNumber(num)+'张牌交给其他角色', },
prompt2:'操作提示:先按顺序选中所有要给出的牌,然后再按顺序选择等量的目标角色。可少选一张牌,并将此牌留给自己', filterTarget(card,player,target){
selectCard:[num-1,num], return target!=player&&!get.event('list').some(list=>list[0]==target);
selectTarget:function(){ },
return ui.selected.cards.length; ai1(card){
}, if(card.name=='shan') return 1;
filterTarget:function(card,player,target){ return Math.random();
return target!=player; },
}, ai2(target){
filterOk:function(){ return get.attitude(get.event('player'),target);
return ui.selected.cards.length==ui.selected.targets.length; },
}, }).set('list',list).set('forced',max-list.length>1);
complexSelect:true, if(bool){
position:'he', list.push([targets[0],cards[0]]);
ai1:function(card){ player.addGaintag(cards,'olsujian_given');
if(game.countPlayer(function(current){ }
return target!=_status.event.player&&get.attitude(_status.event.player,target)>0; else break;
})<=ui.selected.cards.length) return 0; }
if(card.name=='shan') return 1; if(list.length){
return Math.random(); await game.loseAsync({
}, gain_list:list,
ai2:function(target){ player:player,
if(!target) return 1; cards:list.slice().map(list=>list[1]),
return Math.sqrt(5-Math.min(4,target.countCards('h')))*get.attitude(_status.event.player,target); giver:player,
}, animate:'giveAuto',
forced:true, }).setContent('gaincardMultiple');
});
}
else event.finish();
'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({
gain_list:list,
player:player,
cards:result.cards,
giver:player,
animate:'giveAuto',
}).setContent('gaincardMultiple');
} }
}, },
}, },

View File

@ -8098,57 +8098,48 @@ 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){
filterTarget:function(card,player,target){ return !get.event('list').some(list=>list[1]==card);
return target!=player&&target.isFriendOf(player); },
}, filterTarget(card,player,target){
complexSelect:true, return target!=player&&target.isFriendOf(player)&&!get.event('list').some(list=>list[0]==target);
filterOk:function(){ },
return ui.selected.cards.length==ui.selected.targets.length; ai1(card){
}, if(card.name=='shan') return 1;
ai1:function(card){ return Math.random();
if(card.name=='shan') return 1; },
return Math.random(); ai2(target){
}, return get.attitude(get.event('player'),target);
ai2:function(target){ },
return Math.sqrt(5-Math.max(4,target.countCards('h')))*get.attitude(_status.event.player,target); }).set('list',list);
}, if(bool){
}); list.push([targets[0],cards[0]]);
} player.addGaintag(cards,'olsujian_given');
else event.finish(); }
'step 2' else break;
if(result.bool&&result.cards.length>0){ }
var list=[]; if(list.length){
for(var i=0;i<result.targets.length;i++){ await game.loseAsync({
var target=result.targets[i]; gain_list:list,
var card=result.cards[i]; player:player,
list.push([target,card]); cards:list.slice().map(list=>list[1]),
player.line(target); giver:player,
animate:'giveAuto',
}).setContent('gaincardMultiple');
} }
game.loseAsync({
gain_list:list,
player:player,
cards:result.cards,
giver:player,
animate:'giveAuto',
}).setContent('gaincardMultiple');
} }
}, },
}, },