From 3b763569ecd28e8bd3550bf6e9b4fecdb5f81f2f Mon Sep 17 00:00:00 2001 From: PZ157 <3619242020@qq.com> Date: Thu, 23 Nov 2023 11:48:31 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=87=BD=E6=95=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit filter: 数字则加减等量“手牌”再计算; 函数则剔除不符合条件的手牌计算 add: 卡牌或牌组,类似数字 --- game/game.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/game/game.js b/game/game.js index fe46763fe..37cb4ab73 100644 --- a/game/game.js +++ b/game/game.js @@ -28656,9 +28656,15 @@ new Promise(resolve=>{ } return false; } - needsToDiscard(num){ - if(typeof num!='number') num=0; - return Math.max(0,num+this.countCards('h',card=>!this.canIgnoreHandcard(card))-this.getHandcardLimit()); + needsToDiscard(filter,add){ + let cards=this.getCards('h',card=>!this.canIgnoreHandcard(card)),num=0; + if(get.itemtype(add)==='cards') cards.addArray(add); + else if(get.itemtype(add)==='card') cards.push(add); + if(typeof filter==='number') num=filter; + else if(typeof filter==='function') cards=cards.filter(card=>{ + return filter(card); + }); + return Math.max(0,num+cards.length-this.getHandcardLimit()); } distanceTo(target,method){ return get.distance(this,target,method); From d6109c6a5ea5a40e9d0af764853386c2ec45eecb Mon Sep 17 00:00:00 2001 From: PZ157 <3619242020@qq.com> Date: Thu, 23 Nov 2023 11:55:36 +0800 Subject: [PATCH 2/4] =?UTF-8?q?ai=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/tw.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/character/tw.js b/character/tw.js index 39b299b16..9c7ac9621 100644 --- a/character/tw.js +++ b/character/tw.js @@ -9860,7 +9860,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var target=trigger.player; event.target=target; if(player.storage.twzhengjian){ - player.chooseBool('征建:是否对'+get.translation(target)+'造成1点伤害?').set('ai',()=>_status.event.goon).set('goon',get.damageEffect(target,player,player)>0); + player.chooseBool('征建:是否对'+get.translation(target)+'造成1点伤害?').set('ai',()=>_status.event.goon).set('goon',get.damageEffect(target,player,_status.event.player)>0); } else{ target.chooseCard('he',true,'交给'+get.translation(player)+'一张牌'); @@ -9872,7 +9872,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } else target.damage(); } - player.chooseBool('是否变更【征建】的效果?'); + player.chooseBool('是否变更【征建】的效果?').set('ai',()=>Math.random()>0.5); 'step 2' if(result.bool){ player.removeSkill('twzhengjian_eff0'); @@ -9908,7 +9908,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var target=trigger.player; event.target=target; if(player.storage.twzhengjian){ - player.chooseBool('征建:是否对'+get.translation(target)+'造成1点伤害?'); + player.chooseBool('征建:是否对'+get.translation(target)+'造成1点伤害?').set('ai',()=>_status.event.goon).set('goon',get.damageEffect(target,player,_status.event.player)>0); } else{ target.chooseCard('he',true,'交给'+get.translation(player)+'一张牌'); From d376cb853d479bce36ae56e1f98eeada964b278e Mon Sep 17 00:00:00 2001 From: PZ157 <3619242020@qq.com> Date: Thu, 23 Nov 2023 13:52:14 +0800 Subject: [PATCH 3/4] bugfix --- card/standard.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/card/standard.js b/card/standard.js index 868ea7143..d60b449a8 100644 --- a/card/standard.js +++ b/card/standard.js @@ -227,18 +227,18 @@ game.import('card',function(lib,game,ui,get,ai,_status){ var base=0,hit=false; if(get.cardtag(card,'yingbian_hit')){ hit=true; - if(targets.filter(function(target){ - return target.hasShan()&&get.attitude(viewer,target)<0&&get.damageEffect(target,player,viewer,get.nature(card))>0; + if(targets.some(target=>{ + return target.mayHaveShan(viewer)&&get.attitude(viewer,target)<0&&get.damageEffect(target,player,viewer,get.natureList(card))>0; })) base+=5; } - if(get.cardtag(card,'yingbian_all')){ + if(get.cardtag(card,'yingbian_add')){ if(game.hasPlayer(function(current){ return !targets.contains(current)&&lib.filter.targetEnabled2(card,player,current)&&get.effect(current,card,player,player)>0; })) base+=5; } if(get.cardtag(card,'yingbian_damage')){ - if(targets.filter(function(target){ - return get.attitude(player,target)<0&&(hit||!target.mayHaveShan()||player.hasSkillTag('directHit_ai',true,{ + if(targets.some(target=>{ + return get.attitude(player,target)<0&&(hit||!target.mayHaveShan(viewer)||player.hasSkillTag('directHit_ai',true,{ target:target, card:card, },true))&&!target.hasSkillTag('filterDamage',null,{ From 98babe6447c0619ae12b0771447f34997ca6ea2c Mon Sep 17 00:00:00 2001 From: PZ157 <3619242020@qq.com> Date: Thu, 23 Nov 2023 14:53:49 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BC=98=E5=8C=96=E3=80=90=E6=B0=B4?= =?UTF-8?q?=E6=B7=B9=E4=B8=83=E5=86=9B=E3=80=91ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- card/guozhan.js | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/card/guozhan.js b/card/guozhan.js index 9d2049cad..00a4754df 100644 --- a/card/guozhan.js +++ b/card/guozhan.js @@ -474,12 +474,13 @@ game.import('card',function(lib,game,ui,get,ai,_status){ return; } else target.chooseControl('discard_card','take_damage',function(event,player){ - if(get.damageEffect(player,event.player,player,'thunder')>=0){ - return 'take_damage'; - } - if(player.hp>=3&&player.countCards('e')>=2){ - return 'take_damage'; - } + let eff=get.damageEffect(player,event.player,player,'thunder'); + if(eff>0) return 'take_damage'; + if(player.hasSkillTag('noe')) return 'discard_card'; + if(!eff) return 'take_damage'; + if(player.isDamaged()&&player.hasCard((card)=>get.name(card)=='baiyin'&&get.recoverEffect(player,player,_status.event.player)>0,'e')) return 'discard_card'; + if(player.hasCard((card)=>get.value(card,player)<=0,'e')&&!player.hasCard((card)=>get.value(card,player)>Math.max(7,12-player.hp),'e')) return 'discard_card'; + if(player.hp>2&&player.countCards('e')>2||player.hp>1&&player.countCards('e')>3) return 'take_damage'; return 'discard_card'; }).set('prompt','水淹七军').set('prompt2','请选择一项:⒈弃置装备区里的所有牌;⒉受到'+get.translation(player)+'造成的1点雷电伤害。'); 'step 1' @@ -534,12 +535,14 @@ game.import('card',function(lib,game,ui,get,ai,_status){ }, result:{ target:function(player,target,card,isLink){ - if(isLink) return -1.5; - var es=target.getCards('e'); - if(!es.length) return -1.5; - var val=0; - for(var i of es) val+=get.value(i,target); - return -Math.min(1.5,val/5); + let es=target.getCards('e'), eff=2*get.sgn(get.damageEffect(target,player,target,'thunder')); + if(isLink || !es.length) return eff; + let val=0; + for(let i of es){ + if(i.name=='baiyin'&&target.isDamaged()&&get.recoverEffect(target)) val+=6; + else val-=get.value(i,target); + } + return Math.max(eff,0.15*val); } } }