为`canMoveCard`/`moveCard`增加可替换装备的参数;令`get.type`能识别`sha_`开头的卡牌名称

This commit is contained in:
copcap 2023-11-25 06:16:45 +08:00
parent eb5dbf3d3a
commit ed17ce1fd0
No known key found for this signature in database
GPG Key ID: 30E7AB6699451AEE
1 changed files with 23 additions and 11 deletions

View File

@ -18474,7 +18474,7 @@ new Promise(resolve=>{
},
moveCard:function(){
'step 0'
if(!player.canMoveCard(null,event.nojudge,event.sourceTargets,event.aimTargets,event.filter)){
if(!player.canMoveCard(null,event.nojudge,event.sourceTargets,event.aimTargets,event.filter,event.canReplace?'canReplace':'noReplace')){
event.finish();
return;
}
@ -18491,7 +18491,7 @@ new Promise(resolve=>{
if(target.isMin()) return false;
var es=from.getCards('e',filterCard);
for(var i=0;i<es.length;i++){
if(target.canEquip(es[i])) return true;
if(target.canEquip(es[i],_status.event.canReplace)) return true;
}
return false;
}
@ -18516,7 +18516,7 @@ new Promise(resolve=>{
})) return 14;
if(target.countCards('e',function(card){
return get.value(card,target)<0&&game.hasPlayer(function(current){
return current!=target&&get.attitude(player,current)<0&&current.canEquip(card)&&get.effect(target,card,player,player)<0;
return current!=target&&get.attitude(player,current)<0&&current.canEquip(card,_status.event.canReplace)&&get.effect(target,card,player,player)<0;
});
})>0) return 9;
}
@ -18525,7 +18525,7 @@ new Promise(resolve=>{
if(current!=target&&get.attitude(player,current)>0){
var es=target.getCards('e');
for(var i=0;i<es.length;i++){
if(get.value(es[i],target)>0&&current.canEquip(es[i])&&get.effect(current,es[i],player,player)>0) return true;
if(get.value(es[i],target)>0&&current.canEquip(es[i],_status.event.canReplace)&&get.effect(current,es[i],player,player)>0) return true;
}
}
})){
@ -18541,7 +18541,7 @@ new Promise(resolve=>{
if(sgnatt!=0&&att2!=0&&sgnatt!=att2&&
get.sgn(get.value(es[i],ui.selected.targets[0]))==-att2&&
get.sgn(get.effect(target,es[i],player,target))==sgnatt&&
target.canEquip(es[i])){
target.canEquip(es[i],_status.event.canReplace)){
return Math.abs(att);
}
}
@ -18558,6 +18558,7 @@ new Promise(resolve=>{
next.set('filter',event.filter);
next.set('sourceTargets',event.sourceTargets||game.filterPlayer());
next.set('aimTargets',event.aimTargets||game.filterPlayer());
next.set('canReplace',event.canReplace);
if(event.prompt2) next.set('prompt2',event.prompt2);
if(event.forced) next.set('forced',true);
'step 1'
@ -18594,9 +18595,9 @@ new Promise(resolve=>{
return targets1.canAddJudge(button.link);
}
else{
return targets1.canEquip(button.link);
return targets1.canEquip(button.link,_status.event.canReplace);
}
}).set('filter',event.filter);
}).set('filter',event.filter).set('canReplace',event.canReplace);
}
else{
event.finish();
@ -25128,7 +25129,7 @@ new Promise(resolve=>{
canMoveCard(withatt,nojudge){
const player=this;
const args=Array.from(arguments).slice(2);
let sourceTargets,aimTargets,filterCard;
let sourceTargets,aimTargets,filterCard,canReplace;
args.forEach(arg=>{
if(get.itemtype(arg)=='players'){
if(!sourceTargets) sourceTargets=arg;
@ -25144,6 +25145,9 @@ new Promise(resolve=>{
else if(typeof arg=='object'&&arg){
filterCard=get.filter(arg);
}
else if(arg=='canReplace'){
canReplace=true;
}
});
if(!sourceTargets) sourceTargets=game.filterPlayer();
if(!aimTargets) aimTargets=game.filterPlayer();
@ -25158,7 +25162,7 @@ new Promise(resolve=>{
var att2=get.sgn(get.attitude(player,current2));
if(att==att2||att2!=get.sgn(get.effect(current2,es[i],player,current2))) return false;
}
return current!=current2&&!current2.isMin()&&current2.canEquip(es[i]);
return current!=current2&&!current2.isMin()&&current2.canEquip(es[i],canReplace);
})){
return true;
}
@ -25196,7 +25200,12 @@ new Promise(resolve=>{
else if(!next.aimTargets) next.aimTargets=[arguments[i]];
}
else if(typeof arguments[i]=='string'){
get.evtprompt(next,arguments[i]);
if(arguments[i]=='canReplace'){
next.canReplace=true;
}
else{
get.evtprompt(next,arguments[i]);
}
}
else if(Array.isArray(arguments[i])){
for(var j=0;j<arguments[i].length;j++){
@ -60716,7 +60725,10 @@ new Promise(resolve=>{
if(typeof obj=='string') obj={name:obj};
if(typeof obj!='object') return;
var name=get.name(obj,player);
if(!lib.card[name]) return;
if(!lib.card[name]){
if(!name.startsWith('sha_')) return;
if(name.slice(4).split('_').every(n=>lib.nature.has(n))) return lib.card['sha'].type;
}
if(method=='trick'&&lib.card[name].type=='delay') return 'trick';
return lib.card[name].type;
},