Fix the compatibility.

This commit is contained in:
Tipx-L 2023-08-29 00:38:38 -07:00
parent 699d11f99a
commit 924a3b8d54
3 changed files with 17 additions and 14 deletions

View File

@ -448,8 +448,9 @@ game.import('card',function(lib,game,ui,get,ai,_status){
const temporaryYingbian=event.temporaryYingbian||[],card=event.card; const temporaryYingbian=event.temporaryYingbian||[],card=event.card;
if(temporaryYingbian.includes('force')||get.cardtag(card,'yingbian_force')) return true; if(temporaryYingbian.includes('force')||get.cardtag(card,'yingbian_force')) return true;
const forceYingbian=event.forceYingbian||player.hasSkillTag('forceYingbian'); const forceYingbian=event.forceYingbian||player.hasSkillTag('forceYingbian');
for(const [key,value] of lib.yingbian.condition.simple){ for(const entry of lib.yingbian.condition.simple){
if((temporaryYingbian.includes(key)||get.cardtag(card,`yingbian_${key}`))&&(forceYingbian||value(event))) return true; const key=entry[0];
if((temporaryYingbian.includes(key)||get.cardtag(card,`yingbian_${key}`))&&(forceYingbian||entry[1](event))) return true;
} }
const complexYingbianConditions=get.complexYingbianConditions(); const complexYingbianConditions=get.complexYingbianConditions();
return temporaryYingbian.some(value=>complexYingbianConditions.includes(value))||get.is.complexlyYingbianConditional(card); 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.card=trigger.card;
event.temporaryYingbian=trigger.temporaryYingbian||[]; event.temporaryYingbian=trigger.temporaryYingbian||[];
var yingbianConditionSatisfied=false; var yingbianConditionSatisfied=false;
for(var [key,value] of lib.yingbian.condition.simple){ lib.yingbian.condition.simple.forEach((value,key)=>{
if(!event.temporaryYingbian.includes(key)&&!get.cardtag(event.card,`yingbian_${key}`)||!value(trigger)) continue; 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)); player.popup(`yingbian_${key}_tag`,lib.yingbian.condition.color.get(key));
if(!yingbianConditionSatisfied) yingbianConditionSatisfied=true; if(!yingbianConditionSatisfied) yingbianConditionSatisfied=true;
} });
if(event.temporaryYingbian.includes('force')||get.cardtag(event.card,'yingbian_force')||trigger.forceYingbian||player.hasSkillTag('forceYingbian')){ 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')); player.popup('yingbian_force_tag',lib.yingbian.condition.color.get('force'));
if(!yingbianConditionSatisfied) yingbianConditionSatisfied=true; if(!yingbianConditionSatisfied) yingbianConditionSatisfied=true;
@ -486,11 +487,11 @@ game.import('card',function(lib,game,ui,get,ai,_status){
'step 4' 'step 4'
trigger.card.yingbian=true; trigger.card.yingbian=true;
var yingbianEffectExecuted=false; var yingbianEffectExecuted=false;
for(var [key,value] of lib.yingbian.effect){ lib.yingbian.effect.forEach((value,key)=>{
if(!event.temporaryYingbian.includes(key)&&!get.cardtag(card,`yingbian_${key}`)) continue; if(!event.temporaryYingbian.includes(key)&&!get.cardtag(card,`yingbian_${key}`)) return;
value(trigger); value(trigger);
if(!yingbianEffectExecuted) yingbianEffectExecuted=true; if(!yingbianEffectExecuted) yingbianEffectExecuted=true;
} });
if(!yingbianEffectExecuted){ if(!yingbianEffectExecuted){
var defaultYingbianEffect=get.defaultYingbianEffect(card); var defaultYingbianEffect=get.defaultYingbianEffect(card);
if(lib.yingbian.effect.has(defaultYingbianEffect)){ if(lib.yingbian.effect.has(defaultYingbianEffect)){

View File

@ -2358,8 +2358,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:()=>{ content:()=>{
if(!Array.isArray(trigger.temporaryYingbian)) trigger.temporaryYingbian=[]; if(!Array.isArray(trigger.temporaryYingbian)) trigger.temporaryYingbian=[];
trigger.temporaryYingbian.add('zhuzhan'); trigger.temporaryYingbian.add('zhuzhan');
trigger.temporaryYingbian.addArray(get.yingbianEffects()); trigger.afterYingbianZhuzhan=(event,trigger)=>{
trigger.afterYingbianZhuzhan=target=>target.draw(2); event.zhuzhanresult.draw(2);
trigger.temporaryYingbian.addArray(get.yingbianEffects());
};
} }
}, },
yingba:{ yingba:{

View File

@ -259,7 +259,7 @@
var target=event.zhuzhanresult; var target=event.zhuzhanresult;
target.line(player,'green'); target.line(player,'green');
target.discard(event.zhuzhanresult2.cards).discarder=target; 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`; var yingbianCondition=event.name.slice(8).toLowerCase(),yingbianConditionTag=`yingbian_${yingbianCondition}_tag`;
target.popup(yingbianConditionTag,lib.yingbian.condition.color.get(yingbianCondition)); target.popup(yingbianConditionTag,lib.yingbian.condition.color.get(yingbianCondition));
game.log(target,'响应了',player,'发起的',yingbianConditionTag); game.log(target,'响应了',player,'发起的',yingbianConditionTag);
@ -53072,13 +53072,13 @@
//检测此牌是否具有应变条件 //检测此牌是否具有应变条件
yingbianConditional:card=>get.is.complexlyYingbianConditional(card)||get.is.simplyYingbianConditional(card), yingbianConditional:card=>get.is.complexlyYingbianConditional(card)||get.is.simplyYingbianConditional(card),
complexlyYingbianConditional: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; if(get.cardtag(card,`yingbian_${key}`)) return true;
} }
return false; return false;
}, },
simplyYingbianConditional:card=>{ 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; if(get.cardtag(card,`yingbian_${key}`)) return true;
} }
return false; return false;
@ -53086,7 +53086,7 @@
//Check if the card has a Yingbian effect //Check if the card has a Yingbian effect
//检测此牌是否具有应变效果 //检测此牌是否具有应变效果
yingbianEffective:card=>{ 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; if(get.cardtag(card,`yingbian_${key}`)) return true;
} }
return false; return false;