优化部分技能ai
【智哲】牌存牌ai; 【蛮嗣】吃桃ai; 【元嫡】身份暴露; 【寤寐】全场ai; 【暗织】选牌ai; 【归离】标记显示; 【哀尘】强命ai; 【救陷】【继椒】ai
This commit is contained in:
parent
82a98ec061
commit
eb922db18b
|
@ -2358,22 +2358,28 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
}).set('choice',(()=>{
|
}).set('choice',(()=>{
|
||||||
var choicesx=choices.slice();
|
var choicesx=choices.slice();
|
||||||
var cards=player.getCards('hs');
|
var cards=player.getCards('hs');
|
||||||
var bool1=get.tag(trigger.card,'damage')&&choicesx.contains('选项一')&&trigger.targets.some(current=>{
|
var bool1=get.tag(trigger.card,'damage')&&choicesx.includes('选项一')&&trigger.targets.some(current=>{
|
||||||
return get.attitude(player,current)<0;
|
return get.attitude(player,current)<0;
|
||||||
}),bool2=choicesx.contains('选项二')&&game.countPlayer(current=>get.attitude(player,current)>0)>=1;
|
}),bool2=choicesx.includes('选项二');
|
||||||
if(!bool1&&!bool2){
|
if(bool2) bool2=game.countPlayer(function(current){
|
||||||
|
return player!=current&&get.attitude(player,current)>0;
|
||||||
|
});
|
||||||
|
else bool2=0;
|
||||||
|
if(bool1||bool2){
|
||||||
for(var i=0;i<cards.length;i++){
|
for(var i=0;i<cards.length;i++){
|
||||||
var name=get.name(cards[i]);
|
var name=get.name(cards[i]);
|
||||||
if(player.getStorage('dcqingshi_clear').contains(name)) continue;
|
if(player.getStorage('dcqingshi_clear').includes(name)) continue;
|
||||||
for(var j=i+1;j<cards.length;j++){
|
for(var j=i+1;j<cards.length;j++){
|
||||||
if(name==get.name(cards[j])&&get.position(cards[i])+get.position(cards[j])!='ss'&&player.hasValueTarget(cards[i])){
|
if(name===get.name(cards[j])&&get.position(cards[i])+get.position(cards[j])!=='ss'&&player.hasValueTarget(cards[i])){
|
||||||
choicesx.remove('选项三');
|
choicesx.remove('选项三');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(choicesx.contains('选项三')) return '选项三';
|
if(bool2>2) return '选项二';
|
||||||
|
if(choicesx.includes('选项三')) return '选项三';
|
||||||
|
if(bool2===2) return '选项二';
|
||||||
if(bool1) return '选项一';
|
if(bool1) return '选项一';
|
||||||
if(bool2) return '选项二';
|
if(bool2) return '选项二';
|
||||||
return 'cancel2';
|
return 'cancel2';
|
||||||
|
@ -2486,6 +2492,25 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
},
|
},
|
||||||
subSkill:{
|
subSkill:{
|
||||||
effect:{
|
effect:{
|
||||||
|
mod:{
|
||||||
|
aiOrder:function(player,card,num){
|
||||||
|
if(num>0&&get.itemtype(card)==='card'&&card.hasGaintag('dczhizhe')) return num+0.16;
|
||||||
|
},
|
||||||
|
aiValue:function(player,card,num){
|
||||||
|
if(num>0&&get.itemtype(card)==='card'&&card.hasGaintag('dczhizhe')) return 2*num;
|
||||||
|
},
|
||||||
|
aiUseful:function(player,card,num){
|
||||||
|
if(num>0&&!player._dczhizhe_mod&&get.itemtype(card)==='card'&&card.hasGaintag('dczhizhe')){
|
||||||
|
if(player.canIgnoreHandcard(card)) return Infinity;
|
||||||
|
player._dczhizhe_mod=true;
|
||||||
|
if(player.hp<3&&player.needsToDiscard(player.countCards('h',(cardx)=>{
|
||||||
|
if(player.canIgnoreHandcard(cardx)||get.useful(cardx)>6) return true;
|
||||||
|
return false;
|
||||||
|
}))) return num*1.5;
|
||||||
|
return num*10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
trigger:{player:['useCardAfter','respondAfter']},
|
trigger:{player:['useCardAfter','respondAfter']},
|
||||||
charlotte:true,
|
charlotte:true,
|
||||||
forced:true,
|
forced:true,
|
||||||
|
@ -2778,7 +2803,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
order:1,
|
order:1,
|
||||||
result:{
|
result:{
|
||||||
target:function(player,target){
|
target:function(player,target){
|
||||||
if(game.roundNumber==1&&ui.cardPile.childNodes.length>game.countPlayer()*5&&!game.hasPlayer(current=>current.hp<=2)&&!player.hasSkill('dcjijiao_risutoa')) return 0;
|
if(ui.cardPile.childNodes.length>game.players.length*5&&!player.hasSkill('dcjijiao_risutoa')&&
|
||||||
|
!game.hasPlayer(current=>current.hp<=1)&&game.countPlayer(current=>current.hp===2&¤t.countCards('hes')<3)<=1) return 0;
|
||||||
return 5;
|
return 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3028,8 +3054,43 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
},true);
|
},true);
|
||||||
},
|
},
|
||||||
ai:{
|
ai:{
|
||||||
order:5.5,
|
order:function(){
|
||||||
result:{player:1}
|
return 0.9*get.order({name:'juedou'});
|
||||||
|
},
|
||||||
|
tag:{
|
||||||
|
respond:2,
|
||||||
|
respondSha:2,
|
||||||
|
damage:1,
|
||||||
|
},
|
||||||
|
result:{
|
||||||
|
player:function(player){
|
||||||
|
let target=null, maxval=0;
|
||||||
|
for(let i of game.players){
|
||||||
|
let jdeff=get.effect(i,{
|
||||||
|
name:'juedou',
|
||||||
|
isCard:true,
|
||||||
|
cards:ui.selected.cards,
|
||||||
|
storage:{dcctjiuxian:true}
|
||||||
|
},player,player);
|
||||||
|
if(i===player||!player.canUse({
|
||||||
|
name:'juedou',
|
||||||
|
isCard:true,
|
||||||
|
cards:ui.selected.cards,
|
||||||
|
storage:{dcctjiuxian:true}
|
||||||
|
},i)||jdeff<0) continue;
|
||||||
|
let receff=0;
|
||||||
|
game.filterPlayer(function(current){
|
||||||
|
if(player!=current&&i.inRange(current)&¤t.isDamaged()) receff=Math.max(receff,get.recoverEffect(current,i,i));
|
||||||
|
});
|
||||||
|
if(jdeff+receff/5>maxval){
|
||||||
|
target=i;
|
||||||
|
maxval=jdeff+receff/5;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(target) return maxval/80;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
subSkill:{
|
subSkill:{
|
||||||
help:{
|
help:{
|
||||||
|
@ -3609,6 +3670,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
player.logSkill('dcyuandi',target);
|
player.logSkill('dcyuandi',target);
|
||||||
if(result.control=='选项一'){
|
if(result.control=='选项一'){
|
||||||
player.discardPlayerCard(target,'h',true);
|
player.discardPlayerCard(target,'h',true);
|
||||||
|
if(get.mode()!=='identity'||player.identity!=='nei') player.addExpose(0.15);
|
||||||
}
|
}
|
||||||
else game.asyncDraw([target,player]);
|
else game.asyncDraw([target,player]);
|
||||||
}
|
}
|
||||||
|
@ -4373,7 +4435,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
if(cards.length){
|
if(cards.length){
|
||||||
player.chooseButton(['暗织:选择令'+get.translation(target)+'获得的牌',cards],true,Math.min(cards.length,2)).set('ai',button=>{
|
player.chooseButton(['暗织:选择令'+get.translation(target)+'获得的牌',cards],true,Math.min(cards.length,2)).set('ai',button=>{
|
||||||
var player=_status.event.player,target=_status.event.getParent().target;
|
var player=_status.event.player,target=_status.event.getParent().target;
|
||||||
return get.sgnAttitude(player,target)*get.buttonValue(button);
|
return get.sgnAttitude(player,target)*get.value(button.link,target);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}else event.finish();
|
}else event.finish();
|
||||||
|
@ -4560,11 +4622,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
subSkill:{
|
subSkill:{
|
||||||
used:{charlotte:true},
|
used:{charlotte:true},
|
||||||
wake:{
|
wake:{
|
||||||
|
init:function(player){
|
||||||
|
game.addGlobalSkill('dcwumei_all');
|
||||||
|
},
|
||||||
|
onremove:function(player){
|
||||||
|
game.removeGlobalSkill('dcwumei_all');
|
||||||
|
delete player.storage.dcwumei_wake;
|
||||||
|
},
|
||||||
trigger:{player:'phaseJieshuBegin'},
|
trigger:{player:'phaseJieshuBegin'},
|
||||||
charlotte:true,
|
charlotte:true,
|
||||||
popup:false,
|
popup:false,
|
||||||
forced:true,
|
forced:true,
|
||||||
onremove:true,
|
|
||||||
filter:function(event,player){
|
filter:function(event,player){
|
||||||
return player.storage.dcwumei_wake&&player.storage.dcwumei_wake.length;
|
return player.storage.dcwumei_wake&&player.storage.dcwumei_wake.length;
|
||||||
},
|
},
|
||||||
|
@ -4597,17 +4665,23 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
all:{
|
||||||
|
trigger:{player:'dieAfter'},
|
||||||
|
filter:function(event,player){
|
||||||
|
return !game.hasPlayer(current=>current.hasSkill('dcwumei_wake'));
|
||||||
|
},
|
||||||
|
silent:true,
|
||||||
|
forceDie:true,
|
||||||
|
content:function(){
|
||||||
|
game.removeGlobalSkill('dcwumei_all');
|
||||||
},
|
},
|
||||||
ai:{
|
ai:{
|
||||||
effect:{
|
effect:{
|
||||||
player_use:function(card,player,target){
|
player_use:function(card,player,target){
|
||||||
|
if(get.tag(card,'recover')&&target.hp>0) return 0;
|
||||||
if(get.tag(card,'damage')) return 0.5;
|
if(get.tag(card,'damage')) return 0.5;
|
||||||
},
|
|
||||||
target:function(card,player,target){
|
|
||||||
if(_status.event.type!='phase') return;
|
|
||||||
if (get.tag(card,'recover')){
|
|
||||||
return [1,1-target.hp];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7747,6 +7821,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
onremove:true,
|
onremove:true,
|
||||||
subSkill:{
|
subSkill:{
|
||||||
insert:{
|
insert:{
|
||||||
|
mark:true,
|
||||||
|
intro:{
|
||||||
|
content:'players'
|
||||||
|
},
|
||||||
trigger:{global:'phaseAfter'},
|
trigger:{global:'phaseAfter'},
|
||||||
forced:true,
|
forced:true,
|
||||||
charlotte:true,
|
charlotte:true,
|
||||||
|
@ -11011,7 +11089,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
viewAs:{name:'nanman'},
|
viewAs:{name:'nanman'},
|
||||||
ai:{order:0.1},
|
ai:{
|
||||||
|
order:0.1,
|
||||||
|
nokeep:true,
|
||||||
|
skillTagFilter:function(player,tag,arg){
|
||||||
|
if(tag==='nokeep') return (!arg||arg.card&&get.name(arg.card)==='tao')&&player.isPhaseUsing()&&!player.getStat('skill').mansi_viewas&&player.hasCard((card)=>get.name(card)!=='tao','h');
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
souying:{
|
souying:{
|
||||||
audio:2,
|
audio:2,
|
||||||
|
|
Loading…
Reference in New Issue