Yingbian.

This commit is contained in:
Tipx-L 2023-08-29 00:14:15 -07:00
parent 7fc67d5757
commit 699d11f99a
6 changed files with 322 additions and 560 deletions

View File

@ -455,28 +455,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
return target!=player&&(get.mode()!='guozhan'||_status.mode=='yingbian'||_status.mode=='free'||target.countCards('e')>0); return target!=player&&(get.mode()!='guozhan'||_status.mode=='yingbian'||_status.mode=='free'||target.countCards('e')>0);
}, },
enable:true, enable:true,
yingbian_prompt:function(card){ defaultYingbianEffect:'add',
var str='';
if(get.cardtag(card,'yingbian_all')){
str+='此牌的效果改为依次执行所有选项';
}
if(!str.length||get.cardtag(card,'yingbian_add')){
if(str.length) str+='';
str+='当你使用此牌选择目标后,你可为此牌增加一个目标';
}
return str;
},
yingbian:function(event){
var card=event.card,bool=false;
if(get.cardtag(card,'yingbian_all')){
bool=true;
card.yingbian_all=true;
game.log(card,'执行所有选项');
}
if(!bool||get.cardtag(card,'yingbian_add')){
event.yingbian_addTarget=true;
}
},
content:function(){ content:function(){
'step 0' 'step 0'
if(event.card.yingbian_all){ if(event.card.yingbian_all){

View File

@ -100,39 +100,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
if(lib.linked.contains(card.nature)) return '出牌阶段对你攻击范围内的一名角色使用。其须使用一张【闪】否则你对其造成1点'+get.translation(card.nature)+'属性伤害。'; if(lib.linked.contains(card.nature)) return '出牌阶段对你攻击范围内的一名角色使用。其须使用一张【闪】否则你对其造成1点'+get.translation(card.nature)+'属性伤害。';
return '出牌阶段对你攻击范围内的一名角色使用。其须使用一张【闪】否则你对其造成1点伤害。'; return '出牌阶段对你攻击范围内的一名角色使用。其须使用一张【闪】否则你对其造成1点伤害。';
}, },
yingbian_prompt:function(card){ defaultYingbianEffect:'add',
var str='';
if(get.cardtag(card,'yingbian_hit')){
str+='此牌不可被响应';
}
if(get.cardtag(card,'yingbian_damage')){
if(str.length) str+='';
str+='此牌的伤害值基数+1';
}
if(!str.length||get.cardtag(card,'yingbian_add')){
if(str.length) str+='';
str+='当你使用此牌选择目标后,你可为此牌增加一个目标';
}
return str;
},
yingbian:function(event){
var card=event.card,bool=false;
if(get.cardtag(card,'yingbian_hit')){
bool=true;
event.directHit.addArray(game.players);
game.log(card,'不可被响应');
}
if(get.cardtag(card,'yingbian_damage')){
bool=true;
if(typeof event.baseDamage!='number') event.baseDamage=1;
event.baseDamage++;
game.log(event.card,'的伤害值基数+1');
}
if(!bool||get.cardtag(card,'yingbian_add')){
event.yingbian_addTarget=true;
}
},
yingbian_tags:['hit','damage','add'],
filterTarget:function(card,player,target){return player!=target}, filterTarget:function(card,player,target){return player!=target},
content:function(){ content:function(){
"step 0" "step 0"
@ -387,27 +355,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
cardcolor:'red', cardcolor:'red',
notarget:true, notarget:true,
nodelay:true, nodelay:true,
yingbian_prompt:function(card){ defaultYingbianEffect:'draw',
var str='';
if(get.cardtag(card,'yingbian_gain')){
str+='当你声明使用此牌时,你获得此牌响应的目标牌';
}
if(!str.length||get.cardtag(card,'yingbian_draw')){
if(str.length) str+='';
str+='当你声明使用此牌时,你摸一张牌';
}
return str;
},
yingbian_tags:['gain','draw'],
yingbian:function(event){
var bool=false;
if(get.cardtag(event.card,'yingbian_gain')){
bool=true;
var cardx=event.respondTo;
if(cardx&&cardx[1]&&cardx[1].cards&&cardx[1].cards.filterInD('od').length) event.player.gain(cardx[1].cards.filterInD('od'),'gain2','log');
}
if(!bool||get.cardtag(event.card,'yingbian_draw')) event.player.draw();
},
content:function(){ content:function(){
event.result='shaned'; event.result='shaned';
event.getParent().delayx=false; event.getParent().delayx=false;
@ -889,11 +837,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
selectTarget:-1, selectTarget:-1,
cardcolor:'red', cardcolor:'red',
reverseOrder:true, reverseOrder:true,
yingbian_prompt:'当你使用此牌选择目标后,你可为此牌减少一个目标', defaultYingbianEffect:'remove',
yingbian_tags:['remove'],
yingbian:function(event){
event.yingbian_removeTarget=true;
},
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
//return target.hp<target.maxHp; //return target.hp<target.maxHp;
return true; return true;
@ -929,11 +873,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
type:'trick', type:'trick',
enable:true, enable:true,
selectTarget:-1, selectTarget:-1,
yingbian_prompt:'当你使用此牌选择目标后,你可为此牌减少一个目标', defaultYingbianEffect:'remove',
yingbian_tags:['remove'],
yingbian:function(event){
event.yingbian_removeTarget=true;
},
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
return target!=player; return target!=player;
}, },
@ -1006,11 +946,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
enable:true, enable:true,
selectTarget:-1, selectTarget:-1,
reverseOrder:true, reverseOrder:true,
yingbian_prompt:'当你使用此牌选择目标后,你可为此牌减少一个目标', defaultYingbianEffect:'remove',
yingbian_tags:['remove'],
yingbian:function(event){
event.yingbian_removeTarget=true;
},
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
return target!=player; return target!=player;
}, },
@ -1124,11 +1060,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
fullskin:true, fullskin:true,
type:'trick', type:'trick',
enable:true, enable:true,
yingbian_prompt:'你令此牌不可被响应', defaultYingbianEffect:'hit',
yingbian_tags:['hit'],
yingbian:function(event){
event.directHit.addArray(game.players);
},
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
return target!=player; return target!=player;
}, },
@ -1426,11 +1358,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
if(player==target) return false; if(player==target) return false;
return target.countDiscardableCards(player,get.is.single()?'he':'hej'); return target.countDiscardableCards(player,get.is.single()?'he':'hej');
}, },
yingbian_prompt:'当你使用此牌选择目标后,你可为此牌增加一个目标', defaultYingbianEffect:'add',
yingbian_tags:['add'],
yingbian:function(event){
event.yingbian_addTarget=true;
},
content:function(){ content:function(){
'step 0' 'step 0'
if(!get.is.single()&&target.countDiscardableCards(player,'hej')){ if(!get.is.single()&&target.countDiscardableCards(player,'hej')){
@ -1665,14 +1593,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}, },
notarget:true, notarget:true,
finalDelay:false, finalDelay:false,
yingbian_tags:['gain','draw'], defaultYingbianEffect:'draw',
yingbian_prompt:function(card){
if(!get.cardtag(card,'yingbian_gain')) return '当你声明使用此牌时,你摸一张牌';
return '当此牌生效后,你获得此牌响应的目标牌';
},
yingbian:function(event){
if(!get.cardtag(event.card,'yingbian_gain')||get.cardtag(event.card,'yingbian_draw')) event.player.draw();
},
contentBefore:function(){ contentBefore:function(){
'step 0' 'step 0'
if(get.mode()=='guozhan'&&get.cardtag(card,'guo')){ if(get.mode()=='guozhan'&&get.cardtag(card,'guo')){
@ -1725,11 +1646,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
delete ui.tempnowuxie; delete ui.tempnowuxie;
} }
} }
if(event.card.yingbian&&get.cardtag(event.card,'yingbian_gain')){ }
var cardx=event.getParent().respondTo;
if(cardx&&cardx[1]&&cardx[1].cards&&cardx[1].cards.filterInD('od').length) player.gain(cardx[1].cards.filterInD('od'),'gain2','log');
}
},
}, },
lebu:{ lebu:{
audio:true, audio:true,

View File

@ -16,38 +16,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
return target!=player&&target.countCards('hej')>0; return target!=player&&target.countCards('hej')>0;
}, },
yingbian_tags:['all','hit','add'], defaultYingbianEffect:'add',
yingbian_prompt:function(card){
var str='';
if(get.cardtag(card,'yingbian_all')){
str+='此牌的效果改为依次执行所有选项';
}
if(get.cardtag(card,'yingbian_hit')){
if(str.length) str+='';
str+='此牌不可被响应';
}
if(!str.length||get.cardtag(card,'yingbian_add')){
if(str.length) str+='';
str+='当你使用此牌选择目标后,你可为此牌增加一个目标';
}
return str;
},
yingbian:function(event){
var card=event.card,bool=false;
if(get.cardtag(card,'yingbian_all')){
bool=true;
card.yingbian_all=true;
game.log(card,'执行所有选项');
}
if(get.cardtag(card,'yingbian_hit')){
bool=true;
event.directHit.addArray(game.players);
game.log(card,'不可被响应');
}
if(!bool||get.cardtag(card,'yingbian_add')){
event.yingbian_addTarget=true;
}
},
content:function(){ content:function(){
var dist=get.distance(player,target); var dist=get.distance(player,target);
if(dist>1||card.yingbian_all) player.discardPlayerCard(target,'hej',true); if(dist>1||card.yingbian_all) player.discardPlayerCard(target,'hej',true);
@ -174,11 +143,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
return target!=player&&target.countCards('h')>0; return target!=player&&target.countCards('h')>0;
}, },
yingbian_prompt:'当你使用此牌选择目标后,你可为此牌增加一个目标', defaultYingbianEffect:'add',
yingbian_tags:['add'],
yingbian:function(event){
event.yingbian_addTarget=true;
},
content:function(){ content:function(){
'step 0' 'step 0'
if(player.isDead()||!target.countCards('h')){ if(player.isDead()||!target.countCards('h')){
@ -399,27 +364,20 @@ game.import('card',function(lib,game,ui,get,ai,_status){
global:'heiguangkai_ai', global:'heiguangkai_ai',
}, },
tongque_skill:{ tongque_skill:{
trigger:{player:'useCard1'}, trigger:{player:'useCardBegin'},
equipSkill:true, equipSkill:true,
forced:true, forced:true,
filter:function(event,player){ filter:(event,player)=>get.is.yingbianConditional(event.card)&&!player.hasHistory('useCard',evt=>get.is.yingbianConditional(evt.card)),
return !event.card.yingbian&&get.is.yingbian(event.card)&&player.getHistory('useCard',function(evt){ content:()=>{
return get.is.yingbian(evt.card) trigger.forceYingbian=true;
}).indexOf(event)==0; }
},
content:function(){
trigger.card.yingbian=true;
var info=get.info(trigger.card);
if(info&&info.yingbian) info.yingbian(trigger);
player.addTempSkill('yingbian_changeTarget');
},
}, },
tianjitu_skill:{ tianjitu_skill:{
audio:true, audio:true,
trigger:{player:['equipBegin','loseBegin']}, trigger:{player:['equipBegin','loseBegin']},
forced:true, forced:true,
equipSkill:true, equipSkill:true,
filter:(event,player,name)=>name=='equipBegin'?event.card.name=='tianjitu'&&player.hasCard(card=>card!=event.card):event.cards.some(value=>value.name=='tianjitu')&&player.countCards('h')<5, filter:(event,player,name)=>name=='equipBegin'?event.card.name=='tianjitu'&&player.hasCard(card=>card!=event.card):event.cards.some(value=>get.position(value)=='e'&&value.name=='tianjitu')&&player.countCards('h')<5,
content:()=>{ content:()=>{
if(event.triggername=='loseBegin') player.drawTo(5); if(event.triggername=='loseBegin') player.drawTo(5);
else player.chooseToDiscard(true,card=>card!=_status.event.getTrigger().card,'he'); else player.chooseToDiscard(true,card=>card!=_status.event.getTrigger().card,'he');
@ -485,195 +443,62 @@ game.import('card',function(lib,game,ui,get,ai,_status){
firstDo:true, firstDo:true,
ruleSkill:true, ruleSkill:true,
forceLoad:true, forceLoad:true,
filter:function(event,player){ filter:(event,player)=>{
if(event.card.yingbian) return false; if(event.card.yingbian) return false;
var bool=player.hasSkillTag('forceYingbian'); const temporaryYingbian=event.temporaryYingbian||[],card=event.card;
var card=event.card; if(temporaryYingbian.includes('force')||get.cardtag(card,'yingbian_force')) return true;
if(get.cardtag(card,'yingbian_kongchao')&&(!player.countCards('h')||bool)) return true; const forceYingbian=event.forceYingbian||player.hasSkillTag('forceYingbian');
if(get.cardtag(card,'yingbian_canqu')&&(player.hp==1||bool)) return true; for(const [key,value] of lib.yingbian.condition.simple){
if(get.cardtag(card,'yingbian_fujia')&&(player.isMaxHandcard()||bool)) return true; if((temporaryYingbian.includes(key)||get.cardtag(card,`yingbian_${key}`))&&(forceYingbian||value(event))) return true;
if(get.cardtag(card,'yingbian_zhuzhan')) return true; }
return false; const complexYingbianConditions=get.complexYingbianConditions();
return temporaryYingbian.some(value=>complexYingbianConditions.includes(value))||get.is.complexlyYingbianConditional(card);
}, },
content:function(){ content:()=>{
'step 0' 'step 0'
var card=trigger.card; event.card=trigger.card;
event.card=card; event.temporaryYingbian=trigger.temporaryYingbian||[];
var bool=false; var yingbianConditionSatisfied=false;
if(get.cardtag(card,'yingbian_kongchao')&&!player.countCards('h')){ for(var [key,value] of lib.yingbian.condition.simple){
player.popup('空巢','soil'); if(!event.temporaryYingbian.includes(key)&&!get.cardtag(event.card,`yingbian_${key}`)||!value(trigger)) continue;
bool=true; player.popup(`yingbian_${key}_tag`,lib.yingbian.condition.color.get(key));
if(!yingbianConditionSatisfied) yingbianConditionSatisfied=true;
} }
else if(get.cardtag(card,'yingbian_canqu')&&player.hp==1){ if(event.temporaryYingbian.includes('force')||get.cardtag(event.card,'yingbian_force')||trigger.forceYingbian||player.hasSkillTag('forceYingbian')){
player.popup('残躯','fire'); player.popup('yingbian_force_tag',lib.yingbian.condition.color.get('force'));
bool=true; if(!yingbianConditionSatisfied) yingbianConditionSatisfied=true;
} }
else if(get.cardtag(card,'yingbian_fujia')&&player.isMaxHandcard()){ if(yingbianConditionSatisfied){
player.popup('富甲','orange'); game.log(player,'触发了',event.card,'的应变条件');
bool=true; event.goto(4);
}
else if(player.hasSkillTag('forceYingbian')){
player.popup('应变','metal');
bool=true;
}
if(bool){
game.log(player,'触发了',card,'的应变条件');
event.goto(10);
} }
else if((event.num=0)>=(event.yingbianConditions=get.complexYingbianConditions()).length) event.finish();
'step 1' 'step 1'
event._global_waiting=true; var yingbianCondition=event.yingbianConditions[num];
event.send=function(player,card,source,targets,id,id2,skillState){ if(event.temporaryYingbian.includes(yingbianCondition)||get.cardtag(card,`yingbian_${yingbianCondition}`)) lib.yingbian.condition.complex.get(yingbianCondition)(trigger);
if(skillState){ else event.goto(3);
player.applySkills(skillState);
}
var type=get.type2(card);
var str=get.translation(source);
if(targets&&targets.length){
str+='对';
str+=get.translation(targets);
}
str+='使用了';
var next=player.chooseCard({
filterCard:function(card){
return get.type2(card)==type&&lib.filter.cardDiscardable.apply(this,arguments);
},
prompt:str+=(get.translation(card)+',是否弃置一张'+get.translation(type)+'为其助战?'),
position:'h',
_global_waiting:true,
id:id,
id2:id2,
ai:function(cardx){
var info=get.info(card);
if(info&&info.ai&&info.ai.yingbian){
var ai=info.ai.yingbian(card,source,targets,player);
if(!ai) return 0;
return ai-get.value(cardx);
}
else if(get.attitude(player,source)<=0) return 0;
return 5-get.value(cardx);
},
});
if(game.online){
_status.event._resultid=id;
game.resume();
}
};
'step 2' 'step 2'
var type=get.type2(card); if(result.bool) event.goto(4);
var list=game.filterPlayer(function(current){
if(current==player) return false;
if(!current.countCards('h')) return false;
return _status.connectMode||current.countCards('h',function(cardx){
return get.type2(cardx)==type;
})
});
event.list=list;
event.id=get.id();
list.sort(function(a,b){
return get.distance(event.source,a,'absolute')-get.distance(event.source,b,'absolute');
});
'step 3' 'step 3'
if(event.list.length==0){ event.num++;
event.finish(); if(event.num<event.yingbianConditions.length) event.goto(1);
return;
}
else if(_status.connectMode&&(event.list[0].isOnline()||event.list[0]==game.me)){
event.goto(5);
}
else{
event.current=event.list.shift();
event.send(event.current,event.card,player,trigger.targets,event.id,trigger.parent.id);
}
'step 4'
if(result.bool){
event.zhuzhanresult=event.current;
event.zhuzhanresult2=result;
if(event.current!=game.me) game.delayx();
event.goto(9);
}
else{
event.goto(3);
}
'step 5'
var id=event.id;
var sendback=function(result,player){
if(result&&result.id==id&&!event.zhuzhanresult&&result.bool){
event.zhuzhanresult=player;
event.zhuzhanresult2=result;
game.broadcast('cancel',id);
if(_status.event.id==id&&_status.event.name=='chooseCard'&&_status.paused){
return (function(){
event.resultOL=_status.event.resultOL;
ui.click.cancel();
if(ui.confirm) ui.confirm.close();
});
}
}
else{
if(_status.event.id==id&&_status.event.name=='chooseCard'&&_status.paused){
return (function(){
event.resultOL=_status.event.resultOL;
});
}
}
};
var withme=false;
var withol=false;
var list=event.list;
for(var i=0;i<list.length;i++){
if(list[i].isOnline()){
withol=true;
list[i].wait(sendback);
list[i].send(event.send,list[i],event.card,player,trigger.targets,event.id,trigger.parent.id,get.skillState(list[i]));
list.splice(i--,1);
}
else if(list[i]==game.me){
withme=true;
event.send(list[i],event.card,player,trigger.targets,event.id,trigger.parent.id);
list.splice(i--,1);
}
}
if(!withme){
event.goto(7);
}
if(_status.connectMode){
if(withme||withol){
for(var i=0;i<game.players.length;i++){
if(game.players[i]!=player) game.players[i].showTimer();
}
}
}
event.withol=withol;
'step 6'
if(result&&result.bool&&!event.zhuzhanresult){
game.broadcast('cancel',event.id);
event.zhuzhanresult=game.me;
event.zhuzhanresult2=result;
}
'step 7'
if(event.withol&&!event.resultOL){
game.pause();
}
'step 8'
for(var i=0;i<game.players.length;i++){
game.players[i].hideTimer();
}
'step 9'
if(event.zhuzhanresult){
var target=event.zhuzhanresult;
target.line(player,'green');
target.discard(event.zhuzhanresult2.cards).discarder=target;
target.popup('助战','wood');
game.log(target,'响应了',player,'发起的助战');
target.addExpose(0.2);
}
else event.finish(); else event.finish();
'step 10' 'step 4'
trigger.card.yingbian=true; trigger.card.yingbian=true;
var info=get.info(trigger.card); var yingbianEffectExecuted=false;
if(info&&info.yingbian) info.yingbian(trigger); for(var [key,value] of lib.yingbian.effect){
player.addTempSkill('yingbian_changeTarget'); if(!event.temporaryYingbian.includes(key)&&!get.cardtag(card,`yingbian_${key}`)) continue;
value(trigger);
if(!yingbianEffectExecuted) yingbianEffectExecuted=true;
}
if(!yingbianEffectExecuted){
var defaultYingbianEffect=get.defaultYingbianEffect(card);
if(lib.yingbian.effect.has(defaultYingbianEffect)){
lib.yingbian.effect.get(defaultYingbianEffect)(trigger);
if(!yingbianEffectExecuted) yingbianEffectExecuted=true;
}
}
if(yingbianEffectExecuted) player.addTempSkill('yingbian_changeTarget');
} }
}, },
yingbian_changeTarget:{ yingbian_changeTarget:{
@ -814,15 +639,16 @@ game.import('card',function(lib,game,ui,get,ai,_status){
yingbian_kongchao_tag:'空巢', yingbian_kongchao_tag:'空巢',
yingbian_fujia_tag:'富甲', yingbian_fujia_tag:'富甲',
yingbian_canqu_tag:'残躯', yingbian_canqu_tag:'残躯',
yingbian_force_tag:'应变',
_yingbian:'应变', _yingbian:'应变',
yingbian_changeTarget:'应变', yingbian_changeTarget:'应变',
yingbian_add_tag:'(目标+)', yingbian_add_tag:'(目标+)',
yingbian_remove_tag:'(目标-)', yingbian_remove_tag:'(目标-)',
yingbian_draw_tag:'(摸牌)',
yingbian_all_tag:'(双项)',
yingbian_hit_tag:'(强命)',
yingbian_gain_tag:'(反甲)',
yingbian_damage_tag:'(伤害+)', yingbian_damage_tag:'(伤害+)',
yingbian_draw_tag:'(摸牌)',
yingbian_gain_tag:'(反甲)',
yingbian_hit_tag:'(强命)',
yingbian_all_tag:'(双项)'
}, },
list:[ list:[
['spade',1,'juedou'], ['spade',1,'juedou'],

View File

@ -4262,25 +4262,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
}, },
asara_yingwei:{ asara_yingwei:{
trigger:{player:'useCard1'}, trigger:{player:'useCardBegin'},
forced:true, forced:true,
filter:function(event,player){ filter:event=>event.card.isCard&&event.cards.some(value=>value.hasGaintag('asara_yingwei')),
return player.getHistory('lose',function(evt){ content:()=>{
if(evt.getParent()!=event) return false; trigger.forceYingbian=true;
for(var i in evt.gaintag_map){ }
if(evt.gaintag_map[i].contains('asara_yingwei')) return true;
}
return false;
}).length>0;
},
content:function(){
if(!trigger.card.yingbian){
trigger.card.yingbian=true;
var info=get.info(trigger.card);
if(info&&info.yingbian) info.yingbian(trigger);
player.addTempSkill('yingbian_changeTarget');
}
},
}, },
yukito_kongwu:{ yukito_kongwu:{
enable:'phaseUse', enable:'phaseUse',

View File

@ -1010,9 +1010,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else if(lib.translate[name+'_info']){ else if(lib.translate[name+'_info']){
str+=(''+lib.translate[name+'_info']+'|'); str+=(''+lib.translate[name+'_info']+'|');
} }
if(lib.card[name].yingbian_prompt&&get.is.yingbian(node)){ if(get.is.yingbianConditional(node)){
if(typeof lib.card[name].yingbian_prompt=='function') str+=('应变:'+lib.card[name].yingbian_prompt(node)+'|'); const yingbianEffects=get.yingbianEffects(node);
else str+=('应变:'+lib.card[name].yingbian_prompt+'|'); if(!yingbianEffects.length){
const defaultYingbianEffect=get.defaultYingbianEffect(node);
if(lib.yingbian.prompt.has(defaultYingbianEffect)) yingbianEffects.push(defaultYingbianEffect);
}
if(yingbianEffects.length) str+=`应变:${yingbianEffects.map(value=>lib.yingbian.prompt.get(value)).join('')}|`;
} }
return str; return str;
}, },
@ -2337,199 +2341,26 @@ game.import('character',function(lib,game,ui,get,ai,_status){
group:'hina_shenshi_yingbian', group:'hina_shenshi_yingbian',
}, },
hina_shenshi_yingbian:{ hina_shenshi_yingbian:{
trigger:{player:'useCard1'}, trigger:{player:'useCardBegin'},
forced:true, forced:true,
filter:function(event,player){ filter:event=>event.card.isCard&&event.cards.some(value=>value.hasGaintag('hina_shenshi')),
return event.cards.length==1&&!event.card.yingbian&&player.hasHistory('lose',function(evt){ content:()=>{
if(evt.getParent()!=event) return false; if(!Array.isArray(trigger.temporaryYingbian)) trigger.temporaryYingbian=[];
for(var i in evt.gaintag_map){ trigger.temporaryYingbian.add('force');
if(evt.gaintag_map[i].contains('hina_shenshi')) return true; trigger.temporaryYingbian.addArray(get.yingbianEffects());
} }
return false;
})&&Array.isArray(get.info(event.card).yingbian_tags);
},
content:function(){
if(!trigger.card.yingbian){
trigger.card.yingbian=true;
var info=get.info(trigger.card);
trigger.card.cardtags=info.yingbian_tags.map(function(i){
return 'yingbian_'+i;
});
if(info&&info.yingbian) info.yingbian(trigger);
player.addTempSkill('yingbian_changeTarget');
}
},
}, },
hina_xingzhi:{ hina_xingzhi:{
groupSkill:true, groupSkill:true,
trigger:{player:'useCard1'}, trigger:{player:'useCardBegin'},
usable:1, usable:1,
filter:function(event,player){ filter:(event,player)=>player.group=='key',
return player.group=='key'&&!event.card.yingbian&&Array.isArray(get.info(event.card).yingbian_tags); content:()=>{
}, if(!Array.isArray(trigger.temporaryYingbian)) trigger.temporaryYingbian=[];
content:function(){ trigger.temporaryYingbian.add('zhuzhan');
'step 0' trigger.temporaryYingbian.addArray(get.yingbianEffects());
var info=get.info(trigger.card); trigger.afterYingbianZhuzhan=target=>target.draw(2);
trigger.card.cardtags=info.yingbian_tags.map(function(i){ }
return 'yingbian_'+i;
});
event.card=trigger.card;
event._global_waiting=true;
event.send=function(player,card,source,targets,id,id2,skillState){
if(skillState){
player.applySkills(skillState);
}
var type=get.type2(card);
var str=get.translation(source);
if(targets&&targets.length){
str+='对';
str+=get.translation(targets);
}
str+='使用了';
var next=player.chooseCard({
filterCard:function(card){
return get.type2(card)==type&&lib.filter.cardDiscardable.apply(this,arguments);
},
prompt:str+=(get.translation(card)+',是否弃置一张'+get.translation(type)+'为其助战?'),
position:'h',
_global_waiting:true,
id:id,
id2:id2,
ai:function(cardx){
var info=get.info(card),num=0;
if(info&&info.ai&&info.ai.yingbian){
var ai=info.ai.yingbian(card,source,targets,player);
if(ai) num=ai;
}
if(get.attitude(player,source)<=0) return 0;
return Math.max(ai,6)-get.value(cardx);
},
});
if(game.online){
_status.event._resultid=id;
game.resume();
}
};
'step 1'
var type=get.type2(card);
var list=game.filterPlayer(function(current){
if(current==player) return false;
if(!current.countCards('h')) return false;
return _status.connectMode||current.countCards('h',function(cardx){
return get.type2(cardx)==type;
})
});
event.list=list;
event.id=get.id();
list.sort(function(a,b){
return get.distance(event.source,a,'absolute')-get.distance(event.source,b,'absolute');
});
'step 2'
if(event.list.length==0){
event.finish();
return;
}
else if(_status.connectMode&&(event.list[0].isOnline()||event.list[0]==game.me)){
event.goto(4);
}
else{
event.current=event.list.shift();
event.send(event.current,event.card,player,trigger.targets,event.id,trigger.parent.id);
}
'step 3'
if(result.bool){
event.zhuzhanresult=event.current;
event.zhuzhanresult2=result;
if(event.current!=game.me) game.delayx();
event.goto(8);
}
else{
event.goto(2);
}
'step 4'
var id=event.id;
var sendback=function(result,player){
if(result&&result.id==id&&!event.zhuzhanresult&&result.bool){
event.zhuzhanresult=player;
event.zhuzhanresult2=result;
game.broadcast('cancel',id);
if(_status.event.id==id&&_status.event.name=='chooseCard'&&_status.paused){
return (function(){
event.resultOL=_status.event.resultOL;
ui.click.cancel();
if(ui.confirm) ui.confirm.close();
});
}
}
else{
if(_status.event.id==id&&_status.event.name=='chooseCard'&&_status.paused){
return (function(){
event.resultOL=_status.event.resultOL;
});
}
}
};
var withme=false;
var withol=false;
var list=event.list;
for(var i=0;i<list.length;i++){
if(list[i].isOnline()){
withol=true;
list[i].wait(sendback);
list[i].send(event.send,list[i],event.card,player,trigger.targets,event.id,trigger.parent.id,get.skillState(list[i]));
list.splice(i--,1);
}
else if(list[i]==game.me){
withme=true;
event.send(list[i],event.card,player,trigger.targets,event.id,trigger.parent.id);
list.splice(i--,1);
}
}
if(!withme){
event.goto(6);
}
if(_status.connectMode){
if(withme||withol){
for(var i=0;i<game.players.length;i++){
if(game.players[i]!=player) game.players[i].showTimer();
}
}
}
event.withol=withol;
'step 5'
if(result&&result.bool&&!event.zhuzhanresult){
game.broadcast('cancel',event.id);
event.zhuzhanresult=game.me;
event.zhuzhanresult2=result;
}
'step 6'
if(event.withol&&!event.resultOL){
game.pause();
}
'step 7'
for(var i=0;i<game.players.length;i++){
game.players[i].hideTimer();
}
'step 8'
if(event.zhuzhanresult){
var target=event.zhuzhanresult;
target.line(player,'green');
target.discard(event.zhuzhanresult2.cards).discarder=target;
target.draw(2);
target.popup('助战','wood');
game.log(target,'响应了',player,'发起的助战');
target.addExpose(0.2);
}
else event.finish();
'step 9'
if(!trigger.card.yingbian){
trigger.card.yingbian=true;
var info=get.info(trigger.card);
if(info&&info.yingbian) info.yingbian(trigger);
player.addTempSkill('yingbian_changeTarget');
}
},
}, },
yingba:{ yingba:{
audio:2, audio:2,

View File

@ -59,6 +59,7 @@
yingbian_kongchao:[], yingbian_kongchao:[],
yingbian_fujia:[], yingbian_fujia:[],
yingbian_canqu:[], yingbian_canqu:[],
yingbian_force:[]
}, },
renku:[], renku:[],
prehidden_skills:[], prehidden_skills:[],
@ -149,6 +150,170 @@
}, },
} }
}, },
yingbian:{
condition:{
color:new Map([
['zhuzhan','wood'],
['kongchao','soil'],
['fujia','orange'],
['canqu','fire'],
['force','metal']
]),
complex:new Map([
['zhuzhan',event=>{
const yingbianZhuzhan=game.createEvent('yingbianZhuzhan');
yingbianZhuzhan.player=event.player;
yingbianZhuzhan.card=event.card;
yingbianZhuzhan._trigger=event;
yingbianZhuzhan.afterYingbianZhuzhan=event.afterYingbianZhuzhan;
yingbianZhuzhan.setContent(()=>{
'step 0'
event._global_waiting=true;
event.send=(player,card,source,targets,id,id2,skillState)=>{
if(skillState) player.applySkills(skillState);
var type=get.type2(card),str=get.translation(source);
if(targets&&targets.length) str+=`${get.translation(targets)}`;
str+=`使用了${get.translation(card)},是否弃置一张${get.translation(type)}为其助战?`;
player.chooseCard({
filterCard:(card,player)=>get.type2(card)==type&&lib.filter.cardDiscardable(card,player),
prompt:str,
position:'h',
_global_waiting:true,
id:id,
id2:id2,
ai:cardx=>{
var info=get.info(card);
if(info&&info.ai&&info.ai.yingbian){
var ai=info.ai.yingbian(card,source,targets,player);
if(!ai) return 0;
return ai-get.value(cardx);
}
else if(get.attitude(player,source)<=0) return 0;
return 5-get.value(cardx);
}
});
if(!game.online) return;
_status.event._resultid=id;
game.resume();
};
'step 1'
var type=get.type2(card);
event.list=game.filterPlayer(current=>current!=player&&current.countCards('h')&&(_status.connectMode||current.hasCard(cardx=>get.type2(cardx)==type,'h'))).sortBySeat(_status.currentPhase||player);
event.id=get.id();
'step 2'
if(!event.list.length) event.finish();
else if(_status.connectMode&&(event.list[0].isOnline()||event.list[0]==game.me)) event.goto(4);
else event.send(event.current=event.list.shift(),event.card,player,trigger.targets,event.id,trigger.parent.id);
'step 3'
if(result.bool){
event.zhuzhanresult=event.current;
event.zhuzhanresult2=result;
if(event.current!=game.me) game.delayx();
event.goto(8);
}
else event.goto(2);
'step 4'
var id=event.id,sendback=(result,player)=>{
if(result&&result.id==id&&!event.zhuzhanresult&&result.bool){
event.zhuzhanresult=player;
event.zhuzhanresult2=result;
game.broadcast('cancel',id);
if(_status.event.id==id&&_status.event.name=='chooseCard'&&_status.paused) return ()=>{
event.resultOL=_status.event.resultOL;
ui.click.cancel();
if(ui.confirm) ui.confirm.close();
};
}
else if(_status.event.id==id&&_status.event.name=='chooseCard'&&_status.paused) return ()=>event.resultOL=_status.event.resultOL;
},withme=false,withol=false,list=event.list;
for(var i=0;i<list.length;i++){
var current=list[i];
if(current.isOnline()){
withol=true;
current.wait(sendback);
current.send(event.send,current,event.card,player,trigger.targets,event.id,trigger.parent.id,get.skillState(current));
list.splice(i--,1);
}
else if(current==game.me){
withme=true;
event.send(current,event.card,player,trigger.targets,event.id,trigger.parent.id);
list.splice(i--,1);
}
}
if(!withme) event.goto(6);
if(_status.connectMode&&(withme||withol)) game.players.forEach(value=>{
if(value!=player) value.showTimer();
});
event.withol=withol;
'step 5'
if(!result||!result.bool||event.zhuzhanresult) return;
game.broadcast('cancel',event.id);
event.zhuzhanresult=game.me;
event.zhuzhanresult2=result;
'step 6'
if(event.withol&&!event.resultOL) game.pause();
'step 7'
game.players.forEach(value=>value.hideTimer());
'step 8'
if(event.zhuzhanresult){
var target=event.zhuzhanresult;
target.line(player,'green');
target.discard(event.zhuzhanresult2.cards).discarder=target;
if(typeof event.afterYingbianZhuzhan=='function') event.afterYingbianZhuzhan(target);
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);
target.addExpose(0.2);
event.result={
bool:true
}
}
else event.result={
bool:false
};
});
return yingbianZhuzhan;
}]
]),
simple:new Map([
['kongchao',event=>!event.player.countCards('h')],
['fujia',event=>event.player.isMaxHandcard()],
['canqu',event=>event.player.getHp()==1]
])
},
effect:new Map([
['add',event=>event.yingbian_addTarget=true],
['remove',event=>event.yingbian_removeTarget=true],
['damage',event=>{
if(typeof event.baseDamage!='number') event.baseDamage=1;
event.baseDamage++;
game.log(event.card,'的伤害值基数+1');
}],
['draw',event=>event.player.draw()],
['gain',event=>{
const cardx=event.respondTo;
if(cardx&&cardx[1]&&cardx[1].cards&&cardx[1].cards.filterInD('od').length) event.player.gain(cardx[1].cards.filterInD('od'),'gain2','log');
}],
['hit',event=>{
event.directHit.addArray(game.players).addArray(game.dead);
game.log(event.card,'不可被响应');
}],
['all',event=>{
const card=event.card;
card.yingbian_all=true;
game.log(card,'执行所有选项');
}]
]),
prompt:new Map([
['add','当你使用此牌选择目标后,你可为此牌增加一个目标'],
['remove','当你使用此牌选择目标后,你可为此牌减少一个目标'],
['damage','此牌的伤害值基数+1'],
['draw','当你声明使用此牌时,你摸一张牌'],
['gain','当你声明使用此牌时,你获得此牌响应的目标牌'],
['hit','此牌不可被响应'],
['all','此牌的效果改为依次执行所有选项']
])
},
characterDialogGroup:{ characterDialogGroup:{
'收藏':function(name,capt){ '收藏':function(name,capt){
return lib.config.favouriteCharacter.contains(name)?capt:null; return lib.config.favouriteCharacter.contains(name)?capt:null;
@ -31326,6 +31491,13 @@
], ],
}; };
var game={ var game={
//Yingbian
//应变
setYingbianConditionColor:(yingbianCondition,color)=>game.broadcastAll((yingbianCondition,color)=>lib.yingbian.condition.color.set(yingbianCondition,color),yingbianCondition,color),
setComplexYingbianCondition:(yingbianCondition,condition)=>game.broadcastAll((yingbianCondition,condition)=>lib.yingbian.condition.complex.set(yingbianCondition,condition),yingbianCondition,condition),
setSimpleYingbianCondition:(yingbianCondition,condition)=>game.broadcastAll((yingbianCondition,condition)=>lib.yingbian.condition.simple.set(yingbianCondition,condition),yingbianCondition,condition),
setYingbianEffect:(yingbianEffect,effect)=>game.broadcastAll((yingbianEffect,effect)=>lib.yingbian.effect.set(yingbianEffect,effect),yingbianEffect,effect),
setYingbianPrompt:(yingbian,prompt)=>game.broadcastAll((yingbian,prompt)=>lib.yingbian.prompt.set(yingbian,prompt),yingbian,prompt),
//Add a background music to the config option //Add a background music to the config option
//在设置选项中添加一首背景音乐 //在设置选项中添加一首背景音乐
addBackgroundMusic:(link,musicName,aozhan)=>{ addBackgroundMusic:(link,musicName,aozhan)=>{
@ -52674,6 +52846,31 @@
}, },
}; };
var get={ var get={
//Yingbian
//应变
//Get the Yingbian conditions (of the card)
//获取(此牌的)应变条件
yingbianConditions:card=>get.complexYingbianConditions(card).concat(get.simpleYingbianConditions(card)),
complexYingbianConditions:card=>{
const complexYingbianConditions=Array.from(lib.yingbian.condition.complex.keys());
return card?complexYingbianConditions.filter(value=>get.cardtag(card,`yingbian_${value}`)):complexYingbianConditions;
},
simpleYingbianConditions:card=>{
const simpleYingbianConditions=Array.from(lib.yingbian.condition.simple.keys())
return card?simpleYingbianConditions.filter(value=>get.cardtag(card,`yingbian_${value}`)):simpleYingbianConditions;
},
//Get the Yingbian effects (of the card)
//获取(此牌的)应变效果
yingbianEffects:card=>{
const yingbianEffects=Array.from(lib.yingbian.effect.keys());
return card?yingbianEffects.filter(value=>get.cardtag(card,`yingbian_${value}`)):yingbianEffects;
},
//Get the default Yingbian effect of the card
//获取此牌的默认应变效果
defaultYingbianEffect:card=>{
const info=get.info(card);
return info&&info.defaultYingbianEffect||null;
},
//优先度判断 //优先度判断
priority:function(skill){ priority:function(skill){
const info=get.info(skill); const info=get.info(skill);
@ -52871,9 +53068,30 @@
} }
return false; return false;
}, },
yingbian:function(node){ //Check if the card has a Yingbian condition
return get.cardtag(node,'yingbian_zhuzhan')||get.cardtag(node,'yingbian_fujia')||get.cardtag(node,'yingbian_canqu')||get.cardtag(node,'yingbian_kongchao'); //检测此牌是否具有应变条件
yingbianConditional:card=>get.is.complexlyYingbianConditional(card)||get.is.simplyYingbianConditional(card),
complexlyYingbianConditional:card=>{
for(const [key] of lib.yingbian.condition.complex){
if(get.cardtag(card,`yingbian_${key}`)) return true;
}
return false;
}, },
simplyYingbianConditional:card=>{
for(const [key] of lib.yingbian.condition.simple){
if(get.cardtag(card,`yingbian_${key}`)) return true;
}
return false;
},
//Check if the card has a Yingbian effect
//检测此牌是否具有应变效果
yingbianEffective:card=>{
for(const [key] of lib.yingbian.effect){
if(get.cardtag(card,`yingbian_${key}`)) return true;
}
return false;
},
yingbian:card=>get.is.yingbianConditional(card)||get.is.yingbianEffective(card),
emoji:function(substring){ emoji:function(substring){
if(substring){ if(substring){
var reg=new RegExp("[~#^$@%&!?%*]",'g'); var reg=new RegExp("[~#^$@%&!?%*]",'g');
@ -56148,9 +56366,13 @@
uiintro._place_text=placetext; uiintro._place_text=placetext;
} }
} }
if(lib.card[name].yingbian_prompt&&get.is.yingbian(node.link||node)){ if(get.is.yingbianConditional(node.link||node)){
if(typeof lib.card[name].yingbian_prompt=='function') uiintro.add('<div class="text" style="font-family: yuanli">应变:'+lib.card[name].yingbian_prompt(node.link||node)+'</div>'); const yingbianEffects=get.yingbianEffects(node.link||node);
else uiintro.add('<div class="text" style="font-family: yuanli">应变:'+lib.card[name].yingbian_prompt+'</div>'); if(!yingbianEffects.length){
const defaultYingbianEffect=get.defaultYingbianEffect(node.link||node);
if(lib.yingbian.prompt.has(defaultYingbianEffect)) yingbianEffects.push(defaultYingbianEffect);
}
if(yingbianEffects.length) uiintro.add(`<div class="text" style="font-family: yuanli">应变:${yingbianEffects.map(value=>lib.yingbian.prompt.get(value)).join('')}</div>`);
} }
if(lib.translate[name+'_append']){ if(lib.translate[name+'_append']){
uiintro.add('<div class="text" style="display:inline">'+lib.translate[name+'_append']+'</div>'); uiintro.add('<div class="text" style="display:inline">'+lib.translate[name+'_append']+'</div>');