Merge pull request #670 from PZ157/PR-Branch

为自动循环发动的技能增加技能状态检测
This commit is contained in:
Spmario233 2023-11-24 22:40:24 +08:00 committed by GitHub
commit aeca36e31f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 67 additions and 50 deletions

View File

@ -268,10 +268,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){
multitarget:true,
targetprompt:['给一张牌','得两张牌'],
filterTarget:function(card,player,target){
return target!=player;
return target!==player;
},
filterAddedTarget:function(card,player,target){
return target!=player;
filterAddedTarget:function(card,player,target,preTarget){
return target!==preTarget&&target!==player;
},
content:function(){
'step 0'
@ -313,21 +313,17 @@ game.import('card',function(lib,game,ui,get,ai,_status){
},
result:{
target:function(player,target){
var ok=false;
var hs=player.getCards('h');
if(hs.length<=1) return 0;
for(var i=0;i<hs.length;i++){
if(get.value(hs[i])<=5){
ok=true;
break;
}
}
if(!ok) return 0;
if(ui.selected.targets.length==1){
if(target.hasSkillTag('nogain')) return 0;
let hs=player.getCards('h');
if(hs.length<=1 || !hs.some(i=>{
return get.value(hs[i])<5.5;
})) return 0;
let targets=get.copy(ui.selected.targets);
if(_status.event.preTarget) targets.add(_status.event.preTarget);
if(targets.length){
if(target.hasSkillTag('nogain')) return 0.01;
return 2;
}
if(target.countCards('he')==0) return 0;
if(!target.countCards('he')) return 0;
if(player.hasFriend()) return -1;
return 0;
}

View File

@ -1838,23 +1838,39 @@ game.import('card',function(lib,game,ui,get,ai,_status){
useful:1,
},
result:{
target:function(player,target){
if(ui.selected.targets.length){
const preTarget=ui.selected.targets.lastItem;
const eff=get.effect(target,{name:'sha'},preTarget,player);
return Math.sign(eff)*get.sgnAttitude(player,target);
player:(player,target)=>{
if(!target.hasSkillTag('noe')&&get.attitude(player,target)>0) return 0;
return (player.hasSkillTag('noe')?0.32:0.15)*target.getEquips(1).reduce((num,i)=>{
return num+get.value(i,player);
},0);
},
target:(player,target)=>{
let targets=get.copy(ui.selected.targets);
if(_status.event.preTarget) targets.add(_status.event.preTarget);
if(targets.length){
let preTarget=targets.lastItem,pre=_status.event.getTempCache('jiedao_result',preTarget);
if(pre&&pre.target.isIn()) return target===pre.target?pre.eff:0;
return get.effect(target,{name:'sha'},preTarget,player)/get.attitude(player,target);
}
const filter=get.info({name:'jiedao'}).filterAddedTarget;
if(game.hasPlayer(current=>{
return filter(null,null,current,target)&&get.effect(current,{name:'sha'},target,player)>=0;
})) return -1;
if(target.mayHaveSha(player,'use')) return 0.25;
return -1;
},
player:function(player){
if(player.getCards('he',{subtype:'equip1'}).length) return 0;
return 1.25;
},
let arms=(target.hasSkillTag('noe')?0.32:-0.15)*target.getEquips(1).reduce((num,i)=>{
return num+get.value(i,target);
},0);
if(!target.mayHaveSha(player,'use')) return arms;
let sha=game.filterPlayer(get.info({name:'jiedao'}).filterAddedTarget),addTar=null;
sha=sha.reduce((num,current)=>{
let eff=get.effect(current,{name:'sha'},target,player);
if(eff<=num) return num;
addTar=current;
return eff;
},-100);
if(!addTar) return arms;
sha/=get.attitude(player,target);
_status.event.putTempCache('jiedao_result',target,{
target:addTar,
eff:sha
});
return Math.max(arms,sha);
}
},
tag:{
gain:1,

View File

@ -6840,8 +6840,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.addToExpansion(result.cards,player,'give').gaintag.add('quanji');
}
"step 4"
if(event.count>0&&player.hasSkill('requanji')){
player.chooseBool(get.prompt2('requanji')).set('frequentSkill','requanji');
if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){
player.chooseBool(get.prompt2('requanji')).set('frequentSkill',event.name);
}
else event.finish();
"step 5"
@ -12909,8 +12909,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.draw();
event.count--;
"step 2"
if(event.count){
player.chooseBool(get.prompt2('mingzhe')).set('frequentSkill',event.name);
if(event.count&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){
player.chooseBool(get.prompt2('mingzhe')).set('frequentSkill',event.name);
}
else event.finish();
"step 3"

View File

@ -4593,8 +4593,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 4'
if(cards.length) player.gain(cards,'gain2','log');
'step 5'
if(event.count>0&&player.hasSkill('spyinzhi')){
player.chooseBool(get.prompt2('spyinzhi')).set('frequentSkill','spyinzhi');
if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){
player.chooseBool(get.prompt2('spyinzhi')).set('frequentSkill',event.name);
}
else event.finish();
'step 6'

View File

@ -2856,7 +2856,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
nokeep:true,
skillTagFilter:function(player,tag,arg){
if(tag==='nokeep') return (!arg||arg.card&&get.name(arg.card)==='tao')&&player.isPhaseUsing()&&player.countSkill('rezhanjue_draw')<3&&player.hasCard((card)=>get.name(card)!='tao'&&!card.hasGaintag('reqinwang'),'h');
if(tag==='nokeep') return (!arg||arg.card&&get.name(arg.card)==='tao')&&player.isPhaseUsing()&&player.countSkill('rezhanjue_draw')<3&&player.hasCard((card)=>{
return get.name(card)!=='tao'&&!card.hasGaintag('reqinwang');
},'h');
}
},
},
@ -5510,8 +5512,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.addToExpansion(result.cards,'giveAuto',player).gaintag.add('xinquanji');
}
'step 4'
if(event.count>0&&player.hasSkill('xinquanji')){
player.chooseBool(get.prompt2('xinquanji')).set('frequentSkill','xinquanji');
if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){
player.chooseBool(get.prompt2('xinquanji')).set('frequentSkill',event.name);
}
else event.finish();
'step 5'

View File

@ -4493,7 +4493,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.syncStorage('huashen');
player.updateMarks('huashen');
'step 2'
if(--event.num>0) player.chooseBool(get.prompt2('xinsheng')).set('frequentSkill','xinsheng');
if(--event.num>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){
player.chooseBool(get.prompt2('xinsheng')).set('frequentSkill',event.name);
}
else event.finish();
'step 3'
if(result.bool&&player.hasSkill('xinsheng')){

View File

@ -23349,8 +23349,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.draw();
event.count--;
"step 2"
if(event.count){
player.chooseBool(get.prompt2('mingzhe')).set('frequentSkill','mingzhe');
if(event.count&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){
player.chooseBool(get.prompt2('mingzhe')).set('frequentSkill',event.name);
}
else event.finish();
"step 3"

View File

@ -649,7 +649,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
animate:'draw',
}).setContent('gaincardMultiple');
'step 6'
if(event.count>0&&player.hasSkill(event.name)){
if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){
player.chooseBool(get.prompt2(event.name)).set('frequentSkill',event.name);
}
else event.finish();
@ -1937,7 +1937,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
event.count--;
player.draw(2);
"step 2"
if(event.count>0){
if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){
player.chooseBool(get.prompt2('xiaoji')).set('frequentSkill','xiaoji').ai=lib.filter.all;
}
"step 3"

View File

@ -1388,10 +1388,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
},
cardname:function(card){
if(card.hasGaintag('kousheng')) return 'sha';
if(get.itemtype(card)=='card'&&card.hasGaintag('kousheng')) return 'sha';
},
cardnature:function(card){
if(card.hasGaintag('kousheng')) return false;
if(get.itemtype(card)=='card'&&card.hasGaintag('kousheng')) return false;
},
},
group:'kousheng_damage',
@ -10852,8 +10852,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.addToExpansion(result.cards,player,'giveAuto').gaintag.add('quanji');
}
"step 4"
if(event.count>0&&player.hasSkill('quanji')){
player.chooseBool(get.prompt2('quanji')).set('frequentSkill','quanji');
if(event.count>0&&player.hasSkill(event.name)&&!get.is.blocked(event.name,player)){
player.chooseBool(get.prompt2('quanji')).set('frequentSkill',event.name);
}
else event.finish();
"step 5"

View File

@ -14497,6 +14497,7 @@ new Promise(resolve=>{
},true);
next.set('_get_card',card);
next.set('preTarget',targets[num]);
next.set('ai',target=>get.effect(target,get.card(),player,_status.event.player));
}
else{
event.addedTargets[num]=false;