From aa9385fa08152b84126e197f8d516bfed4207c12 Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Wed, 25 Oct 2023 13:54:49 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E9=83=A8=E5=88=86=E6=8A=80=E8=83=BDai?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 稍稍优化【智解】ai --- character/ddd.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/character/ddd.js b/character/ddd.js index ad2e67a17..cb630b754 100644 --- a/character/ddd.js +++ b/character/ddd.js @@ -1637,6 +1637,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, order:10, result:{player:1}, + effect:{ + target:(card,player,target)=>{ + if(card.name==='sha'&&target.getExpansions('ddddongcha_effect').length<2&&lib.skill['dddzhijie'].hiddenCard(target,'shan')) return [1,1,1,-get.sgn(get.attitude(player,_status.currentPhase))]; + } + } }, subSkill:{ draw:{ From 9cfa4c92ba551047a4b808ceb06aa6ebe8945e27 Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Wed, 25 Oct 2023 13:58:37 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=80=92=E6=B6=9Bai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/collab.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/character/collab.js b/character/collab.js index 816cdb5c4..d159b30ea 100644 --- a/character/collab.js +++ b/character/collab.js @@ -1156,8 +1156,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ effect:{ player:function(card,player,target){ - if(ui.selected.targets.length) return; - if(player!=target&&get.type2(card)=='trick') return [1,0,1,-2]; + if(player!==target&&get.type2(card)==='trick'){ + let tars=[target]; + if(ui.selected.targets.length) tars.addArray(ui.selected.targets.filter(i=>i!==player&&i!==target)); + if(tars.length<2) return [1,0,1,-2]; + return [1,0,1,-2/tars.length]; + } }, }, }, From 89e476a88f92f766484d61be3de67f7ff63530d7 Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Wed, 25 Oct 2023 14:04:15 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E3=80=90=E5=85=B1?= =?UTF-8?q?=E6=82=A3=E3=80=91=E5=85=A8=E5=B1=80ai=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/shiji.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/character/shiji.js b/character/shiji.js index 01740e65c..5c17188f5 100644 --- a/character/shiji.js +++ b/character/shiji.js @@ -3331,16 +3331,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){ effect:{ target:function(card,player,target){ if(_status.luanchou_judging) return; - _status.luanchou_judging=true; if(get.tag(card,'damage')&&target.hasMark('luanchou')){ var other=game.findPlayer(function(current){ return current!=target&¤t.hasMark('luanchou')&¤t.hp>target.hp&&(!current.storage.counttrigger||!current.storage.counttrigger.gonghuan); }); - if(!other){ - delete _status.luanchou_judging; - return; - }; - var eff=[0,0,0,get.damageEffect(other,player,target,get.nature(card))]; + if(!other) return; + _status.luanchou_judging=true; + var eff=[0,0,0,get.damageEffect(other,player,player,get.nature(card))/get.attitude(player,player)]; delete _status.luanchou_judging; return eff; } From 1ce0f4623a52c142cc57b721dd61858e53c057b8 Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Wed, 25 Oct 2023 20:36:44 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=92=B2=E5=85=83?= =?UTF-8?q?=E9=83=A8=E5=88=86=E4=B8=93=E5=B1=9E=E6=AD=A6=E5=99=A8ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/xianding.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/character/xianding.js b/character/xianding.js index b51c7cc08..a7352192d 100644 --- a/character/xianding.js +++ b/character/xianding.js @@ -11669,9 +11669,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return event.getParent().name=='sha'; }, - check:function(event,player){ - return player.isDamaged(); - }, content:function(){ 'step 0' player.judge(function(card){ @@ -11718,14 +11715,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var next=player.chooseToDiscard('he',function(card,player){ return card!=player.getEquip('pyzhuren_diamond'); },get.prompt(event.name,trigger.player),'弃置一张牌,令即将对其造成的伤害+1'); + next.set('target',trigger.player); next.ai=function(card){ - if(_status.event.goon) return 6-get.value(card); + if(_status.event.goon) return 30/(1+_status.event.target.hp)-get.value(card); return -1; }; next.set('goon',get.attitude(player,trigger.player)<0&&!trigger.player.hasSkillTag('filterDamage',null,{ player:player, card:trigger.card, - })); + })&&get.damageEffect(trigger.player,player,player,trigger.nature)>0); next.logSkill=[event.name,trigger.player]; 'step 1' if(result.bool) trigger.num++; @@ -11801,10 +11799,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ jueqing:true, unequip_ai:true, skillTagFilter:function(player,tag,arg){ - if(tag=='unequip_ai'){ - if(arg&&arg.name=='sha'&&get.color(arg.card)=='black') return true; - return false; - } + if(tag=='unequip_ai') return arg&&arg.name==='sha; } }, }, From d0089bde644d54203aae156ec3de1cca504d1eed Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Wed, 25 Oct 2023 21:15:48 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E3=80=90=E5=86=B2?= =?UTF-8?q?=E5=BA=94=E7=A5=9E=E7=AC=A6=E3=80=91ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/tw.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/character/tw.js b/character/tw.js index 7ea972339..c958e4231 100644 --- a/character/tw.js +++ b/character/tw.js @@ -13185,6 +13185,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ trigger.num--; }, + ai:{ + effect:{ + target:function(card,player,target){ + if(typeof card=='object'&&target.storage.gx_chongyingshenfu_effect&&target.getStorage('gx_chongyingshenfu_effect').includes(card.name)&&!target.hasSkillTag('unequip2')&& + get.itemtype(player)!=='player'||!player.hasSkillTag('jueqing',false,target)&&!player.hasSkillTag('unequip',false,{ + name:card.name, + target:target, + card:card, + }))){ + if(player&&player.hasSkillTag('damageBonus',true,{ + target:target, + card:card + })) return 0.5; + return 'zeroplayertarget'; + } + } + } + }, onremove:true, intro:{ content:'受到$造成的伤害-1', From 47b124a80920b6fe270f48e42054dfdc1754e8a0 Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Wed, 25 Oct 2023 21:20:43 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E5=BE=AE=E8=B0=83=E3=80=90=E5=86=B3?= =?UTF-8?q?=E6=96=97=E3=80=91ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 降低队友拼杀可能 --- card/standard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/card/standard.js b/card/standard.js index 2454de7c2..7e27a1853 100644 --- a/card/standard.js +++ b/card/standard.js @@ -1169,14 +1169,14 @@ game.import('card',function(lib,game,ui,get,ai,_status){ if(event.shaRequired>1&&player.countCards('h','sha')get.damageEffect(player,target,event.player)){ return get.order(card); } return -1; From ab79864faf64944a37d116777f008c1e0773f6d8 Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Wed, 25 Oct 2023 21:35:40 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=90=E5=BF=A0?= =?UTF-8?q?=E4=BD=90=E3=80=91ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/mobile.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/character/mobile.js b/character/mobile.js index 43a48b5b9..b4c39a8a6 100644 --- a/character/mobile.js +++ b/character/mobile.js @@ -11179,10 +11179,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ 'step 0' player.chooseTarget(get.prompt('zhongzuo'),'令一名角色摸两张牌。若其已受伤,则你摸一张牌。').set('ai',function(target){ - if(target.hasSkillTag('nogain')&&target!=_status.currentPhase) return target.isDamaged()?0:1; - var att=get.attitude(_status.event.player,target); - if(target.isDamaged()) att=att*1.2; - return att; + if(target.hasSkillTag('nogain')) return target.isDamaged()?0:1; + let att=get.attitude(_status.event.player,target); + if(att<=0) return 0; + if(target.isDamaged()) return 1+att/5; + return att/5; }); 'step 1' if(result.bool){ From 517c9cb9d3bbd888c5de4ce2bfedf4155ab1fb0b Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Wed, 25 Oct 2023 21:53:10 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E3=80=90=E6=9E=81?= =?UTF-8?q?=E7=95=A5=E5=AE=8C=E6=9D=80=E3=80=91ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/extra.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/character/extra.js b/character/extra.js index 16afdd1ca..edeff82af 100755 --- a/character/extra.js +++ b/character/extra.js @@ -5143,6 +5143,25 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ player.removeMark('renjie',1); player.addTempSkill('rewansha'); + }, + ai:{ + order:()=>{ + let player=_status.event.player; + if(game.hasPlayer(current=>{ + if(player===current||current.hp>1||get.attitude(player,current)>=0) return false; + return player.inRange(current)&&player.countCards('hs','sha')&&player.getCardUsable('sha')|| + player.countCards('hs',card=>get.name(card)!=='sha'&&get.tag(card,'damage'))>1; + }) return 9.2; + return 0; + }, + result:{ + player:1 + }, + effect:{ + player:(card,player,target)=>{ + if(player.hasSkill('rewansha')&&target.hp<=1&&get.tag(card,'damage')) return [1,0,1.5,-1.5]; + } + } } }, jilue_zhiheng:{ From fb1e20d29bc0640dc0ec12fb3b373edfddc1851d Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Thu, 26 Oct 2023 19:51:34 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=90=E9=9B=84?= =?UTF-8?q?=E4=B9=B1=E3=80=91ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/shenhua.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/character/shenhua.js b/character/shenhua.js index ea44bc759..78741ce8b 100755 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -1382,13 +1382,20 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ order:13, result:{ - target:function(player,target){ + target:(player,target)=>{ if(target.getEquip('bagua')||target.getEquip('rewrite_bagua')) return 0; - var hs=player.countCards('h',function(card){ - return ['sha','juedou'].contains(card.name)&&get.effect(target,card,player,player)!=0; + let hs=player.countCards('h',card=>{ + if(!get.tag(card,'damage')||get.effect(target,card,player,player)<=0) return 0; + if(get.name(card,player)==='sha'){ + if(target.getEquip('bagua')) return 0.5; + if(target.getEquip('rewrite_bagua')) return 0.25; + } + return 1; + }),ts=target.hp+target.hujia+game.countPlayer(current=>{ + if(get.attitude(current,target)>0) return current.countCards('hs')/8; + return 0; }); - var ts=target.hp; - if(hs>=ts&&ts>1) return -1; + if(hs>=ts) return -hs; return 0; }, }, From 01f08eb546753a55eeedad92224f1b9f9b1cec23 Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Thu, 26 Oct 2023 20:13:21 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E8=B0=83=E6=95=B4=E3=80=90=E9=85=92?= =?UTF-8?q?=E3=80=91ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- card/extra.js | 85 +++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 46 deletions(-) diff --git a/card/extra.js b/card/extra.js index d1dddc559..6b397064f 100644 --- a/card/extra.js +++ b/card/extra.js @@ -99,69 +99,62 @@ game.import('card',function(lib,game,ui,get,ai,_status){ }, ai:{ basic:{ - useful:function(card,i){ + useful:(card,i)=>{ if(_status.event.player.hp>1){ - if(i==0) return 4; + if(i===0) return 4; return 1; } - if(i==0) return 7.3; + if(i===0) return 7.3; return 3; }, - value:function(card,player,i){ + value:(card,player,i)=>{ if(player.hp>1){ - if(i==0) return 5; + if(i===0) return 5; return 1; } - if(i==0) return 7.3; + if(i===0) return 7.3; return 3; - }, + } }, - order:function(){ - return get.order({name:'sha'})+0.2; + order:()=>{ + if(_status.event.dying) return 9; + let sha=get.order(new lib.elementVCard({name:'sha'})); + if(sha>0) return sha+0.2; + return 0; }, result:{ - target:function(player,target){ + target:(player,target)=>{ if(target&&target.isDying()) return 2; - if(target&&!target.isPhaseUsing()) return 0; - if(lib.config.mode=='stone'&&!player.isMin()){ - if(player.getActCount()+1>=player.actcount) return 0; - } - var shas=player.getCards('h','sha'); - if(shas.length>1&&(player.getCardUsable('sha')>1||player.countCards('h','zhuge'))){ - return 0; - } - shas.sort(function(a,b){ - return get.order(b)-get.order(a); - }) - var card; - if(shas.length){ - for(var i=0;i0); - })){ + if(!target || target._jiu_temp || !target.isPhaseUsing()) return 0; + if(!target.getCardUsable('sha') || lib.config.mode==='stone'&&!player.isMin()&&player.getActCount()+1>=player.actcount) return 0; + let shas = player.getCards('hs',card=>get.name(card)==='sha'&&!ui.selected.cards.includes(card)), card; + if(!shas.length || !target.hasSha() || shas.length>1&&(target.getCardUsable('sha')>1 || target.countCards('hs','zhuge'))) return 0; + target._jiu_temp = true; + shas.sort((a,b)=>get.order(b)-get.order(a)); + for(let i=0; i{ + return get.attitude(target,current)<0&&target.canUse(shas[i],current,null,true)&&!current.hasSkillTag('filterDamage',null,{ + player:target, + card:shas[i], + jiu:true + })&&get.effect(current,shas[i],target)>0; + }); + if(!tars.length) continue; + tars.sort((a,b)=>{ + return get.effect(b,shas[i],target)-get.effect(a,shas[i],target); + }); + if(!tars[0].mayHaveShan(player,'use') || target.hasSkillTag('directHit_ai',true,{ + target:tars[0], + card:shas[i] + },true) || target.needsToDiscard()>Math.max(0,3-target.hp)){ + delete target._jiu_temp; return 1; } } + delete target._jiu_temp; return 0; - }, + } }, tag:{ save:1, From 2a7941812af62a4fbd942e9cc399a19d06bab0ac Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Thu, 26 Oct 2023 20:28:44 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E5=BE=AE=E8=B0=83=E7=8C=9C=E6=9D=80?= =?UTF-8?q?=E7=8C=9C=E9=97=AA=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加形参ignore,ignore牌/牌组不参与此次猜测; 默认选择的牌(ui.selected.cards)不纳入猜测区域 --- game/game.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/game/game.js b/game/game.js index a44bc4503..e74f377ba 100644 --- a/game/game.js +++ b/game/game.js @@ -28273,13 +28273,16 @@ if(this.hasSkillTag('respondShan',true,null,true)) return true; return this.hasUsableCard('shan'); } - mayHaveSha(viewer,type){ + mayHaveSha(viewer,type,ignore){ if((this.hp>2||!this.isZhu&&this.hp>1)&&this.hasSkillTag('respondSha',true,type,true)) return true; if(get.itemtype(viewer)!=='player') viewer=_status.event.player; - let cards; + let cards,selected=get.copy(ui.selected.cards); + if(get.itemtype(ignore)==='cards') selected.addArray(ignore); + else if(get.itemtype(ignore)==='card') selected.add(ignore); if(this===viewer||get.itemtype(viewer)==='player'&&viewer.hasSkillTag('viewHandcard',null,this,true)) cards=this.getCards('h'); else cards=this.getShownCards(); if(cards.some(card=>{ + if(selected.includes(card)) return false; let name=get.name(card,this); if(name=='sha'||name=='hufu'||name=='yuchanqian'){ if(type==='use') return lib.filter.cardEnabled(card,this); @@ -28288,17 +28291,20 @@ } return false; })) return true; - let hs=this.getCards('hs').removeArray(cards).length; + let hs=this.getCards('hs').filter(i=>!cards.includes(i)&&!selected.includes(i)).length; if(hs===0) return false; return Math.pow(hs+(this.isPhaseUsing()?6:4),2)>100*_status.event.getRand('mayHaveSha'); } - mayHaveShan(viewer,type){ + mayHaveShan(viewer,type,ignore){ if((this.hp>2||!this.isZhu&&this.hp>1)&&this.hasSkillTag('respondShan',true,type,true)) return true; if(get.itemtype(viewer)!=='player') viewer=_status.event.player; - let cards; + let cards,selected=get.copy(ui.selected.cards); + if(get.itemtype(ignore)==='cards') selected.addArray(ignore); + else if(get.itemtype(ignore)==='card') selected.add(ignore); if(this===viewer||get.itemtype(viewer)==='player'&&viewer.hasSkillTag('viewHandcard',null,this,true)) cards=this.getCards('h'); else cards=this.getShownCards(); if(cards.some(card=>{ + if(selected.includes(card)) return false; let name=get.name(card,this); if(name==='shan'||name==='hufu'){ if(type==='use') return lib.filter.cardEnabled(card,this); @@ -28307,7 +28313,7 @@ } return false; })) return true; - let hs=this.getCards('hs').removeArray(cards).length; + let hs=this.getCards('hs').filter(i=>!cards.includes(i)&&!selected.includes(i)).length; if(hs===0) return false; return Math.pow(hs+(this.isPhaseUsing()?3:5),2)>100*_status.event.getRand('mayHaveShan'); } From a0a23ec30dc504af98de56a93f5d8cc50a17e590 Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Thu, 26 Oct 2023 22:03:19 +0800 Subject: [PATCH 12/13] bugfix --- card/extra.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/card/extra.js b/card/extra.js index 6b397064f..83ef9d2f0 100644 --- a/card/extra.js +++ b/card/extra.js @@ -118,7 +118,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ }, order:()=>{ if(_status.event.dying) return 9; - let sha=get.order(new lib.elementVCard({name:'sha'})); + let sha=get.order({name:'sha'}); if(sha>0) return sha+0.2; return 0; }, From 556e3eb5b12dc64f85408417acf3ee416d96f747 Mon Sep 17 00:00:00 2001 From: 157 <144450955+PZ157@users.noreply.github.com> Date: Thu, 26 Oct 2023 22:38:37 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=86=99=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/yingbian.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/yingbian.js b/character/yingbian.js index 181424f12..2116eddb7 100644 --- a/character/yingbian.js +++ b/character/yingbian.js @@ -2597,7 +2597,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return get.name(card) === 'tao' || get.name(card) === 'jiu'; }), att = get.attitude(_status.event.player, event.player), - eff = get.damageEffect(event.player, player, _status.event.player, event.nature), + eff = get.damageEffect(event.player, player, _status.event.player, get.natureList(event)), fd = event.player.hasSkillTag('filterDamage', null, { player: player, card: event.card @@ -2605,7 +2605,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ hp = player.hp + tj; if(player.storage.tairan2) hp -= player.storage.tairan2; if(eff <= 0 || fd || att >= -2 || Math.abs(hp) <= 1) return false; - if(hp > 2 || event.player.isLinked() && event.nature && eff > 0) return true; + if(hp > 2 || eff > 0 && event.player.isLinked() && event.hasNature()) return true; return !event.player.countCards('hs') || event.player.hp > 2 * event.num && !event.player.hasSkillTag('maixie'); }, logTarget:'player',