From b0eb2006b87d27d331b56af3d367eba89ce5f98a Mon Sep 17 00:00:00 2001 From: copcap Date: Sat, 11 Nov 2023 17:05:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=93=AA=E5=90=92AI=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- card/standard.js | 2 +- character/collab.js | 51 ++++++++++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/card/standard.js b/card/standard.js index ad4eb42bd..d2baa96f4 100644 --- a/card/standard.js +++ b/card/standard.js @@ -310,7 +310,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ return 1; }, natureDamage:function(card){ - if(game.hasNature(card)) return 1; + if(game.hasNature(card,'linked')) return 1; }, fireDamage:function(card,nature){ if(game.hasNature(card,'fire')) return 1; diff --git a/character/collab.js b/character/collab.js index bbda0cd0d..cc55af7b4 100644 --- a/character/collab.js +++ b/character/collab.js @@ -85,37 +85,44 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } }, ai:{ + filterDamage:true, + skillTagFilter:function(player,tag,arg){ + if(arg&&arg.player&&arg.player.hasSkillTag('jueqing',false,player)) return false; + }, effect:{ target:function(card,player,target){ - if(player.hasSkillTag('jueqing')) return; + if(player.hasSkillTag('jueqing',false,target)) return; if(player._dcsantou_temp) return; - if(get.event().getParent('useCard',true)||get.event().getParent('_wuxie',true)) return; if(get.tag(card,'damage')){ const hp=target.getHp(); - if(hp>=3&&target.hasHistory('useSkill',evt=>evt.skill=='dcsantou'&&evt.event.getTrigger().source==player)||hp==2&&get.tag(card,'natureDamage')||hp==1&&get.color(card)=='red'&&get.itemtype(card)=='card') return [1,-2]; - else if(get.attitude(player,target)<0){ - if(card.name=='sha') return; - let sha=false; - player._dcsantou_temp=true; - let num=player.countCards('h',card=>{ - if(card.name=='sha'){ - if(sha) return false; - else sha=true; + if(hp>=3){ + if(target.hasHistory('useSkill',evt=>evt.skill=='dcsantou'&&evt.event.getTrigger().source==player)) return [1,-2]; + else if(get.attitude(player,target)<0){ + if(card.name=='sha') return; + let sha=false; + player._dcsantou_temp=true; + let num=player.countCards('h',card=>{ + if(card.name=='sha'){ + if(sha) return false; + else sha=true; + } + return get.tag(card,'damage')&&player.canUse(card,target)&&get.effect(target,card,player,player)>0; + }); + delete player._dcsantou_temp; + if(player.hasSkillTag('damage')){ + num++; } - return get.tag(card,'damage')&&player.canUse(card,target)&&get.effect(target,card,player,player)>0; - }); - delete player._dcsantou_temp; - if(player.hasSkillTag('damage')){ - num++; - } - if(num<2){ - var enemies=player.getEnemies(); - if(enemies.length==1&&enemies[0]==target&&player.needsToDiscard()){ - return; + if(num<2){ + var enemies=player.getEnemies(); + if(enemies.length==1&&enemies[0]==target&&player.needsToDiscard()){ + return; + } + return 0; } - return 0; } } + else if(hp==2&&get.tag(card,'natureDamage')||hp==1&&get.color(card)=='red'&&get.itemtype(card)=='card') return [1,-2]; + else return 0; } } }