From 75c1dd26c74ea501444e869ca77ae33fea70d0b5 Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Sat, 30 Sep 2023 00:58:01 +0800 Subject: [PATCH] bug fixs --- card/yingbian.js | 2 +- character/extra.js | 54 ++++++++++++++++++++++++++----------------- character/huicui.js | 17 +++++++------- character/jsrg.js | 2 +- character/xianding.js | 12 ++++++---- character/yijiang.js | 2 +- game/game.js | 4 +--- 7 files changed, 54 insertions(+), 39 deletions(-) diff --git a/card/yingbian.js b/card/yingbian.js index e956f3fa4..79eb64103 100644 --- a/card/yingbian.js +++ b/card/yingbian.js @@ -381,7 +381,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ trigger:{player:'equipAfter'}, forced:true, equipSkill:true, - filter:(event,player)=>event.card.name=='tianjitu'&&player.hasCard(card=>card!=event.card), + filter:(event,player)=>event.card.name=='tianjitu'&&player.hasCard(card=>card!=event.card,'he'), content:()=>{ player.chooseToDiscard(true,card=>card!=_status.event.getTrigger().card,'he'); }, diff --git a/character/extra.js b/character/extra.js index e6069fdc9..b70730d4c 100755 --- a/character/extra.js +++ b/character/extra.js @@ -624,19 +624,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ audio:2, trigger:{player:'useCardAfter'}, filter:function(event,player){ - if(event.skill=='dccuixin') return false; - if(event.targets.length==0) return false; - if(get.type(event.card,false)=='delay'||get.type(event.card,false)=='equip') return false; + if(!event._dccuixin||get.type(event.card,false)=='delay'||get.type(event.card,false)=='equip') return false; var card={ name:event.card.name, nature:event.card.nature, isCard:true, - } - for(var target of event.targets){ - var targetx; - if(target==player.getNext()) targetx=player.getPrevious(); - else if(target==player.getPrevious()) targetx=player.getNext(); - else continue; + },list=event._dccuixin; + for(var target of list){ + var targetx=player[target](); if(lib.filter.targetEnabled2(card,targetx,player)) return true; } return false; @@ -650,21 +645,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){ isCard:true, }; event.card=card; - var list=trigger.targets.filter(target=>{ - var targetx; - if(target==player.getNext()) targetx=player.getPrevious(); - else if(target==player.getPrevious()) targetx=player.getNext(); - else return false; - if(lib.filter.targetEnabled2(card,targetx,player)) return true; - }).map(target=>{ - return target==player.getPrevious()?player.getNext():player.getPrevious(); + var list=[]; + trigger._dccuixin.forEach(target=>{ + var targetx=player[target](); + if(lib.filter.targetEnabled2(card,targetx,player)) list.add(targetx); }); if(list.length==1){ event.target=list[0]; - player.chooseBool('摧心:是否再视为对'+get.translation(list[0])+'使用'+get.translation(card)+'?').set('goon',get.effect(list[0],card,player,player)>0).set('ai',()=>_status.event.goon); + player.chooseBool('摧心:是否视为对'+get.translation(list[0])+'使用'+get.translation(card)+'?').set('goon',get.effect(list[0],card,player,player)>0).set('ai',()=>_status.event.goon); } else{ - player.chooseTarget('摧心:是否再视为对上家或下家使用'+get.translation(card)+'?','操作提示:从上家或下家中选择一名角色作为使用目标',function(card,player,target){ + player.chooseTarget('摧心:是否视为对上家或下家使用'+get.translation(card)+'?','操作提示:从上家或下家中选择一名角色作为使用目标',function(card,player,target){ return (target==player.getNext()||target==player.getPrevious())&&lib.filter.targetEnabled2(_status.event.getParent().card,target,player); }).set('ai',function(target){ var player=_status.event.player; @@ -677,6 +668,28 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.useCard(card,target,false,'dccuixin'); } }, + group:'dccuixin_silent', + subSkill:{ + silent:{ + trigger:{player:'useCardToPlayered'}, + silent:true, + forced:true, + popup:false, + firstDo:true, + charlotte:true, + filter:function(event,player){ + if(!event.isFirstTarget||event.getParent().skill=='dccuixin') return false; + if(event.targets.length==0) return false; + return event.targets.includes(player.getNext())||event.targets.includes(player.getPrevious()); + }, + content:function(){ + var list=[]; + if(trigger.targets.includes(player.getNext())) list.push('getPrevious'); + if(trigger.targets.includes(player.getPrevious())) list.push('getNext'); + trigger.getParent()._dccuixin=list; + } + }, + }, }, //海外神吕蒙 twshelie:{ @@ -2828,7 +2841,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ tspowei:{ audio:3, dutySkill:true, - locked:true, derivation:'shenzhu', group:['tspowei_init','tspowei_move','tspowei_achieve','tspowei_fail','tspowei_use','tspowei_remove'], subSkill:{ @@ -7364,7 +7376,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ dcqijing:'奇径', dcqijing_info:'觉醒技。一名角色的回合结束后,若你的三个副区域标签均被激活,则你减1点体力上限,将座位移动至一名其他角色的上家之后,获得〖摧心〗和一个额外回合。', dccuixin:'摧心', - dccuixin_info:'当你不因此技能使用的基本牌或普通锦囊牌结算结束后,若此牌的目标包含你的上家或下家,则你可以视为对下家或上家再使用一张牌名和元素相同的牌。', + dccuixin_info:'当你不因此技能使用的基本牌或普通锦囊牌结算结束后,若此牌的目标于你使用此牌指定第一个目标时包含你的上家或下家,则你可以视为对下家或上家再使用一张牌名和元素相同的牌。', shen_dianwei:'神典韦', juanjia:'捐甲', juanjia_info:'锁定技。游戏开始时,你废除一个防具栏,然后获得一个额外的武器栏。', diff --git a/character/huicui.js b/character/huicui.js index 6dbd9710d..9ff80eb21 100644 --- a/character/huicui.js +++ b/character/huicui.js @@ -2619,15 +2619,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(result.bool){ var cards=result.cards,targets=result.targets; event.cards=cards; - var cardx=get.autoViewAs({name:'sha'},cards); - event.cardx=cardx; - player.useCard(cardx,cards,targets,false,'dcsaowei'); + var next=player.useCard({name:'sha'},cards,targets,false,'dcsaowei'); + player.when('useCardAfter') + .filter(event=>event==next) + .then(()=>{ + if(player.hasHistory('sourceDamage',evt=>evt.card==trigger.card)){ + var cards=trigger.cards.filterInD(); + if(cards.length>0) player.gain(cards,'gain2'); + } + }) } - else event.finish(); - 'step 2' - if(player.getHistory('sourceDamage',function(evt){ - return evt.card==event.cardx; - }).length&&cards.filterInD().length) player.gain(cards.filterInD(),'gain2'); }, }, //向朗 diff --git a/character/jsrg.js b/character/jsrg.js index 6f4592ad8..b2d5fbacb 100644 --- a/character/jsrg.js +++ b/character/jsrg.js @@ -2367,7 +2367,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ direct:true, content:function(){ 'step 0' - player.chooseToDiscard(get.prompt('jsrgjuelie',trigger.target),'当你使用【杀】指定一名角色为目标后,你可以弃置任意张牌,然后弃置其等量的牌',[1,Infinity],'he').set('ai',card=>{ + player.chooseToDiscard(get.prompt('jsrgjuelie',trigger.target),'当你使用【杀】指定一名角色为目标后,你可以弃置任意张牌,然后弃置其等量的牌,然后若你的手牌数或体力值最小,此【杀】对其的伤害基数+1。',[1,Infinity],'he').set('ai',card=>{ if(ui.selected.cards.length>=_status.event.max) return 0; if(_status.event.goon) return 4.5-get.value(card); return 0; diff --git a/character/xianding.js b/character/xianding.js index 35837a4b9..df5ea5b05 100644 --- a/character/xianding.js +++ b/character/xianding.js @@ -137,7 +137,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var piles=['cardPile','discardPile']; for(var pile of piles){ for(var i=0;i=target.getHp()||player.hasSkillTag('jueqing')) return; if(player._dcxiongmu_temp) return; if(_status.event.getParent('useCard',true)||_status.event.getParent('_wuxie',true)) return; if(get.tag(card,'damage')){ @@ -200,7 +200,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ minus:{ trigger:{player:'damageBegin4'}, filter:function(event,player){ - return game.getGlobalHistory('everything',evt=>{ + return player.countCards('h'){ return evt.name=='damage'&&evt.player==player; },event).indexOf(event)==0; }, @@ -3799,7 +3799,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return 0; } var num=ui.selected.buttons.filter(i=>get.owner(i.link)==target).length; - return -(get.position(card)!='h'?get.value(card,target):(4.5+Math.random()-0.2*(num>2?1:0)))*get.attitude(player,target); + var val=get.buttonValue(button); + if(num>2) val/=Math.sqrt(num); + if(get.attitude(player,owner)>0) return -val; + return val; + //return -(get.position(card)!='h'?get.value(card,target):(4.5+Math.random()-0.2*(num>2?1:0)))*get.attitude(player,target); }); 'step 1' if(result.bool){ diff --git a/character/yijiang.js b/character/yijiang.js index 76404d57f..d1506b4ff 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -484,12 +484,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }()); 'step 1' var guessedNum=result.index; - var type=get.type2(trigger.card,trigger.player); player.chat('我猜'+get.cnNumber(guessedNum)+'张'); game.log(player,'猜测',trigger.player,'有',get.cnNumber(guessedNum)+'张'+get.translation(type)+'牌'); event.guessedNum=guessedNum; game.delay(); 'step 2' + var type=get.type2(trigger.card,trigger.player); var count=trigger.player.countCards('h',card=>get.type2(card)==type); var guessedNum=event.guessedNum; if(count==guessedNum){ diff --git a/game/game.js b/game/game.js index c066497cd..17c8e296a 100644 --- a/game/game.js +++ b/game/game.js @@ -13778,13 +13778,11 @@ lib.onphase[i](); } player.phase(); + event.player=player.next; "step 2" if(!game.players.contains(event.player.next)){ event.player=game.findNext(event.player.next); } - else{ - event.player=event.player.next; - } event.goto(1); }, loadPackage:function(){