From 99e4c9ba606d7a61ad9e8f6b7b7a8dac066c034e Mon Sep 17 00:00:00 2001 From: copcap Date: Sun, 12 Nov 2023 17:12:09 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A1=A5=E5=85=85=E8=A2=AB=E5=9B=9E?= =?UTF-8?q?=E6=BB=9A=E7=9A=84=E6=AD=A6=E5=B0=86=E6=8A=80=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/mobile.js | 145 +++++++++++++++++++++++++++++++------------- 1 file changed, 102 insertions(+), 43 deletions(-) diff --git a/character/mobile.js b/character/mobile.js index b00b5b428..0d525c990 100644 --- a/character/mobile.js +++ b/character/mobile.js @@ -972,32 +972,95 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, enable:'phaseUse', usable:1, - filterTarget:lib.filter.notMe, + // filterTarget:lib.filter.notMe, content:function(){ + 'step 0' player.damage('nosource'); - target.damage('unreal'); + 'step 1' + if(game.countPlayer()<2) event.finish(); + if(game.countPlayer()==2) event._result={bool:true,targets:[game.findPlayer(i=>i!=player),player]}; + else player.chooseTarget(`慧夭:请选择两名角色`,`令不为你的第一名角色视为对第二名角色造成过1点伤害。`,(card,player,target)=>{ + if(!ui.selected.targets.length) return player!=target; + return true; + },2,true).set('multitarget',true).set('targetprompt',['伤害来源','受伤角色']).set('ai',target=>{ + return target==get.event('aiTargets')[ui.selected.targets.length]?10:0; + }).set('aiTargets',lib.skill.mbhuiyao.getUnrealDamageTargets(player,[game.filterPlayer(i=>i!=player),game.filterPlayer()],true)); + 'step 2' + if(result.bool){ + var targets=result.targets; + player.line2(targets,'green'); + game.delaye(); + targets[1].damage(targets[0],'unreal'); + } + }, + getUnrealDamageTargets:(player,lists,forced)=>{ + const targets=[null,null]; + let sourceList,targetList; + if(lists.length==2&&lists.every(l=>Array.isArray(l))){ + sourceList=lists[0]; targetList=lists[1]; + } + else{ + sourceList=lists.slice(); targetList=lists.slice(); + } + const list=targetList.map(current=>{ + const _hp=current.hp,_maxhp=current.maxHp; + current.hp=100; current.maxHp=100; + const att=-get.sgnAttitude(player,current); + let val=get.damageEffect(current,player,current)*att; + current.getSkills(null,false,false).forEach(skill=>{ + const info=get.info(skill); + if(info&&info.ai&&(info.ai.maixie||info.ai.maixie_hp||info.ai.maixie_defend)) val=Math[val>0?'max':'min'](val>0?0.1:-0.1,val+2*att); + }); + const eff=100/val+15; + current.hp=_hp; current.maxHp=_maxhp; + return [current,eff]; + }).sort((a,b)=>b[1]-a[1])[0]; + if(list[1]<0&&!forced) return targets; + const targetx=list[0]; + targets[1]=targetx; + const list2=sourceList.filter(i=>i!=targetx).map(current=>{ + const _hp=targetx.hp,_maxhp=targetx.maxHp; + targetx.hp=100; targetx.maxHp=100; + const att=-get.sgnAttitude(player,current); + const eff=get.damageEffect(targetx,current,current)*att; + targetx.hp=_hp; targetx.maxHp=_maxhp; + return [current,eff]; + }).sort((a,b)=>b[1]-a[1])[0]; + if(!list2) return targets; + targets[0]=list2[0]; + return targets; }, ai:{ order:6, result:{ - target:function(player,target){ - if(player.getHp()+player.countCards('hs',card=>player.canSaveCard(card,player))<1) return 0; - var _hp=target.hp,_maxhp=target.maxHp; - target.hp=10; target.maxHp=10; - var att=-get.sgnAttitude(player,target); - var val=get.damageEffect(target,player,target)*att; - target.getSkills(null,false,false).forEach(skill=>{ - var info=get.info(skill); - if(info&&info.ai&&(info.ai.maixie||info.ai.maixie_hp||info.ai.maixie_defend)) val=Math[val>0?'max':'min'](val>0?0.1:-0.1,val+2*att); - }); - var eff=100/val; - target.hp=_hp; target.maxHp=_maxhp; - var limit=17.5; - if(player.hasSkill('mbquesong')){ - if(!player.getStat().damaged) limit+=7.5; + player:function(player){ + if(player.getHp()+player.countCards('hs',card=>player.canSaveCard(card,player))<=1) return 0; + var limit=25; + var quesong=player.hasSkill('mbquesong')&&!player.getStat().damaged; + if(quesong){ + limit-=7.5; } - if(eff{ + var att=get.attitude(player,target); + if(att<0) return false; + return att*Math.sqrt(Math.max(1,[1,2,3,4].reduce((p,c)=>p+target.countEmptySlot(c),0)))>=10||target.getHp()<=2; + })) return 1; + if(!quesong&&game.hasPlayer(target=>{ + if(target==player) return false; + var _hp=target.hp,_maxhp=target.maxHp; + target.hp=100; target.maxHp=100; + var att=-get.sgnAttitude(player,target); + var val=get.damageEffect(target,player,target)*att; + target.getSkills(null,false,false).forEach(skill=>{ + var info=get.info(skill); + if(info&&info.ai&&(info.ai.maixie||info.ai.maixie_hp||info.ai.maixie_defend)) val=Math[val>0?'max':'min'](val>0?0.1:-0.1,val+2*att); + }); + var eff=100/val; + target.hp=_hp; target.maxHp=_maxhp; + if(eff{ var player=_status.event.player; if(get.attitude(player,target)<=0) return 0; - var len=[1,2,3,4,5].reduce((p,c)=>p+target.countEmptySlot(c),0);hp=target.getHp(); + var len=Math.max(1,[1,2,3,4].reduce((p,c)=>p+target.countEmptySlot(c),0)),hp=target.getHp(); return len+target.isTurnedOver()*2+1.5*Math.min(4,target.getDamagedHp())/(hp+1); }); 'step 1' @@ -1022,22 +1085,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var target=result.targets[0]; event.target=target; player.logSkill('mbquesong',target); - var len=[1,2,3,4,5].reduce((p,c)=>p+target.countEmptySlot(c),0);hp=target.getHp(); - var forced=false; - if(len==0) forced=true; - if(hp==0||target.countCards('h')p+target.countEmptySlot(c),0)),hp=target.getHp(); + if(hp==0||target.countCards('h'){ - if(!_status.event.goon) return 0; + var str=`是否弃置${get.cnNumber(hp)}张手牌并回复1点体力?或点击“取消”摸${get.cnNumber(len)}张牌并复原武将牌。`; + target.chooseToDiscard(get.translation(player)+'对你发动了【雀颂】',str,'h',hp).set('ai',card=>{ + if(!get.event('goon')) return 0; return 6-get.value(card); }).set('goon',function(){ var _hp=hp+target.isTurnedOver()*1.5; - if(forced||_hp+player.countCards('hs',card=>get.tag(card,'recover'))<=2-len/4) return true; - return len>_hp; + if(_hp+player.countCards('hs',card=>get.tag(card,'recover'))<=2-len/4) return true; + return len<=_hp; }()); } } @@ -1048,12 +1106,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ event.finish(); } else{ - target.draw([1,2,3,4,5].reduce((p,c)=>p+target.countEmptySlot(c),0)); + target.draw(Math.max(1,[1,2,3,4].reduce((p,c)=>p+target.countEmptySlot(c),0))); } 'step 3' - player.link(false); + target.link(false); 'step 4' - player.turnOver(false); + target.turnOver(false); }, ai:{ expose:0.2, @@ -11305,10 +11363,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){ @@ -12622,7 +12681,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 3' if(result.bool){ trigger.player.gain(event.card,'give',player,'bySelf'); - player.chooseBool('是否对'+get.translation(trigger.player)+'造成一点伤害?').ai=function(){ + player.chooseBool('是否对'+get.translation(trigger.player)+'造成1点伤害?').ai=function(){ return get.damageEffect(trigger.player,player,player)>0 }; } @@ -12968,7 +13027,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ event.ingame=game.hasPlayer(function(current){ return ['re_xushu','xin_xushu','xushu','dc_xushu'].contains(current.name)||['re_xushu','xin_xushu','xushu','dc_xushu'].contains(current.name2); })?true:false; - var prompt='请选择一名角色,令其回复一点体力并摸一张牌'; + var prompt='请选择一名角色,令其回复1点体力并摸一张牌'; prompt+=event.ingame?',然后你摸一张牌。':'。'; player.chooseTarget(prompt).set('ai',function(target){ var player=_status.event.player; @@ -15534,9 +15593,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ yj_zhoubuyi:'☆周不疑', yj_zhoubuyi_prefix:'☆', mbhuiyao:'慧夭', - mbhuiyao_info:'出牌阶段限一次。你可以受到1点无来源伤害,视为对一名其他角色造成过1点伤害。', + mbhuiyao_info:'出牌阶段限一次。你可以受到1点无来源伤害,然后你选择一名其他角色,令其视为对另一名角色造成过1点伤害。', mbquesong:'雀颂', - mbquesong_info:'一名角色的结束阶段,若你于本回合受到过伤害,你可以令一名角色选择一项:1.摸等同于其装备区中空栏的数量的牌并复原武将牌;2.弃置等同于其体力值的手牌并回复1点体力。', + mbquesong_info:'一名角色的结束阶段,若你于本回合受到过伤害,你可以令一名角色选择一项:1.摸等同于其装备区中非宝物栏中空栏的数量的牌并复原武将牌(至少摸一张牌);2.弃置等同于其体力值的手牌并回复1点体力。', xin_yuanshao:'手杀界袁绍', xin_yuanshao_prefix:'手杀界', re_baosanniang:'手杀鲍三娘', From 62a19413f92095b2469d70f6e9e7944165ef0ca6 Mon Sep 17 00:00:00 2001 From: copcap Date: Sun, 12 Nov 2023 17:51:09 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A7=A3=E9=99=A4=E6=A0=87=E5=B7=A6?= =?UTF-8?q?=E6=85=88=E5=9C=A8=E6=89=80=E6=9C=89=E8=81=94=E6=9C=BA=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=E7=9A=84=E7=A6=81=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mode/doudizhu.js | 10 +++++----- mode/identity.js | 4 ++-- mode/versus.js | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mode/doudizhu.js b/mode/doudizhu.js index 1fc86e9a8..1cecbb59b 100644 --- a/mode/doudizhu.js +++ b/mode/doudizhu.js @@ -1137,7 +1137,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ for(var i=0;i