From 5a20089ca5684f33db3c7148efe07c4ace6964c8 Mon Sep 17 00:00:00 2001 From: Tipx-L <138244655+Tipx-L@users.noreply.github.com> Date: Tue, 5 Sep 2023 22:11:56 -0700 Subject: [PATCH] Various fix. --- character/clan.js | 4 +++- character/jsrg.js | 12 ++++-------- game/game.js | 32 +++++++++++++++++++------------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/character/clan.js b/character/clan.js index d665d3244..1919aa53d 100644 --- a/character/clan.js +++ b/character/clan.js @@ -293,7 +293,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var info=get.info(skill); if(info.charlotte) return false; var translation=get.skillInfoTranslation(skill,event.player); - if(!translation||translation.match(/“?出牌阶段限一次/g).every(value=>value!='出牌阶段限一次')) return false; + if(!translation) return false; + var match=translation.match(/“?出牌阶段限一次/g); + if(!match||match.every(value=>value!='出牌阶段限一次')) return false; return event.player.countCards('h')>0; }, check:function(event,player){ diff --git a/character/jsrg.js b/character/jsrg.js index 5ccdfb7f6..dfc12d53d 100644 --- a/character/jsrg.js +++ b/character/jsrg.js @@ -4019,13 +4019,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, jsrglinghua:{ audio:2, - locked:false, - mod:{ - judge:(player,result)=>{ - const parent=_status.event.getParent(2); - if(parent.name=='jsrglinghua'&&parent.triggername=='phaseJieshuBegin') result.bool=!result.bool; - } - }, trigger:{ player:['phaseZhunbeiBegin','phaseJieshuBegin'], }, @@ -4048,7 +4041,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }, content:function(){ 'step 0' - event.executeDelayCardEffect=player.executeDelayCardEffect('shandian'); + var next=event.executeDelayCardEffect=player.executeDelayCardEffect('shandian'); + if(event.triggername!='phaseJieshuBegin') return; + next.judge=card=>-lib.card.shandian.judge(card)-4; + next.judge2=result=>!lib.card.shandian.judge2(result); 'step 1' var executeDelayCardEffect=event.executeDelayCardEffect; if(!player.hasHistory('damage',evt=>evt.getParent(2)==executeDelayCardEffect)){ diff --git a/game/game.js b/game/game.js index f740aca62..bc19bb20c 100644 --- a/game/game.js +++ b/game/game.js @@ -11021,23 +11021,27 @@ event.nojudge=true; } 'step 1' - if(!event.cancelled&&!event.nojudge) player.judge(card); + if(event.cancelled||event.nojudge) return; + var next=player.judge(card),judge=event.judge; + if(typeof judge=='function') next.judge=judge; + var judge2=event.judge2; + if(typeof judge2=='function') next.judge2=judge2; 'step 2' if(event.excluded) delete event.excluded; else{ - const cardName=event.cardName; + var cardName=event.cardName; if(event.cancelled&&!event.direct){ - const cardCancel=lib.card[cardName].cancel; + var cardCancel=lib.card[cardName].cancel; if(cardCancel){ - const next=game.createEvent(`${cardName}Cancel`); + var next=game.createEvent(`${cardName}Cancel`); next.setContent(cardCancel); next.cards=[card]; if(!card.viewAs){ - const autoViewAs=next.card=get.autoViewAs(card); + var autoViewAs=next.card=get.autoViewAs(card); autoViewAs.expired=card.expired; } else{ - const autoViewAs=next.card=get.autoViewAs({ + var autoViewAs=next.card=get.autoViewAs({ name:cardName },next.cards); autoViewAs.expired=card.expired; @@ -11046,16 +11050,16 @@ } } else{ - const next=game.createEvent(cardName); + var next=game.createEvent(cardName); next.setContent(lib.card[cardName].effect); next._result=result; next.cards=[card]; if(!card.viewAs){ - const autoViewAs=next.card=get.autoViewAs(card); + var autoViewAs=next.card=get.autoViewAs(card); autoViewAs.expired=card.expired; } else{ - const autoViewAs=next.card=get.autoViewAs({ + var autoViewAs=next.card=get.autoViewAs({ name:cardName },next.cards); autoViewAs.expired=card.expired; @@ -18943,7 +18947,7 @@ }, //Execute the delay card effect //执行延时锦囊牌效果 - executeDelayCardEffect:function(card,target){ + executeDelayCardEffect:function(card,target,judge,judge2){ const executeDelayCardEffect=game.createEvent('executeDelayCardEffect'); executeDelayCardEffect.player=this; executeDelayCardEffect.target=target||this; @@ -18956,6 +18960,8 @@ } else if(get.itemtype(card)=='card') executeDelayCardEffect.card=card; else _status.event.next.remove(executeDelayCardEffect); + executeDelayCardEffect.judge=judge; + executeDelayCardEffect.judge2=judge2; executeDelayCardEffect.setContent('executeDelayCardEffect'); executeDelayCardEffect._args=Array.from(arguments); return executeDelayCardEffect; @@ -28142,14 +28148,14 @@ if(this.player&&lib.phaseName.contains(this.name)) this.player.getHistory('skipped').add(this.name)} }, neutralize:function(event){ - this.untrigger(true); + this.untrigger(); this.finish(); this._neutralized=true; this.trigger('eventNeutralized'); this._neutralize_event=event||_status.event; }, unneutralize:function(){ - this.untrigger(true); + this.untrigger(); delete this._neutralized; delete this.finished; if(this.type=='card'&&this.card&&this.name=='sha') this.directHit=true; @@ -35463,7 +35469,7 @@ linexy:function(path){ const from=[path[0],path[1]],to=[path[2],path[3]]; let total=typeof arguments[1]==='number'?arguments[1]:lib.config.duration*2,opacity=1,color=[255,255,255],dashed=false,drag=false; - if(arguments[1]!=null&&typeof arguments[1]=='object') Object.keys(arguments[1]).forEach(value=>{ + if(arguments[1]&&typeof arguments[1]=='object') Object.keys(arguments[1]).forEach(value=>{ switch(value){ case 'opacity': opacity=arguments[1][value];