sp.js ~ yijiang.js chooseToUse相关技能完成修改

This commit is contained in:
Spmario233 2024-03-03 12:41:45 +08:00
parent 1d9f781609
commit 706af34dc6
6 changed files with 41 additions and 40 deletions

View File

@ -797,28 +797,29 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return get.inpileVCardList(info=>{
const name=info[2];
return get.type(name)=='basic';
}).some(card=>event.filterCard({name:card[2],nature:card[3]},player,event));
}).some(card=>event.filterCard({name:card[2],nature:card[3],isCard:true},player,event));
},
chooseButton:{
dialog(event,player){
const list=get.inpileVCardList(info=>{
const name=info[2];
return get.type(name)=='basic';
}).filter(card=>event.filterCard({name:card[2],nature:card[3]},player,event));
}).filter(card=>event.filterCard({name:card[2],nature:card[3],isCard:true},player,event));
return ui.create.dialog('诿解',[list,'vcard']);
},
filter(button,player){
return get.event().getParent().filterCard({name:button.link[2],nature:button.link[3]},player,_status.event.getParent());
return get.event().getParent().filterCard({name:button.link[2],nature:button.link[3],isCard:true},player,_status.event.getParent());
},
check(button){
if(get.event().getParent().type!='phase') return 1;
return get.event('player').getUseValue({name:button.link[2],nature:button.link[3]});
return get.event('player').getUseValue({name:button.link[2],nature:button.link[3],isCard:true});
},
backup(links,player){
return {
viewAs:{
name:links[0][2],
nature:links[0][3],
isCard:true,
},
filterCard:()=>false,
selectCard:-1,
@ -2955,7 +2956,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filter:function(event,player){
if(event.responded||event.type=='wuxie'||event.olqifan||!lib.skill.olqifan.getNum()) return false;
for(var i of lib.inpile){
if(i!='wuxie'&&event.filterCard({name:i},player,event)) return true;
if(i!='wuxie'&&event.filterCard(get.autoViewAs({name:i},'unsure'),player,event)) return true;
}
return false;
},
@ -8455,13 +8456,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
filter:function(event,player){
if(event.type=='wuxie') return false;
if(!player.hasSkill('liangyuan_tao',null,null,false)&&event.filterCard({name:'tao'},player,event)&&game.hasPlayer(function(current){
if(!player.hasSkill('liangyuan_tao',null,null,false)&&event.filterCard(get.autoViewAs({name:'tao'},'unsure'),player,event)&&game.hasPlayer(function(current){
var storage=current.getExpansions('huamu');
return storage.length>0&&storage.filter(function(i){
return get.color(i,false)=='red';
}).length>0;
})) return true;
if(!player.hasSkill('liangyuan_jiu',null,null,false)&&event.filterCard({name:'jiu'},player,event)&&game.hasPlayer(function(current){
if(!player.hasSkill('liangyuan_jiu',null,null,false)&&event.filterCard(get.autoViewAs({name:'jiu'},'unsure'),player,event)&&game.hasPlayer(function(current){
var storage=current.getExpansions('huamu');
return storage.length>0&&storage.filter(function(i){
return get.color(i,false)=='black';
@ -8887,12 +8888,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!bool) return false;
for(var name of lib.inpile){
if(get.type(name)!='basic'||list.includes(name)) continue;
var card={name:name};
if(event.filterCard(card,player,event)) return true;
var card={name};
if(event.filterCard(get.autoViewAs(card,'unsure'),player,event)) return true;
if(name=='sha'){
for(var nature of lib.inpile_nature){
card.nature=nature;
if(event.filterCard(card,player,event)) return true;
if(event.filterCard(get.autoViewAs(card,'unsure'),player,event)) return true;
}
}
}
@ -8904,12 +8905,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var storage=player.getStorage('yilie_count');
for(var i of lib.inpile){
if(get.type(i)!='basic'||storage.includes(i)) continue;
var card={name:i,isCard:true};
if(event.filterCard(card,player,event)) list.push(['基本','',i]);
var card={name:i};
if(event.filterCard(get.autoViewAs(card,'unsure'),player,event)) list.push(['基本','',i]);
if(i=='sha'){
for(var j of lib.inpile_nature){
card.nature=j;
if(event.filterCard(card,player,event)) list.push(['基本','',i,j]);
if(event.filterCard(get.autoViewAs(card,'unsure'),player,event)) list.push(['基本','',i,j]);
}
}
}
@ -13058,7 +13059,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filter:function(event,player){
if(event.responded||event.jinzhi||player.countMark('jinzhi2')>=player.countCards('he')) return false;
for(var i of lib.inpile){
if(get.type(i)=='basic'&&event.filterCard({name:i},player,event)) return true;
if(get.type(i)=='basic'&&event.filterCard({name:i,isCard:true},player,event)) return true;
}
return false;
},
@ -13066,7 +13067,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
dialog:function(event,player){
var list=[];
for(var i of lib.inpile){
if(get.type(i)=='basic'&&event.filterCard({name:i},player,event)){
if(get.type(i)=='basic'&&event.filterCard({name:i,isCard:true},player,event)){
list.push(['基本','',i]);
if(i=='sha'){
for(var j of lib.inpile_nature) list.push(['基本','','sha',j]);
@ -17961,10 +17962,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filter:function(event,player){
if(!player.storage.fanghun||player.storage.fanghun<=0) return false;
var filter=event.filterCard;
if(filter({name:'sha'},player,event)&&player.countCards('hs','shan')) return true;
if(filter({name:'shan'},player,event)&&player.countCards('hs','sha')) return true;
if(filter({name:'tao'},player,event)&&player.countCards('hs','jiu')) return true;
if(filter({name:'jiu'},player, event)&&player.countCards('hs','tao')) return true;
if(filter(get.autoViewAs({name:'sha'},'unsure'),player,event)&&player.countCards('hs','shan')) return true;
if(filter(get.autoViewAs({name:'shan'},'unsure'),player,event)&&player.countCards('hs','sha')) return true;
if(filter(get.autoViewAs({name:'jiu'},'unsure'),player,event)&&player.countCards('hs','jiu')) return true;
if(filter(get.autoViewAs({name:'tao'},'unsure'),player, event)&&player.countCards('hs','tao')) return true;
return false;
},
onrespond:function(){return this.onuse.apply(this,arguments)},

View File

@ -874,16 +874,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2,
enable:'chooseToUse',
filter:function(event,player){
if(!event.filterCard({name:'sha'},player,event)&&!event.filterCard({name:'wuxie'},player,event)) return false;
return player.countCards('hs',card=>{
return !player.getStorage('starlifeng_count').includes(get.color(card,player))||_status.connectMode;
});
if(!event.filterCard(get.autoViewAs({name:'sha'},'unsure'),player,event)&&!event.filterCard(get.autoViewAs({name:'wuxie'},'unsure'),player,event)) return false;
return player.hasCard(card=>{
return !player.getStorage('starlifeng_count').includes(get.color(card,player));
},'hs');
},
chooseButton:{
dialog:function(event,player){
var list=[];
if(event.filterCard({name:'sha'},player,event)) list.push(['基本','','sha']);
if(event.filterCard({name:'wuxie'},player,event)) list.push(['锦囊','','wuxie']);
if(event.filterCard(get.autoViewAs({name:'sha'},'unsure'),player,event)) list.push(['基本','','sha']);
if(event.filterCard(get.autoViewAs({name:'wuxie'},'unsure'),player,event)) list.push(['锦囊','','wuxie']);
return ui.create.dialog('砺锋',[list,'vcard']);
},
check:function(button){

View File

@ -224,7 +224,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(event.responded) return false;
if(player.storage.hujiaing) return false;
if(!player.hasZhuSkill('hujia')) return false;
if(!event.filterCard({name:'shan'},player,event)) return false;
if(!event.filterCard({name:'shan',isCard:true},player,event)) return false;
return game.hasPlayer(current=>current!=player&&current.group=='wei');
},
check(event,player){

View File

@ -9548,8 +9548,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
filter:function(event,player){
const names=[];
if(event.filterCard({name:'sha'},player,event)) names.push('shan');
if(event.filterCard({name:'shan'},player,event)) names.push('sha');
if(event.filterCard(get.autoViewAs({name:'sha'},'unsure'),player,event)) names.push('shan');
if(event.filterCard(get.autoViewAs({name:'shan'},'unsure'),player,event)) names.push('sha');
return names.length>0&&player.hasCard(function(card){
return names.includes(get.name(card));
},'hs');
@ -11293,10 +11293,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
for(var i of lib.inpile){
if(i=='wuxie') continue;
var type=get.type(i);
if((type=='basic'||type=='trick')&&event.filterCard({name:i},player,event)) return true;
if((type=='basic'||type=='trick')&&event.filterCard({name:i,isCard:true},player,event)) return true;
if(i=='sha'){
for(var j of lib.inpile_nature){
if(event.filterCard({name:i,nature:j},player,event)) return true;
if(event.filterCard({name:i,nature:j,isCard:true},player,event)) return true;
}
}
}

View File

@ -3915,7 +3915,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
})) return false;
var storage=player.getStorage('dczhaowen_viewed');
for(var i of lib.inpile){
if(!storage.includes(i)&&get.type(i)=='trick'&&event.filterCard({name:i},player,event)) return true;
if(!storage.includes(i)&&get.type(i)=='trick'&&event.filterCard(get.autoViewAs({name:i},'unsure'),player,event)) return true;
}
return false;
},
@ -3927,7 +3927,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var storage=player.getStorage('dczhaowen_viewed');
var list=[];
for(var i of lib.inpile){
if(!storage.includes(i)&&get.type(i)=='trick'&&event.filterCard({name:i},player,event)){
if(!storage.includes(i)&&get.type(i)=='trick'&&event.filterCard(get.autoViewAs({name:i},'unsure'),player,event)){
list.push(['锦囊','',i]);
}
}
@ -6962,7 +6962,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!storage.length) return false;
var storage2=player.getStorage('dcfengying_used')
return storage.some(name=>{
return !storage2.includes(name)&&event.filterCard({name:name},player,event);
return !storage2.includes(name)&&event.filterCard(get.autoViewAs({name},'unsure'),player,event);
});
},
hiddenCard:function(player,name){
@ -6982,7 +6982,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filter:function(button,player){
var card={name:button.link[2],storage:{dcfengying:true}};
if(player.getStorage('dcfengying_used').includes(card.name)) return false;
return _status.event.getParent().filterCard(card,player,_status.event.getParent());
return _status.event.getParent().filterCard(get.autoViewAs(card,'unsure'),player,_status.event.getParent());
},
check:function(button){
var player=_status.event.player;
@ -12702,13 +12702,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filter:function(button,player){
var evt=_status.event.getParent();
if(evt&&typeof evt.filterCard=='function') return evt.filterCard({name:button.link[2]},player,evt);
return lib.filter.filterCard({name:button.link[2]},player,_status.event.getParent());
return lib.filter.filterCard({name:button.link[2],isCard:true},player,_status.event.getParent());
},
check:function(button){
var player=_status.event.player;
if(player.countCards('h',button.link[2])) return 0;
if(_status.event.getParent().type!='phase'&&!_status.event.getParent().lvli6) return 1;
return player.getUseValue({name:button.link[2]});
return player.getUseValue({name:button.link[2],isCard:true});
},
backup:function(links,player){
return {

View File

@ -2673,7 +2673,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:'taoluan',
enable:'chooseToUse',
filter:function(event,player){
return !player.hasSkill('xintaoluan3')&&player.countCards('hes',card=>lib.inpile.some(name=>{
return !player.hasSkill('xintaoluan3')&&player.hasCard(card=>lib.inpile.some(name=>{
if(player.getStorage('xintaoluan').includes(name)) return false;
if(get.type(name)!='basic'&&get.type(name)!='trick') return false;
if(event.filterCard({name:name,isCard:true,cards:[card]},player,event)) return true;
@ -2683,7 +2683,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
}
return false;
}))>0&&!_status.dying.length;
},'hes'))>0&&!_status.dying.length;
},
chooseButton:{
dialog:function(event,player){
@ -5255,7 +5255,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2,
enable:'chooseToUse',
filter:function(event,player){
return !player.hasSkill('taoluan3')&&player.countCards('hes',card=>lib.inpile.some(name=>{
return !player.hasSkill('taoluan3')&&player.hasCard(card=>lib.inpile.some(name=>{
if(player.getStorage('taoluan').includes(name)) return false;
if(get.type(name)!='basic'&&get.type(name)!='trick') return false;
if(event.filterCard({name:name,isCard:true,cards:[card]},player,event)) return true;
@ -5265,7 +5265,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
}
return false;
}))>0;
},'hes'))>0;
},
onremove:true,
chooseButton:{