From b9caaff93517ae1e7d98902c5248c5c7d9ac873b Mon Sep 17 00:00:00 2001 From: 157 <3619242020@qq.com> Date: Wed, 28 Feb 2024 17:48:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E3=80=90=E5=85=B4=E4=B9=B1=E3=80=91ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/tw.js | 119 +++++++++++++++++++++++++++++++++++------------- 1 file changed, 87 insertions(+), 32 deletions(-) diff --git a/character/tw.js b/character/tw.js index 5af1ce462..cb1e9c1e4 100644 --- a/character/tw.js +++ b/character/tw.js @@ -4676,27 +4676,75 @@ game.import('character',function(lib,game,ui,get,ai,_status){ game.addVideo('delay',null,2); 'step 1' var list=['basic','trick','equip'].filter(type=>cards.some(card=>get.type2(card)==type)); + let fs=game.filterPlayer(i=>get.attitude(_status.event.player,i)>0).sort((a,b)=>{ + if(a===player){//尽量把player往前放 + if(a.hpget.attitude(_status.event.player,i)<0).sort((a,b)=>a.hp-b.hp), + types=list.map(type=>{ + let num=0; + for(let i of event.cards){ + if(get.type2(i)==type) num++; + } + return [type,num]; + }).sort((a,b)=>b[1]-a[1]); + event.tempCache={ + max:-Infinity, + tars:[] + }; + for(let idx=0;idx=type){//都分给敌人 + e=-type; + while(tempevent.tempCache.max){ + event.tempCache.type=types[idx][0]; + event.tempCache.max=e; + event.tempCache.tars=tars.slice(0); + delete event.tempCache.more; + } + } + if(fs.length*3>=type){//都分给队友 + tars=[]; + f=type-10/(2+fs[0].hp); + temp=type-Math.max(3,type);//让血厚的尽可能多拿 + if(temp){ + if(fs.length<3){ + tars.push(fs[1]); + if(temp>=3) f-=10/(2+fs[1].hp); + } + else{ + if(player!==fs[0]){ + tars.push(player); + temp-=Math.max(2,temp); + } + if(temp) tars.addArray(fs.filter(i=>fs[0]!==i&&player!==i).sort((a,b)=>{ + return get.attitude(_status.event.player,b)-get.attitude(_status.event.player,a); + }).slice(temp<3?-1:-2)); + } + } + if(f>event.tempCache.max){ + event.tempCache.type=types[idx][0]; + event.tempCache.max=f; + event.tempCache.more=fs[0]; + event.tempCache.tars=tars.slice(0); + } + } + } player.chooseControl(list).set('ai',function(){ - var listy=['basic','trick','equip'],listz=[0,0,0]; - var num=0,numx=0,num2=0,numx2=0; - for(var i of _status.event.getParent().cards){ - for(var j=0;j<2;j++){ - if(get.type2(i)==listy[j]) listz[j]++; - } - } - for(var k=0;k<2;k++){ - if(listz[k]>num){ - num=listz[k]; - numx=k; - } - if(listz[k]2) return listy[numx2]; - return listy[numx]; - }); + return _status.event.type; + }).set('type',event.tempCache.type); 'step 2' game.broadcastAll('closeDialog',event.videoId); event.cardsx=[]; @@ -4714,7 +4762,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 3' if(event.cardsx.length>1){ player.chooseCardButton('兴乱:请选择要分配的牌',true,event.cardsx,[1,Math.min(3,event.cardsx.length)]).set('ai',function(button){ - if(ui.selected.buttons.length==0) return 1; + if(ui.selected.buttons.length==0) return get.buttonValue(button); return 0; }); } @@ -4733,18 +4781,25 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var togive=_status.event.getParent().togive; return (map[target.playerid]||[]).length+togive.length<=3; }).set('ai',function(target){ - var player=_status.event.player,att=get.attitude(player,target); - var map=_status.event.getParent().given_map; - var togive=_status.event.getParent().togive; - var num=(map[player.playerid]||[]).length,num2=(map[target.playerid]||[]).length; - var value=_status.event.value,eff=get.effect(target,{name:'losehp'},player,player); - if(num2+togive.length==num&&player!=target) return value*Math.sign(att)+eff+1000; - else{ - if(value<0) return -att+1000; - else if(att>0) return 1.5*att/(1+target.countCards('h'))+(player==target?eff/3:0)+1000; - else return att/100+1000; + let targets=_status.event.targets,att=get.attitude(_status.event.player,target); + if(targets.length){ + if(targets.includes(target)) return Math.max(1,att*_status.event.value); + return 0; } - }).set('value',cards.reduce((p,c)=>p+get.value(c,player,'raw'),0)); + return att*_status.event.value; + }).set('value',cards.reduce((p,c)=>p+get.value(c,player,'raw'),0)).set('more',event.tempCache.more).set('targets',function(){ + let arr=[],arr2=[]; + if(event.tempCache.more&&(event.given_map[event.tempCache.more.playerid]||[]).length+cards.length<=3) return [event.tempCache.more]; + for(let cur of event.tempCache.tars){ + let map=(event.given_map[cur.playerid]||[]).length; + if(map+cards.length<=3){ + if(map) arr2.push(cur); + else arr.push(cur); + } + } + if(arr.length) return arr; + return arr2; + }()); } 'step 5' if(result.bool){ From 27090d18bec1f62d3f1fa02efe8eaba7855ca364 Mon Sep 17 00:00:00 2001 From: 157 <3619242020@qq.com> Date: Thu, 29 Feb 2024 09:57:32 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E3=80=90=E8=B4=9F=E5=B1=B1=E3=80=91ai?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/ddd.js | 2 +- character/jsrg.js | 8 ++++---- character/sp.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/character/ddd.js b/character/ddd.js index 6b3483273..904d0f380 100644 --- a/character/ddd.js +++ b/character/ddd.js @@ -5459,7 +5459,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ddd_luoxian:'罗宪', dddshilie:'示烈', visible_dddshilie:'明', - dddshilie_info:'每回合限一次。当你需要使用一张【杀】或【闪】时,你可以明置任意点数之和不小于X的手牌,视为你使用之。若本次明置的牌点数等于X,你摸等同于本次明置的牌数的牌(X为你于当前回合角色的体力值之和)。', + dddshilie_info:'每回合限一次。当你需要使用一张【杀】或【闪】时,你可以明置任意点数之和不小于X的手牌,视为你使用之。若本次明置的牌点数等于X,你摸等同于本次明置的牌数的牌(X为你与当前回合角色的体力值之和)。', ddd_lie:'李娥', dddyeshen:'冶身', dddyeshen_info:'一名角色的结束阶段,你可以亮出牌堆底三张牌,令其将其中一张黑色牌当做最大目标数为牌名字数的【铁索连环】使用或重铸,其余牌置于牌堆顶,然后此技能亮出牌数-1;若减至零张或其中没有黑色牌,你复原此技能并对自己造成1点火焰伤害。', diff --git a/character/jsrg.js b/character/jsrg.js index d5f6715be..4bd1cc237 100644 --- a/character/jsrg.js +++ b/character/jsrg.js @@ -3829,16 +3829,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return game.hasPlayer(i=>i!=player); }, content:function*(event,map){ - var player=map.player,trigger=map.trigger; - var targets=game.filterPlayer(i=>i!=player); + var player=map.player,trigger=map.trigger, targets=game.filterPlayer(i=>i!=player); + var shas=player.mayHaveSha(target,'use',null,'count')-player.getCardUsable('sha',true); for(var target of targets){ var att=get.attitude(target,player); var result=yield target.chooseCard('he',`负山:是否交给${get.translation(player)}一张牌?`,`若如此做,其此阶段使用【杀】的次数上限+1`).set('att',att).set('ai',card=>{ if(!get.event('goon')) return -get.value(card); var isSha=get.name(card,get.event('target'))=='sha'; if(get.event('att')<0) return (isSha?0:5)-get.value(card); - return (isSha?10:5.5)-get.value(card); - }).set('goon',att>0&&player.countCards('sha')>player.getCardUsable('sha',true)||att<0&&!player.hasSkill('jsrgfushan_sha')).set('target',player); + return (isSha?10:0)-get.value(card); + }).set('goon',att>0&&shas>=0||att<0&&target.hp>player.getCardUsable('sha',true)&&shas<-1/Math.max(1,player.hp)).set('target',player); if(result.bool){ target.give(result.cards,player); target.line(player); diff --git a/character/sp.js b/character/sp.js index b39b65725..e816da89c 100755 --- a/character/sp.js +++ b/character/sp.js @@ -26176,7 +26176,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ "xinfu_fujian":"伏间", "xinfu_fujian_info":"锁定技,结束阶段,你观看一名随机的其他角色的随机X张手牌。(X为场上手牌最少的角色的手牌数)", fujian:'伏间', - fujian_info:'锁定技,准备阶段和结束阶段,你随机观看一名手牌数不为全场最多的其他角色的张手牌。', + fujian_info:'锁定技,准备阶段和结束阶段,你随机观看一名手牌数不为全场最多的其他角色的手牌。', xinfu_xionghuo:'凶镬', xinfu_xionghuo_info:'游戏开始时,你获得3个“暴戾”标记(标记上限为3)。出牌阶段,你可以交给一名其他角色一个“暴戾”标记。当你对有“暴戾”标记的其他角色造成伤害时,此伤害+1。有“暴戾”标记的其他角色的出牌阶段开始时,其移去所有“暴戾”标记并随机执行一项:1.受到1点火焰伤害且本回合不能对你使用【杀】;2.失去1点体力且本回合手牌上限-1;3.你随机获得其一张手牌和一张装备区的牌。', xinfu_shajue:'杀绝', From 6024f78f4f44c3725c5e4f73e59a80e63bf8e8cc Mon Sep 17 00:00:00 2001 From: 157 <3619242020@qq.com> Date: Thu, 29 Feb 2024 10:03:51 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=8F=8F=E8=BF=B0=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/huicui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/character/huicui.js b/character/huicui.js index 5a6c57c2b..2464da9f4 100644 --- a/character/huicui.js +++ b/character/huicui.js @@ -5881,7 +5881,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(player!=game.me&&!player.isOnline()) game.delayx(); var target=trigger.player; event.target=target; - player.chooseToDiscard('he',get.prompt('dccuijin',target),'弃置一张牌并令'+get.translation(trigger.player)+'使用的【杀】伤害+1,但若其未造成伤害,则你摸两张牌并对其造成1点伤害。').set('ai',function(card){ + player.chooseToDiscard('he',get.prompt('dccuijin',target),'弃置一张牌并令'+get.translation(trigger.player)+'使用的'+get.translation(trigger.card)+'伤害+1,但若其未造成伤害,则你摸两张牌并对其造成1点伤害。').set('ai',function(card){ if(_status.event.goon) return 7-get.value(card); return 0; }).set('goon',lib.skill.cuijin.checkx(trigger,player)).logSkill=['dccuijin',target]; @@ -12524,7 +12524,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ dcanliao_info:'出牌阶段限X次(X为群势力角色数)。你可以重铸一名角色的一张牌。', dc_yuejiu:'乐就', dccuijin:'催进', - dccuijin_info:'当你或你攻击范围内的角色使用【杀】或【决斗】时,你可以弃置一张牌,令此【杀】的伤害基数+1。然后当此牌被目标角色抵消或无效或防止伤害后,你摸两张牌并对使用者造成1点伤害。', + dccuijin_info:'当你或你攻击范围内的角色使用【杀】或【决斗】时,你可以弃置一张牌,令此牌的伤害基数+1。然后当此牌被目标角色抵消或无效或防止伤害后,你摸两张牌并对使用者造成1点伤害。', panghui:'庞会', dcyiyong:'异勇', dcyiyong_info:'当你对其他角色造成伤害时,若你有牌,你可以与其同时弃置至少一张牌。若你以此法弃置的牌的点数之和:不大于其,你摸X张牌;不小于其,此伤害+1(X为其以此法弃置的牌数)。',