为调用mayHaveShan的函数增加参数

也包括mayHaveSha
This commit is contained in:
157 2023-12-29 09:57:38 +08:00
parent de3102bb2b
commit 38801acdcc
14 changed files with 31 additions and 31 deletions

View File

@ -231,7 +231,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
if(get.cardtag(card,'yingbian_hit')){
hit=true;
if(targets.some(target=>{
return target.mayHaveShan(viewer)&&get.attitude(viewer,target)<0&&get.damageEffect(target,player,viewer,get.natureList(card))>0;
return target.mayHaveShan(viewer,'use')&&get.attitude(viewer,target)<0&&get.damageEffect(target,player,viewer,get.natureList(card))>0;
})) base+=5;
}
if(get.cardtag(card,'yingbian_add')){
@ -241,7 +241,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}
if(get.cardtag(card,'yingbian_damage')){
if(targets.some(target=>{
return get.attitude(player,target)<0&&(hit||!target.mayHaveShan(viewer)||player.hasSkillTag('directHit_ai',true,{
return get.attitude(player,target)<0&&(hit||!target.mayHaveShan(viewer,'use')||player.hasSkillTag('directHit_ai',true,{
target:target,
card:card,
},true))&&!target.hasSkillTag('filterDamage',null,{
@ -294,7 +294,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}
return -1.5;
}();
if(!isLink&&target.mayHaveShan()&&!player.hasSkillTag('directHit_ai',true,{
if(!isLink&&target.mayHaveShan(player,'use')&&!player.hasSkillTag('directHit_ai',true,{
target:target,
card:card,
},true)) return eff/1.2;

View File

@ -3513,7 +3513,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
list.remove(player.storage.kyou_zhidian);
player.chooseControl(list).set('prompt','掷典:请为'+get.translation(trigger.card)+'选择一种效果').set('choice',function(){
if(list.contains('不计入次数')&&player.hasSha()) return '不计入次数';
if(list.contains('不可被响应')&&trigger.target.mayHaveShan()) return '不可被响应';
if(list.contains('不可被响应')&&trigger.target.mayHaveShan(_status.event.player,'use')) return '不可被响应';
if(list.contains('伤害+1')) return '伤害+1';
return list.randomGet();
}()).set('ai',()=>_status.event.choice);

View File

@ -1012,7 +1012,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
}
var hasRuanshizi=game.hasPlayer(function(target){
return target!=player&&player.canUse('sha',target,null,true)&&!target.mayHaveShan()&&get.attitude(player,target)<0&&get.effect(target,{name:'sha'},player,player)>0;
return target!=player&&player.canUse('sha',target,null,true)&&!target.mayHaveShan(player,'use')&&get.attitude(player,target)<0&&get.effect(target,{name:'sha'},player,player)>0;
})
for(var card of hs){
var name=get.name(card);

View File

@ -4582,7 +4582,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var d1=true;
if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false
for(var target of trigger.targets){
if(!target.mayHaveShan()||trigger.player.hasSkillTag('directHit_ai',true,{
if(!target.mayHaveShan(player,'use')||trigger.player.hasSkillTag('directHit_ai',true,{
target:target,
card:trigger.card,
},true)){

View File

@ -2368,7 +2368,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
result:{
target:function(player,target){
var eff=get.effect(target,{name:'sha',nature:'fire'},player,target)/30;
if(!target.mayHaveShan()) eff*=2;
if(!target.mayHaveShan(player,'use')) eff*=2;
var del=target.countCards('h')-player.countCards('h')+1.5;
eff*=Math.sqrt(del);
return eff;
@ -5224,7 +5224,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(_status.event.all) return 1;
if(ui.selected.buttons.length) return 0;
return Math.random();
}).set('all',!target.mayHaveShan()&&Math.random()<0.75).set('forceAuto',true);
}).set('all',!target.mayHaveShan(player,'use')&&Math.random()<0.75).set('forceAuto',true);
'step 1'
if(result.bool){
var cards=result.cards;

View File

@ -8443,7 +8443,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
]).set('ai',function(){
var target=_status.event.getTrigger().target;
var player=_status.event.player;
var num=target.mayHaveShan()?0:1;
var num=target.mayHaveShan(player,'use')?0:1;
if(get.attitude(player,target)>0) num=1-num;
return num;
});

View File

@ -170,7 +170,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
d1=true;
if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false;
for(var target of trigger.targets){
if(!target.mayHaveShan()||trigger.player.hasSkillTag('directHit_ai',true,{
if(!target.mayHaveShan(player,'use')||trigger.player.hasSkillTag('directHit_ai',true,{
target:target,
card:trigger.card,
},true)){
@ -299,7 +299,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var effect=0;
for(var target of trigger.targets){
var eff=get.effect(target,trigger.card,trigger.player,player);
if(!target.mayHaveShan()||trigger.player.hasSkillTag('directHit_ai',true,{
if(!target.mayHaveShan(player,'use')||trigger.player.hasSkillTag('directHit_ai',true,{
target:target,
card:trigger.card,
},true)){
@ -4906,7 +4906,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
//护驾
else if(!player.hasShan()&&game.hasPlayer(function(current){
return current!=player&&current.group=='wei'&&current.mayHaveShan()&&get.attitude(player,current)>0&&get.attitude(current,player)>0;
return current!=player&&current.group=='wei'&&current.mayHaveShan(player,'respond')&&get.attitude(player,current)>0&&get.attitude(current,player)>0;
})) return 1;
return -1;
});
@ -4940,7 +4940,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
//护驾
else if(!player.hasShan()&&game.hasPlayer(function(current){
return current!=player&&current.group=='wei'&&current.mayHaveShan()&&get.attitude(player,current)>0&&get.attitude(current,player)>0;
return current!=player&&current.group=='wei'&&current.mayHaveShan(player,'respond')&&get.attitude(player,current)>0&&get.attitude(current,player)>0;
})) return 'hujia';
});
}

View File

@ -11122,7 +11122,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
useShan:true,
effect:{
target:function(card,player,target,current){
let name='sha';
let name;
if(typeof card=='object'){
if(card.viewAs) name=card.viewAs;
else name=get.name(card);

View File

@ -5162,10 +5162,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
return -1.5;
}();
if(!isLink && target.mayHaveShan() && !player.hasSkillTag('directHit_ai', true, {
if(!isLink && target.mayHaveShan(player,'use') && !player.hasSkillTag('directHit_ai', true, {
target: target,
card: card
}, true)) return eff / 1.2;
}, true)) return eff * 0.6;
return eff;
}
},
@ -6954,7 +6954,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
else{
var target=trigger.target;
if(trigger.targets.length>1||target.mayHaveShan()) return 0;
if(trigger.targets.length>1||target.mayHaveShan(player,'use')) return 0;
}
var num=trigger.getParent().baseDamage;
var map=trigger.getParent().customArgs,id=target.playerid;
@ -14460,12 +14460,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(num>=delta) return 'zeroplayertarget';
}
else if(get.tag(card,'respondShan')>0){
if(current<0&&used==target.getAttackRange()-1&&target.mayHaveShan()){
if(current<0&&used==target.getAttackRange()-1&&target.mayHaveShan(player)){
return 0.6;
}
}
else if(get.tag(card,'respondSha')>0){
if(current<0&&used==target.getAttackRange()-1&&target.mayHaveSha()){
if(current<0&&used==target.getAttackRange()-1&&target.mayHaveSha(player)){
return 0.6;
}
}

View File

@ -5015,7 +5015,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
})) return 3;
return Math.sqrt(target.countCards('he'));
}
if(target.mayHaveShan()&&player.countCards('hs',function(card){
if(target.mayHaveShan(player,'use')&&player.countCards('hs',function(card){
return !ui.selected.cards.contains(card)&&get.name(card)=='sha'&&player.canUse(card,target)&&get.effect(target,card,player,player)!=0;
})) return -Math.sqrt(Math.abs(get.attitude(player,target)))/2;
return 0.1;
@ -5347,7 +5347,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.addSkill('mouni2');
player.chooseTarget(get.prompt2('mouni'),lib.filter.notMe).set('ai',function(target){
var player=_status.event.player,cards=player.getCards('h','sha');
if(get.attitude(player,target)>=0||!player.canUse(cards[0],target,false)||(!player.hasJudge('lebu')&&target.mayHaveShan()&&!player.hasSkillTag('directHit_ai',true,{
if(get.attitude(player,target)>=0||!player.canUse(cards[0],target,false)||(!player.hasJudge('lebu')&&target.mayHaveShan(player,'use')&&!player.hasSkillTag('directHit_ai',true,{
target:target,
card:cards[0],
},true))) return 0;

View File

@ -384,7 +384,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}).set('goon',function(){
var d1=true;
if(player.hasSkill('jueqing')||player.hasSkill('gangzhi')) d1=false;
if(!target.mayHaveShan()||player.hasSkillTag('directHit_ai',true,{
if(!target.mayHaveShan(player,'use')||player.hasSkillTag('directHit_ai',true,{
target:target,
card:trigger.card,
},true)){
@ -2985,7 +2985,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
expose:0.2,
result:{
target:function(player,target){
if(target.countCards('h')<=target.hp&&!target.mayHaveShan()&&get.effect(target,{name:'sha',isCard:true},player,player)>0) return -1;
if(target.countCards('h')<=target.hp&&!target.mayHaveShan(player,'use')&&get.effect(target,{name:'sha',isCard:true},player,player)>0) return -1;
else if(target.countCards('h')>target.hp&&target.hp>2&&target.hasShan()) return 1;
return 0;
},
@ -6572,7 +6572,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var player=_status.event.player;
if(player.hp+player.countCards('hs',{name:['tao','jiu']})<=1) return -1;
var num=1;
if((!target.mayHaveShan()||player.hasSkillTag('directHit_ai',true,{
if((!target.mayHaveShan(player,'use')||player.hasSkillTag('directHit_ai',true,{
target:target,
card:{name:'sha'},
},true))&&!target.hasSkillTag('filterDamage',null,{
@ -11090,7 +11090,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var d1=true;
if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false;
for(var target of trigger.targets){
if(!target.mayHaveShan()||trigger.player.hasSkillTag('directHit_ai',true,{
if(!target.mayHaveShan(player,'use')||trigger.player.hasSkillTag('directHit_ai',true,{
target:target,
card:trigger.card,
},true)){
@ -13290,7 +13290,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var d1=true;
if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false
for(var target of trigger.targets){
if(!target.mayHaveShan()||trigger.player.hasSkillTag('directHit_ai',true,{
if(!target.mayHaveShan(player,'use')||trigger.player.hasSkillTag('directHit_ai',true,{
target:target,
card:trigger.card,
},true)){

View File

@ -2235,7 +2235,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
case 2:{
var num=1.3;
if(event.card.name=='sha'&&event.targets.filter(function(current){
if(current.mayHaveShan()&&get.attitude(player,current)<=0){
if(current.mayHaveShan(player,'use')&&get.attitude(player,current)<=0){
if(current.hasSkillTag('useShan')) num=1.9;
return true;
}

View File

@ -3528,7 +3528,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
]).set('prompt',get.prompt('gzliegong',trigger.target)).setHiddenSkill('gzliegong').set('ai',function(){
var player=_status.event.player,target=_status.event.getTrigger().target;
if(get.attitude(player,target)>0) return 2;
return target.mayHaveShan()?1:0;
return target.mayHaveShan(player,'use')?1:0;
});
'step 1'
if(result.control!='cancel2'){
@ -10654,7 +10654,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
goon=false;
}
else if(trigger.card.name=='sha'){
if(trigger.target.mayHaveShan()||trigger.target.hp>=3){
if(trigger.target.mayHaveShan(player,'use')||trigger.target.hp>=3){
goon=false;
}
}

View File

@ -10090,7 +10090,7 @@ export class Library extends Uninstantable {
if (game.hasPlayer(current => {
if (!player.canUse(card, current)) return false;
const storage = player.storage, zhibi = storage.zhibi;
return (zhibi && !zhibi.includes(current) || (get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1))) && current.mayHaveShan() && player.hasSkill('jiu');
return (zhibi && !zhibi.includes(current) || get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && current.mayHaveShan(player, 'use') && player.hasSkill('jiu');
})) return 1;
return 0;
}
@ -10161,7 +10161,7 @@ export class Library extends Uninstantable {
if (game.hasPlayer(current => {
if (!player.canUse(card, current)) return false;
const storage = player.storage, zhibi = storage.zhibi;
return (zhibi && !zhibi.contains(current) || (get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1))) && current.mayHaveShan();
return (zhibi && !zhibi.contains(current) || get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && current.mayHaveShan(player, 'use');
})) return get.order(card, player) + 0.5;
}
else if (cardName == 'tao' && player.hp <= 2 && player.getDamagedHp() >= 2) return get.order(card, player) + 0.5;