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;
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)){

View File

@ -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:{

View File

@ -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;