微调猜杀猜闪函数
增加形参ignore,ignore牌/牌组不参与此次猜测; 默认选择的牌(ui.selected.cards)不纳入猜测区域
This commit is contained in:
parent
01f08eb546
commit
2a7941812a
18
game/game.js
18
game/game.js
|
@ -28273,13 +28273,16 @@
|
||||||
if(this.hasSkillTag('respondShan',true,null,true)) return true;
|
if(this.hasSkillTag('respondShan',true,null,true)) return true;
|
||||||
return this.hasUsableCard('shan');
|
return this.hasUsableCard('shan');
|
||||||
}
|
}
|
||||||
mayHaveSha(viewer,type){
|
mayHaveSha(viewer,type,ignore){
|
||||||
if((this.hp>2||!this.isZhu&&this.hp>1)&&this.hasSkillTag('respondSha',true,type,true)) return true;
|
if((this.hp>2||!this.isZhu&&this.hp>1)&&this.hasSkillTag('respondSha',true,type,true)) return true;
|
||||||
if(get.itemtype(viewer)!=='player') viewer=_status.event.player;
|
if(get.itemtype(viewer)!=='player') viewer=_status.event.player;
|
||||||
let cards;
|
let cards,selected=get.copy(ui.selected.cards);
|
||||||
|
if(get.itemtype(ignore)==='cards') selected.addArray(ignore);
|
||||||
|
else if(get.itemtype(ignore)==='card') selected.add(ignore);
|
||||||
if(this===viewer||get.itemtype(viewer)==='player'&&viewer.hasSkillTag('viewHandcard',null,this,true)) cards=this.getCards('h');
|
if(this===viewer||get.itemtype(viewer)==='player'&&viewer.hasSkillTag('viewHandcard',null,this,true)) cards=this.getCards('h');
|
||||||
else cards=this.getShownCards();
|
else cards=this.getShownCards();
|
||||||
if(cards.some(card=>{
|
if(cards.some(card=>{
|
||||||
|
if(selected.includes(card)) return false;
|
||||||
let name=get.name(card,this);
|
let name=get.name(card,this);
|
||||||
if(name=='sha'||name=='hufu'||name=='yuchanqian'){
|
if(name=='sha'||name=='hufu'||name=='yuchanqian'){
|
||||||
if(type==='use') return lib.filter.cardEnabled(card,this);
|
if(type==='use') return lib.filter.cardEnabled(card,this);
|
||||||
|
@ -28288,17 +28291,20 @@
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
})) return true;
|
})) return true;
|
||||||
let hs=this.getCards('hs').removeArray(cards).length;
|
let hs=this.getCards('hs').filter(i=>!cards.includes(i)&&!selected.includes(i)).length;
|
||||||
if(hs===0) return false;
|
if(hs===0) return false;
|
||||||
return Math.pow(hs+(this.isPhaseUsing()?6:4),2)>100*_status.event.getRand('mayHaveSha');
|
return Math.pow(hs+(this.isPhaseUsing()?6:4),2)>100*_status.event.getRand('mayHaveSha');
|
||||||
}
|
}
|
||||||
mayHaveShan(viewer,type){
|
mayHaveShan(viewer,type,ignore){
|
||||||
if((this.hp>2||!this.isZhu&&this.hp>1)&&this.hasSkillTag('respondShan',true,type,true)) return true;
|
if((this.hp>2||!this.isZhu&&this.hp>1)&&this.hasSkillTag('respondShan',true,type,true)) return true;
|
||||||
if(get.itemtype(viewer)!=='player') viewer=_status.event.player;
|
if(get.itemtype(viewer)!=='player') viewer=_status.event.player;
|
||||||
let cards;
|
let cards,selected=get.copy(ui.selected.cards);
|
||||||
|
if(get.itemtype(ignore)==='cards') selected.addArray(ignore);
|
||||||
|
else if(get.itemtype(ignore)==='card') selected.add(ignore);
|
||||||
if(this===viewer||get.itemtype(viewer)==='player'&&viewer.hasSkillTag('viewHandcard',null,this,true)) cards=this.getCards('h');
|
if(this===viewer||get.itemtype(viewer)==='player'&&viewer.hasSkillTag('viewHandcard',null,this,true)) cards=this.getCards('h');
|
||||||
else cards=this.getShownCards();
|
else cards=this.getShownCards();
|
||||||
if(cards.some(card=>{
|
if(cards.some(card=>{
|
||||||
|
if(selected.includes(card)) return false;
|
||||||
let name=get.name(card,this);
|
let name=get.name(card,this);
|
||||||
if(name==='shan'||name==='hufu'){
|
if(name==='shan'||name==='hufu'){
|
||||||
if(type==='use') return lib.filter.cardEnabled(card,this);
|
if(type==='use') return lib.filter.cardEnabled(card,this);
|
||||||
|
@ -28307,7 +28313,7 @@
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
})) return true;
|
})) return true;
|
||||||
let hs=this.getCards('hs').removeArray(cards).length;
|
let hs=this.getCards('hs').filter(i=>!cards.includes(i)&&!selected.includes(i)).length;
|
||||||
if(hs===0) return false;
|
if(hs===0) return false;
|
||||||
return Math.pow(hs+(this.isPhaseUsing()?3:5),2)>100*_status.event.getRand('mayHaveShan');
|
return Math.pow(hs+(this.isPhaseUsing()?3:5),2)>100*_status.event.getRand('mayHaveShan');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue