From 0ff2dc60d98b6a94268dd8982aa39f0137effffb Mon Sep 17 00:00:00 2001 From: copcap Date: Mon, 20 Nov 2023 09:34:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=9D=80=E6=96=B0=E5=B0=86bugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- character/extra.js | 15 ++--- character/mobile.js | 25 ++++++--- character/sb.js | 128 ++++++++++++++++++++++++++++--------------- character/tw.js | 2 +- character/yijiang.js | 4 +- 5 files changed, 109 insertions(+), 65 deletions(-) diff --git a/character/extra.js b/character/extra.js index 1e28ea6c2..02141339d 100755 --- a/character/extra.js +++ b/character/extra.js @@ -128,7 +128,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(wuqinxi=='鹿'){ player.logSkill('wuling_wuqinxi'); player.recover(); - player.discard(player.getCards('j')); + player.discard(player.getCards('j')).discarder=player; } }, ai:{ @@ -156,7 +156,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, trigger:{ source:'damageBegin1', - player:['phaseBegin','damageBegin2','phaseUseBegin'], + player:['phaseBegin','damageBegin4','phaseUseBegin'], }, filter:function(event,player,name){ var wuqinxi=player.storage.wuling_wuqinxi; @@ -167,15 +167,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(wuqinxi!='虎'||!event.card) return false; var evt=event.getParent('useCard'); return evt.targets&&evt.targets.length==1&&evt.targets.includes(event.player); - break; - case 'damageBegin2': + case 'damageBegin4': return wuqinxi=='熊'; - break; default: if(wuqinxi=='鹤') return true; if(wuqinxi!='猿') return false; return game.hasPlayer(target=>target.countGainableCards(player,'e')); - break; } }, forced:true, @@ -197,7 +194,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger.num++; event.finish(); break; - case 'damageBegin2': + case 'damageBegin4': trigger.num--; event.finish(); break; @@ -259,11 +256,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:function(){ 'step 0' var cards=_status.renku.slice(); - game.cardsDiscard(cards); + game.cardsDiscard(cards).fromRenku=true; _status.renku.removeArray(cards); player.$throw(cards,1000); game.updateRenku(); - game.log(cards,'被置入了弃牌堆'); + game.log(cards,'从仁库进入了弃牌堆'); 'step 1' var targets=game.filterPlayer(); player.line(targets); diff --git a/character/mobile.js b/character/mobile.js index 89c149bb3..5b992ff4a 100644 --- a/character/mobile.js +++ b/character/mobile.js @@ -411,7 +411,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var num=player.countDiscardableCards(player,'he'); if(num){ var result=yield player.chooseToDiscard('纳学:弃置任意张牌并摸等量的牌',[1,num],true).set('ai',lib.skill.zhiheng.check); - if(result.bool) player.draw(result.cards.length); + if(result.bool) yield player.draw(result.cards.length); } if(player.countCards('he')){ var result2=yield player.chooseCardTarget({ @@ -449,16 +449,25 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, forced:true, forceDie:true, + skillAnimation:true, + animationColor:'orange', + logTarget:function(event,player){ + return game.filterPlayer(target=>target!=player); + }, content:function(){ + 'step 0' var targets=game.filterPlayer(target=>target!=player); var sum=targets.reduce((num,target)=>num+=target.hp,0); sum=Math.max(1,Math.floor(sum/targets.length)); - targets.forEach(target=>{ - if(target.hp!=sum){ - game.log(target,'将体力从',target.hp,'改为',sum); - target.changeHp(sum-target.hp)._triggered=null; - } - }); + event.num=sum; + event.targets=targets; + 'step 1' + var target=targets.shift(); + var delta=target.hp-num; + if(delta!=0){ + target[delta>0?'loseHp':'recover'](Math.abs(delta)); + } + if(targets.length) event.redo(); }, }, //阎象 @@ -15745,7 +15754,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ naxue:'纳学', naxue_info:'你可以跳过出牌阶段。若如此做,你弃置任意张牌并摸等量的牌,然后交给一名其他角色至多两张牌。', yijie:'遗诫', - yijie_info:'锁定技,当你死亡时,所有其他角色将体力调整为X(X为所有其他角色的体力值之和除以所有其他角色数,向下取整,且X至少为1)。', + yijie_info:'锁定技。当你死亡时,你令所有其他角色将体力回复或失去至X(X为所有其他角色的体力之和除以所有其他角色数,向下取整,且X至少为1)。', mobile_standard:'手杀异构·标准包', mobile_shenhua_feng:'手杀异构·其疾如风', diff --git a/character/sb.js b/character/sb.js index 52353d519..687a3ed63 100644 --- a/character/sb.js +++ b/character/sb.js @@ -61,32 +61,19 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(get.type2(card)=='trick') return true; }, }, - init:function(player){ - var skill='sbqicai_'+player.playerid; - if(!lib.skill[skill]){ - lib.skill[skill]={ - onremove:true, - mark:true, - marktext:'奇', - intro:{ - markcount:function(storage){ - return (storage||0).toString(); - }, - content:function(storage){ - return '已被掠夺'+(storage||0)+'张普通锦囊牌'; - }, - }, - }; - lib.translate[skill]='奇才'; - lib.translate[skill+'_bg']='奇'; - } - }, getLimit:3, audio:2, enable:'phaseUse', + onChooseToUse:function(event){ + if(!event.sbqicai&&!game.online){ + const player=get.player(); + const cards=Array.from(ui.discardPile.childNodes).filter(card=>lib.skill.sbqicai.filterCardx(card,player)); + event.set('sbqicai',cards); + } + }, filter:function(event,player){ if(!game.hasPlayer(target=>target!=player&&target.hasEmptySlot(2))) return false; - return player.countCards('h',card=>lib.skill.sbqicai.filterCardx(card,player))||Array.from(ui.discardPile.childNodes).some(card=>lib.skill.sbqicai.filterCardx(card,player)); + return player.countCards('h',card=>lib.skill.sbqicai.filterCardx(card,player))||event.sbqicai&&event.sbqicai.length; }, filterCardx:function(card,player){ if(player.getStorage('sbqicai').includes(card.name)) return false; @@ -95,8 +82,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){ usable:1, chooseButton:{ dialog:function(event,player){ - var list1=player.getCards('h',card=>lib.skill.sbqicai.filterCardx(card,player)); - var list2=Array.from(ui.discardPile.childNodes).filter(card=>lib.skill.sbqicai.filterCardx(card,player)); + const list1=player.getCards('h',card=>lib.skill.sbqicai.filterCardx(card,player)); + const list2=event.sbqicai; var dialog=ui.create.dialog('###奇才###
请选择一张防具牌置入一名其他角色的装备区
'); if(list1.length){ dialog.add('
手牌区
'); @@ -105,6 +92,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(list2.length){ dialog.add('
弃牌堆
'); dialog.add(list2); + if(list1.length) dialog.classList.add('fullheight'); } return dialog; }, @@ -143,7 +131,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.markAuto('sbqicai',[cards[0].name]); target.equip(cards[0]); player.addSkill('sbqicai_gain'); - target.addSkill('sbqicai_'+player.playerid); + lib.skill.sbqicai.updateCounter(player,target,0); }, ai:{ result:{ @@ -161,6 +149,40 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return '请选择置入'+get.translation(links)+'的角色'; }, }, + updateCounter:function(player,target,num){ + const skill=`sbqicai_${player.playerid}`; + game.broadcastAll(lib.skill.sbqicai.initSkill,skill); + if(!target.hasSkill(skill)) target.addSkill(skill); + if(num==0) target.clearMark(skill,false); + else if(num>0) target.addMark(skill,num,false); + if(target.countMark(skill)>=lib.skill.sbqicai.getLimit) target.removeSkill(skill); + if(!_status.postReconnect.sbqicai){ + _status.postReconnect.sbqicai=[ + lib.skill.sbqicai.initSkill, + [] + ]; + } + _status.postReconnect.sbqicai[1].add(skill); + }, + initSkill:skill=>{ + if(!lib.skill[skill]){ + lib.skill[skill]={ + onremove:true, + mark:true, + marktext:'奇', + intro:{ + markcount:function(storage){ + return (storage||0).toString(); + }, + content:function(storage){ + return '已被掠夺'+get.cnNumber(storage||0)+'张普通锦囊牌'; + }, + }, + }; + lib.translate[skill]='奇才'; + lib.translate[skill+'_bg']='奇'; + } + }, ai:{ order:7, result:{ @@ -170,6 +192,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, }, }, + marktext:'才', intro:{content:'已使用$发动过此技能'}, subSkill:{ gain:{ @@ -183,14 +206,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }); }, forced:true, + direct:true, + charlotte:true, content:function(){ 'step 0' + if(!event.checkedTargets) event.checkedTargets=[]; var target=game.findPlayer(function(current){ if(!trigger.getg(current).length||!current.hasSkill('sbqicai_'+player.playerid)) return false; + if(event.checkedTargets.includes(current)) return false; if(current.countMark('sbqicai_'+player.playerid)>=lib.skill.sbqicai.getLimit) return false; return trigger.getg(current).some(card=>get.type(card)=='trick'&&lib.filter.canBeGained(card,current,player)); }); + if(!target){ + event.finish(); + return; + } event.target=target; + player.logSkill('sbqicai_gain',target); + event.checkedTargets.add(target); var cards=trigger.getg(target).filter(card=>get.type(card)=='trick'&&lib.filter.canBeGained(card,target,player)); if(cards.length<=lib.skill.sbqicai.getLimit-target.countMark('sbqicai_'+player.playerid)) event._result={bool:true,links:cards}; else{ @@ -201,9 +234,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } 'step 1' if(result.bool){ + game.delaye(0.5); target.give(result.links,player); - target.addMark('sbqicai_'+player.playerid,result.links.length,false); + lib.skill.sbqicai.updateCounter(player,target,result.links.length); } + event.goto(0); }, }, }, @@ -365,7 +400,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return event.player!=player&&player.getStorage('sbkanpo').includes(event.card.name); }, prompt2:function(event,player){ - return '移除'+get.translation(event.card.name)+',令'+get.translation(event.card)+'失效'; + return '移除'+get.translation(event.card.name)+'的记录,令'+get.translation(event.card)+'无效'; }, check:function(event,player){ var effect=0; @@ -423,12 +458,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var cards=player.getCards('s',card=>card.hasGaintag('sbguanxing')); if(cards.length){ player.chooseToMove().set('list',[ - ['“星”',cards], + ['你的“星”',cards], ['牌堆顶'], ]).set('prompt','观星:点击将牌移动到牌堆顶').set('processAI',function(list){ var cards=list[0][1].slice(),player=_status.event.player; var name=_status.event.getTrigger().name; - var target=(name=='phaseBegin'?player:target); + var target=(name=='phaseZhunbei'?player:target); var top=[],att=get.sgn(get.attitude(player,target)); if(att!=0&&(target!=player||!player.hasWuxie())){ for(var i=0;i=0;i--){ - player.lose([cards[i]],ui.cardPile,'insert'); - } + player.loseToDiscardpile(cards,ui.cardPile,'insert').log=false; + game.log(player,'将',cards,'置于了牌堆顶'); } - else if(trigger.name=='phaseBegin') player.addTempSkill('sbguanxing_on'); + else if(trigger.name=='phaseZhunbei') player.addTempSkill('sbguanxing_on'); }, group:'sbguanxing_unmark', subSkill:{ @@ -495,22 +528,27 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, sbkongcheng:{ audio:2, - trigger:{player:'damageBegin2'}, - filter:function(event,player){ + trigger:{player:['damageBegin3','damageBegin4']}, + filter:function(event,player,name){ return player.hasSkill('sbguanxing'); }, forced:true, content:function(){ 'step 0' var num=player.countCards('s',card=>card.hasGaintag('sbguanxing')); - event.num=num; - if(!num){ - trigger.num++; - event.finish(); + if(!num&&event.triggername=='damageBegin3'){ + trigger.increase('num'); + } + else if(num&&event.triggername=='damageBegin4'){ + player.judge(function(result){ + if(get.number(result)<=get.player().countCards('s',card=>card.hasGaintag('sbguanxing'))) return 2; + return -1; + }).set('judge2',result=>result.bool).set('callback',function(){ + if(event.judgeResult.number<=player.countCards('s',card=>card.hasGaintag('sbguanxing'))){ + event.getParent('sbkongcheng').getTrigger().decrease('num'); + } + }); } - else player.judge(); - 'step 1' - if(result.number<=num) trigger.num--; }, }, //卢植 @@ -5571,14 +5609,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){ sbkanpo:'看破', sbkanpo_info:'①一轮开始时,你清除“看破”记录的牌名,然后你可以记录三个非此次移去的牌名的牌名。②一名其他角色使用你“看破”记录的牌名的牌时,你可以从“看破”中移去此牌名,令此牌无效。', sbguanxing:'观星', - sbguanxing_info:'①准备阶段,你将武将牌上所有“星”置入弃牌堆,将牌堆顶的X张牌称为“星”置于你的武将牌上(X为你此次移去的“星”数+1且至多为7,若本次为第一次发动〖观星〗则X为7),然后你可以将任意张“星”置于牌堆顶,若你未将任意“星”置于牌堆顶,你可以于结束阶段将任意张“星”置于牌堆顶。②你可以如手牌般使用或打出“星”。', + sbguanxing_info:'①准备阶段,你将所有“星”置入弃牌堆,将牌堆顶的X张牌置于你的武将牌上,称为“星”。然后你可以将任意张“星”置于牌堆顶(X为你此次移去的“星”数+1且至多为7,若你此前未发动过〖观星①〗则X为7)。②结束阶段,若你未于本回合的准备阶段将“星”置于过牌堆顶,你可以将任意张“星”置于牌堆顶。③你可以如手牌般使用或打出“星”。', sbkongcheng:'空城', - sbkongcheng_info:'锁定技,当你受到伤害时,若你拥有技能〖观星〗,则:若你有“星”,你进行一次判定,若判定结果点数小于等于你的“星”,则此伤害-1;没有“星”,此伤害+1。', + sbkongcheng_info:'锁定技。当你受到伤害时,若你有〖观星〗,且若你:有“星”,你判定,若结果点数不大于你的“星”数,此伤害-1;没有“星”,此伤害+1。', sb_huangyueying:'谋黄月英', sb_huangyueying_prefix:'谋', sbqicai:'奇才', sbqicai_backup:'奇才', - sbqicai_info:'①出牌阶段限一次,你可以将手牌中或弃牌堆中的一张防具牌置于一名其他角色的装备栏,然后其须将之后获得的前三张基本锦囊牌交给你。②你使用锦囊牌无距离限制。', + sbqicai_info:'①出牌阶段限一次。你可以将手牌中或弃牌堆中的一张防具牌置于一名其他角色的防具栏,然后其获得如下效果:当其得到普通锦囊牌后,其将此牌交给你(限三张)。②你使用锦囊牌无距离限制。', sbjizhi:'集智', sbjizhi_info:'锁定技,当你使用一张普通锦囊牌时,你摸一张牌,且此牌本回合不计入你的手牌上限。', diff --git a/character/tw.js b/character/tw.js index 5cb3b4060..825faafa0 100644 --- a/character/tw.js +++ b/character/tw.js @@ -956,7 +956,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ game.checkGlobalHistory('cardMove',function(evt){ if(evt.name=='cardsDiscard'&&evt.getParent('phaseDiscard')==event) cards.addArray(evt.cards); }); - return cards; + return cards.filterInD('d'); }, audio:2, sunbenSkill:true, diff --git a/character/yijiang.js b/character/yijiang.js index 4ba15cab3..3743631e6 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -404,6 +404,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ 'step 1' if(result.bool){ var suits=result.links.map(i=>i[2].slice(6)); + player.logSkill('qingbei'); player.addTempSkill('qingbei_effect','roundStart'); player.setStorage('qingbei_effect',suits); player.markSkill('qingbei_effect'); @@ -418,12 +419,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{player:'useCardAfter'}, charlotte:true, onremove:true, + forced:true, filter:function(event,player){ if(!lib.suit.includes(get.suit(event.card))) return false; return player.getStorage('qingbei_effect').length; }, - direct:true, - firstDo:true, content:function(){ player.draw(player.getStorage('qingbei_effect').length); },