From 924a3b8d5430aa3fb856e50fee9d338b1c5b3fcf Mon Sep 17 00:00:00 2001 From: Tipx-L <138244655+Tipx-L@users.noreply.github.com> Date: Tue, 29 Aug 2023 00:38:38 -0700 Subject: [PATCH] Fix the compatibility. --- card/yingbian.js | 17 +++++++++-------- character/extra.js | 6 ++++-- game/game.js | 8 ++++---- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/card/yingbian.js b/card/yingbian.js index 81a4b1e7f..6a5225cb3 100644 --- a/card/yingbian.js +++ b/card/yingbian.js @@ -448,8 +448,9 @@ game.import('card',function(lib,game,ui,get,ai,_status){ const temporaryYingbian=event.temporaryYingbian||[],card=event.card; if(temporaryYingbian.includes('force')||get.cardtag(card,'yingbian_force')) return true; const forceYingbian=event.forceYingbian||player.hasSkillTag('forceYingbian'); - for(const [key,value] of lib.yingbian.condition.simple){ - if((temporaryYingbian.includes(key)||get.cardtag(card,`yingbian_${key}`))&&(forceYingbian||value(event))) return true; + for(const entry of lib.yingbian.condition.simple){ + const key=entry[0]; + if((temporaryYingbian.includes(key)||get.cardtag(card,`yingbian_${key}`))&&(forceYingbian||entry[1](event))) return true; } const complexYingbianConditions=get.complexYingbianConditions(); return temporaryYingbian.some(value=>complexYingbianConditions.includes(value))||get.is.complexlyYingbianConditional(card); @@ -459,11 +460,11 @@ game.import('card',function(lib,game,ui,get,ai,_status){ event.card=trigger.card; event.temporaryYingbian=trigger.temporaryYingbian||[]; var yingbianConditionSatisfied=false; - for(var [key,value] of lib.yingbian.condition.simple){ - if(!event.temporaryYingbian.includes(key)&&!get.cardtag(event.card,`yingbian_${key}`)||!value(trigger)) continue; + lib.yingbian.condition.simple.forEach((value,key)=>{ + if(!event.temporaryYingbian.includes(key)&&!get.cardtag(event.card,`yingbian_${key}`)||!value(trigger)) return; player.popup(`yingbian_${key}_tag`,lib.yingbian.condition.color.get(key)); if(!yingbianConditionSatisfied) yingbianConditionSatisfied=true; - } + }); if(event.temporaryYingbian.includes('force')||get.cardtag(event.card,'yingbian_force')||trigger.forceYingbian||player.hasSkillTag('forceYingbian')){ player.popup('yingbian_force_tag',lib.yingbian.condition.color.get('force')); if(!yingbianConditionSatisfied) yingbianConditionSatisfied=true; @@ -486,11 +487,11 @@ game.import('card',function(lib,game,ui,get,ai,_status){ 'step 4' trigger.card.yingbian=true; var yingbianEffectExecuted=false; - for(var [key,value] of lib.yingbian.effect){ - if(!event.temporaryYingbian.includes(key)&&!get.cardtag(card,`yingbian_${key}`)) continue; + lib.yingbian.effect.forEach((value,key)=>{ + if(!event.temporaryYingbian.includes(key)&&!get.cardtag(card,`yingbian_${key}`)) return; value(trigger); if(!yingbianEffectExecuted) yingbianEffectExecuted=true; - } + }); if(!yingbianEffectExecuted){ var defaultYingbianEffect=get.defaultYingbianEffect(card); if(lib.yingbian.effect.has(defaultYingbianEffect)){ diff --git a/character/extra.js b/character/extra.js index 01eb54699..45643926f 100755 --- a/character/extra.js +++ b/character/extra.js @@ -2358,8 +2358,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){ content:()=>{ if(!Array.isArray(trigger.temporaryYingbian)) trigger.temporaryYingbian=[]; trigger.temporaryYingbian.add('zhuzhan'); - trigger.temporaryYingbian.addArray(get.yingbianEffects()); - trigger.afterYingbianZhuzhan=target=>target.draw(2); + trigger.afterYingbianZhuzhan=(event,trigger)=>{ + event.zhuzhanresult.draw(2); + trigger.temporaryYingbian.addArray(get.yingbianEffects()); + }; } }, yingba:{ diff --git a/game/game.js b/game/game.js index 20e371233..7dade1113 100644 --- a/game/game.js +++ b/game/game.js @@ -259,7 +259,7 @@ var target=event.zhuzhanresult; target.line(player,'green'); target.discard(event.zhuzhanresult2.cards).discarder=target; - if(typeof event.afterYingbianZhuzhan=='function') event.afterYingbianZhuzhan(target); + if(typeof event.afterYingbianZhuzhan=='function') event.afterYingbianZhuzhan(event,trigger); var yingbianCondition=event.name.slice(8).toLowerCase(),yingbianConditionTag=`yingbian_${yingbianCondition}_tag`; target.popup(yingbianConditionTag,lib.yingbian.condition.color.get(yingbianCondition)); game.log(target,'响应了',player,'发起的',yingbianConditionTag); @@ -53072,13 +53072,13 @@ //检测此牌是否具有应变条件 yingbianConditional:card=>get.is.complexlyYingbianConditional(card)||get.is.simplyYingbianConditional(card), complexlyYingbianConditional:card=>{ - for(const [key] of lib.yingbian.condition.complex){ + for(const key of lib.yingbian.condition.complex.keys()){ if(get.cardtag(card,`yingbian_${key}`)) return true; } return false; }, simplyYingbianConditional:card=>{ - for(const [key] of lib.yingbian.condition.simple){ + for(const key of lib.yingbian.condition.simple.keys()){ if(get.cardtag(card,`yingbian_${key}`)) return true; } return false; @@ -53086,7 +53086,7 @@ //Check if the card has a Yingbian effect //检测此牌是否具有应变效果 yingbianEffective:card=>{ - for(const [key] of lib.yingbian.effect){ + for(const key of lib.yingbian.effect.keys()){ if(get.cardtag(card,`yingbian_${key}`)) return true; } return false;