Merge pull request #432 from PZ157/PR-Branch

武将ai优化
This commit is contained in:
Spmario233 2023-09-30 22:01:06 +08:00 committed by GitHub
commit 0e563aab9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 137 additions and 10 deletions

View File

@ -29,7 +29,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
ddd_liangxi:['male','wei',3,['dddtongyu']],
ddd_wangkanglvkai:['male','shu',4,['dddbingjian']],
ddd_sunliang:['male','wu',3,['ddddiedang','dddanliu','dddguiying'],['zhu']],
ddd_lie:['male','wu',3,['dddyeshen','dddqiaoduan']],
ddd_lie:['female','wu',3,['dddyeshen','dddqiaoduan']],
},
characterFilter:{},
characterSort:{},

View File

@ -8235,6 +8235,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return max2;
},
audio:2,
init:function(player){
game.addGlobalSkill('fengxiang_use');
},
onremove:function(player){
game.removeGlobalSkill('fengxiang_use');
},
trigger:{player:'damageEnd'},
forced:true,
filter:function(event,player){
@ -8265,6 +8271,26 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.draw();
},
},
use:{
mod:{
aiOrder:function(player,card,num){
if(num>0&&get.itemtype(card)==='card'&&card.hasGaintag('fengxiang_tag')&&game.hasPlayer(current=>{
return current.hasSkill('fengxiang')&&get.attitude(player,current)>0;
})) return num+10;
}
},
trigger:{player:'dieAfter'},
filter:function(event,player){
for(let i of game.players){
if(i.hasSkill('fengxiang')) return false;
}
return true;
},
silent:true,
content:function(){
game.removeGlobalSkill('fengxiang_use');
}
}
},
},
//阚泽

View File

@ -8055,7 +8055,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},targets[0],targets[1])
},
ai:{
order:1,
order:function(){
return get.order({name:'tao'})+1;
},
result:{
target:function(player,target){
if(player.hasUnknown()&&target!=player.next&&target!=player.previous) return 0;

View File

@ -847,7 +847,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
order:7,
result:{
player:function(player,target){
if(!player.hasSkill('sbbiyue') return 0;
if(!player.hasSkill('sbbiyue')) return 0;
let targets=_status.event.getTempCache('sblijian','targets');
if(Array.isArray(targets)) for(let i=0;i<targets.length;i++){
if(target===targets[i][0]&&targets[i][2]===0) return 1;

View File

@ -958,6 +958,31 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){
trigger.getParent().excluded.add(player);
},
ai:{
effect:{
target:function(card,player,target){
let hs=player.getCards('h',i=>i!==card&&(!card.cards||!card.cards.contains(i))),num=player.getCardUsable('sha');
if(card.name!=='sha'&&card.name!=='juedou'||hs.length<target.countCards('h')) return 1;
if(game.hasPlayer2(function(current){
return current.getHistory('useCard',function(evt){
return evt.card&&['sha','juedou'].includes(evt.card.name)&&evt.targets.includes(player);
}).length>0;
})) return 1;
if(card.name==='sha') num--;
hs=hs.filter(i=>{
if(i.name==='juedou') return true;
if(num&&i.name==='sha'){
num--;
return true;
}
return false;
});
if(!hs.length) return 'zeroplayertarget';
num=1-2/3/hs.length;
return [num,0,num,0];
}
}
}
},
"drlt_qianjie":{
group:["drlt_qianjie_1","drlt_qianjie_2","drlt_qianjie_3"],

View File

@ -1399,7 +1399,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
order:9,
result:{player:1},
},
group:'shanxie_exclude',
group:['shanxie_exclude','shanxie_shan'],
subSkill:{
exclude:{
trigger:{global:'useCard'},
@ -1414,6 +1414,48 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){
trigger.all_excluded=true;
},
sub:true
},
shan:{
trigger:{player:'useCardToPlayered'},
filter:function(event,player){
return event.target.isAlive()&&event.card.name=='sha';
},
silent:true,
content:function(){
trigger.target.addTempSkill('shanxie_banned');
trigger.target.storage.shanxie_banned={
card:trigger.card,
num:player.getAttackRange()*2
};
},
sub:true
},
banned:{
init:function(player){
player.storage.shanxie_banned={};
},
onremove:function(player){
delete player.storage.shanxie_banned;
},
trigger:{global:'useCardEnd'},
filter:function(event,player){
return event.card==player.storage.shanxie_banned.card;
},
silent:true,
content:function(){
player.removeSkill('shanxie_banned');
},
ai:{
effect:{
player:function(card,player,target){
if(get.name(card)=='shan'){
let num=get.number(card);
if(!num||num<=player.storage.shanxie_banned.num) return 'zeroplayertarget';
}
}
}
}
},
},
},
@ -5808,6 +5850,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
spshanxi:{
audio:2,
init:function(player){
game.addGlobalSkill('spshanxi_bj');
},
onremove:function(player){
game.removeGlobalSkill('spshanxi_bj');
},
trigger:{player:'phaseUseBegin'},
direct:true,
filter:function(event,player){
@ -5867,6 +5915,28 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else trigger.player.give(result.cards,player);
},
},
spshanxi_bj:{
trigger:{player:'dieAfter'},
filter:function(event,player){
return !game.hasPlayer(current=>current.hasSkill('spshanxi_suoming'));
},
silent:true,
charlotte:true,
content:function(){
game.removeGlobalSkill('spshanxi_bj');
},
ai:{
effect:{
target:function(card,player,target){
let suoming=game.findPlayer(current=>current.hasSkill('spshanxi_suoming'));
if(suoming&&_status.event&&target===_status.event.dying&&target.hasMark('spshanxi')){
if(target.countCards('he')<2) return 'zerotarget';
return [1,get.attitude(target,suoming)>0?0:-1.2];
}
}
}
}
},
shameng:{
audio:2,
enable:'phaseUse',

View File

@ -10084,6 +10084,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return true;
},
prompt2:'令其交给你一张手牌,并根据类型获得对应的标记',
check:function(event,player){
return get.attitude(_status.event.player,event.player)>0;
},
content:function(){
'step 0'
event.target=trigger.player;

View File

@ -3394,12 +3394,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
var next=player.chooseToDiscard('he',get.prompt('chaofeng',trigger.player),str);
next.set('ai',function(card){
var player=_status.event.player,suit=_status.event.color,number=_status.event.type,att=_status.event.att;
var val=4-get.value(card);
if(get.color(card)==suit) val+=3;
if(get.type2(card)==number){
if(att<=0) val+=4;
else val-=3;
var player=_status.event.player,att=_status.event.att;
var val=4.2-get.value(card);
if(get.color(card)==_status.event.color) val+=3;
if(get.type2(card)==_status.event.type){
if(att<0) val+=4;
else if(att===0) val+=2;
else val=0;
}
return val;
});