From 1a7ad4e4614917779305ec237c44b77cb932da8f Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Sun, 1 Oct 2023 19:56:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2=E8=B0=8B=E8=B2=82=E8=9D=89?= =?UTF-8?q?=E3=80=90=E7=A6=BB=E9=97=B4=E3=80=91ai=E7=AD=96=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 同时修复对决模式谋貂蝉ai报错 --- character/sb.js | 110 +++++++++++++++++++++++++++++------------------- 1 file changed, 66 insertions(+), 44 deletions(-) diff --git a/character/sb.js b/character/sb.js index f0d51f4ee..ac734519c 100644 --- a/character/sb.js +++ b/character/sb.js @@ -784,12 +784,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return ui.selected.targets.length==ui.selected.cards.length+1; }, check:function(card){ - let player=get.owner(card),targets=_status.event.getTempCache('sblijian','targets'); - if(!Array.isArray(targets)){ - lib.skill.sblijian.selectTargetAi(_status.event,player); - targets=_status.event.getTempCache('sblijian','targets'); - } - targets=Math.min(player.countCards('he')+1,targets.length); + let player=get.owner(card),targets=lib.skill.sblijian.selectTargetAi(_status.event,player); if(ui.selected.cards.lengthcurrent!==player),res; + let cache=_status.event.getTempCache('sblijian','targets'); + if(Array.isArray(cache)) return cache.length; + let id=[null,0],players=game.filterPlayer(current=>current!==player),temp; for(let i of players){ - res=get.attitude(event.player,i); - if(restarget[1]) target=[i,res]; - } - game.players.remove(vp); - if(target[1]<=0){ - event.putTempCache('sblijian','targets',[]); - return; - } - let targets=[],idx=-1; - do{ - idx++; - targets.push(target.concat([get.sgn(get.attitude(player,target[0]))])); - players.remove(target[0]); - target[1]=0; - for(let i of players){ - res=get.effect(i,{name:'juedou',isCard:true},targets[idx][0],event.player); - if(res>target[1]) target=[i,res]; + let target=[null,0],targets=[],vp=player.getEnemies(); + if(vp.length>1){ + let list=[game.createCard('sha'),game.createCard('shan')]; + vp=ui.create.player().init('sunce'); + vp.hp=2; + vp.skills=[]; + game.players.push(vp); + if(typeof id==='string'){ + if(id.endsWith('zhu')||id.endsWith('Zhu')) id=id.slice(0,-1)+'ong'; + vp.identity=id; + vp.showIdentity(); } - }while(target[1]>0); - if(!player.hasSkill('sbbiyue')) targets=targets.filter(i=>i[2]!==0); + else vp.side=id[0].side; + vp.directgain(list,false); + for(let i of players){ + temp=get.effect(i,{name:'juedou',isCard:true},vp,event.player)+get.effect(vp,{name:'juedou',isCard:true},i,event.player); + if(temp>=0) targets.push([i,temp]); + } + game.cardsGotoSpecial(list); + game.players.remove(vp); + } + else{ + vp=vp[0]; + for(let i of players){ + temp=get.effect(i,{name:'juedou',isCard:true},vp,event.player)+get.effect(vp,{name:'juedou',isCard:true},i,event.player); + if(temp>=0) targets.push([i,temp]); + } + } + for(let i=0;i0&&targets[i][1]<2.5*temp&&targets.length>2) targets.splice(i--,1); + else targets[i].push(temp); + } + targets.sort((a,b)=>{ + let att1=get.sgn(get.attitude(event.player,a[0])),att2=get.sgn(get.attitude(event.player,b[0])); + if(att1!==att2) return att1-att2; + return b[1]-a[1]; + }); + targets=targets.slice(0,player.countCards('he')+1); event.putTempCache('sblijian','targets',targets); + return targets.length; }, multiline:true, content:function(){ @@ -847,24 +857,36 @@ game.import('character',function(lib,game,ui,get,ai,_status){ order:7, result:{ player:function(player,target){ - if(!player.hasSkill('sbbiyue')) return 0; let targets=_status.event.getTempCache('sblijian','targets'); - if(Array.isArray(targets)) for(let i=0;i2&&!player.hasSkill('sbbiyue')) return 0; + for(let i=0;i0) return targets[i][1]/5; - return -targets[i][1]; + if(Array.isArray(targets)){ + for(let i=0;i0) return targets[i][1]/5; + return -targets[i][1]; + } } + return 0; } if(ui.selected.targets.length){ - let tars=ui.selected.targets.concat([target]); - return get.effect(target,{name:'juedou',isCard:true},tars[tars.length-2],target)+get.effect(tars[0],{name:'juedou',isCard:true},target,target); + let tars=ui.selected.targets.concat([target]).sortBySeat(); + for(let i=0;i