Merge pull request #749 from PZ157/PR-Branch

ai相关bug修复
This commit is contained in:
Spmario233 2023-12-28 22:03:40 +08:00 committed by GitHub
commit e2b6f3cb7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 187 additions and 74 deletions

View File

@ -7778,7 +7778,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
mod:{
globalFrom:function(from,to,num){
return num-game.countPlayer(function(current){
return current!=from&&current.isFriendOf(from)&&current.hasSkill('yuzuru_bujin');
return current!=from&&current.hasSkill('yuzuru_bujin')&&current.isFriendOf(from);
});
},
},
@ -11916,6 +11916,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
},
nslongyue:{
init:()=>{
game.addGlobalSkill('nslongyue_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('nslongyue'),true)) game.removeGlobalSkill('nslongyue_ai');
},
trigger:{global:'useCard'},
filter:function(event,player){
return get.type(event.card,'trick')=='trick'&&event.player.getHistory('useCard').indexOf(event)==0;
@ -11929,8 +11935,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
ai:{
expose:0.2,
},
global:'nslongyue_ai',
}
},
nslongyue_ai:{
mod:{
@ -11940,6 +11945,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
})) return num+6;
},
},
trigger:{player:'dieAfter'},
filter:()=>{
return !game.hasPlayer(i=>i.hasSkill('nslongyue'),true);
},
silent:true,
forceDie:true,
content:()=>{
game.removeGlobalSkill('nslongyue_ai');
}
},
nszhenyin:{
trigger:{global:'judge'},

View File

@ -1638,11 +1638,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
},
meiying:{
global:'meiying2',
globalSilent:true,
trigger:{global:'phaseEnd'},
filter:function(event,player){
return event.player!=player&&!event.player.tempSkills.meiying3&&event.player.isAlive()&&player.countCards('he',{color:'red'})>0;
return event.player!=player&&event.player.isAlive()&&player.countCards('he',{color:'red'})&&event.player.getHistory('useCard',evt=>{
return evt.targets&&evt.targets.some(i=>i!==event.player);
}).length===0;
},
direct:true,
content:function(){
@ -1665,18 +1666,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
expose:0.1
}
},
meiying2:{
trigger:{player:'useCard'},
filter:function(event,player){
return _status.currentPhase==player&&event.targets&&(event.targets.length>1||event.targets[0]!=player);
},
forced:true,
popup:false,
content:function(){
player.addTempSkill('meiying3');
}
},
meiying3:{},
jianwu:{
trigger:{player:'shaBegin'},
forced:true,

View File

@ -1850,6 +1850,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
//裴元绍
dcmoyu:{
audio:2,
init:()=>{
game.addGlobalSkill('dcmoyu_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('dcmoyu'),true)) game.removeGlobalSkill('dcmoyu_ai');
},
enable:'phaseUse',
filter:function(event,player){
return !player.hasSkill('dcmoyu_ban')&&game.hasPlayer(current=>lib.skill.dcmoyu.filterTarget(null,player,current));
@ -1857,7 +1863,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filterTarget:function(card,player,target){
return player!=target&&!player.getStorage('dcmoyu_clear').contains(target)&&target.countGainableCards(player,'hej');
},
global:'dcmoyu_ai',
content:function(){
'step 0'
player.addTempSkill('dcmoyu_clear');
@ -1893,6 +1898,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
intro:{content:'偷马贼被反打了!'},
},
ai:{
trigger:{player:'dieAfter'},
filter:()=>{
return !game.hasPlayer(i=>i.hasSkill('dcmoyu'),true);
},
silent:true,
forceDie:true,
content:()=>{
game.removeGlobalSkill('dcmoyu_ai');
},
ai:{
effect:{
target:function(card,player,target,current){

View File

@ -1678,7 +1678,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2,
zhuSkill:true,
forced:true,
global:'jsrgjiemeng_effect',
init:()=>{
game.addGlobalSkill('jsrgjiemeng_effect');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('jsrgjiemeng'),true)) game.removeGlobalSkill('jsrgjiemeng_effect');
},
subSkill:{
effect:{
mod:{
@ -1688,6 +1693,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return distance-game.countPlayer(current=>current.group=='qun');
},
},
trigger:{player:'dieAfter'},
filter:()=>{
return !game.hasPlayer(i=>i.hasSkill('jsrgjiemeng'),true);
},
silent:true,
forceDie:true,
content:()=>{
game.removeGlobalSkill('jsrgjiemeng_effect');
}
},
},
},

View File

@ -916,30 +916,28 @@ game.import('character',function(lib,game,ui,get,ai,_status){
ai:{
threaten:100,
reverseEquip:true,
ai:{
effect:{
player:(card,player,target)=>{
if(typeof card!=='object') return;
let suit=get.suit(card);
if(!lib.suit.contains(suit)||player.hasCard(function(i){
return get.suit(i,player)==suit;
},'h')) return;
return [1,game.countPlayer(current=>{
return current.countCards('e',card=>{
return get.suit(card,current)==suit;
});
})];
},
target:(card,player,target)=>{
if(card.name==='sha'&&!player.hasSkillTag('directHit_ai',true,{
target:target,
card:card
},true)&&game.hasPlayer(current=>{
return current.hasCard(cardx=>{
return get.subtype(cardx)==='equip3';
},'e');
})) return [0, -0.5];
}
effect:{
player:(card,player,target)=>{
if(typeof card!=='object') return;
let suit=get.suit(card);
if(!lib.suit.contains(suit)||player.hasCard(function(i){
return get.suit(i,player)==suit;
},'h')) return;
return [1,game.countPlayer(current=>{
return current.countCards('e',card=>{
return get.suit(card,current)==suit;
});
})];
},
target:(card,player,target)=>{
if(card.name==='sha'&&!player.hasSkillTag('directHit_ai',true,{
target:target,
card:card
},true)&&game.hasPlayer(current=>{
return current.hasCard(cardx=>{
return get.subtype(cardx)==='equip3';
},'e');
})) return [0, -0.5];
}
}
}
@ -3731,7 +3729,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
yjdumou:{
audio:2,
forced:true,
global:'yjdumou_du',
mod:{
cardname:function(card,player,name){
if(player==_status.currentPhase&&card.name=='du') return 'guohe';
@ -3740,6 +3737,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(card.name=='du') return get.value({name:'guohe'});
},
},
init:()=>{
game.addGlobalSkill('yjdumou_du');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('yjdumou'),true)) game.removeGlobalSkill('yjdumou_du');
},
subSkill:{
du:{
mod:{
@ -3749,6 +3752,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
aiValue:function(player,card,num){
if(get.name(card)=='du'&&card.name!='du') return get.value({name:card.name});
},
},
trigger:{player:'dieAfter'},
filter:()=>{
return !game.hasPlayer(i=>i.hasSkill('yjdumou'),true);
},
silent:true,
forceDie:true,
content:()=>{
game.removeGlobalSkill('yjdumou_du');
}
}
},

View File

@ -4826,12 +4826,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
ai:{
threaten:2,
ai:{
noh:true,
skillTagFilter:function(player,tag){
if(tag=='noh'){
if(player.countCards('h')!=2) return false;
}
noh:true,
skillTagFilter:function(player,tag){
if(tag=='noh'){
if(player.countCards('h')!=2) return false;
}
}
}
@ -5354,15 +5352,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
wansha2:{
mod:{
cardSavable:function(card,player){
if(!_status.currentPhase) return;
if(_status.currentPhase.isIn()&&_status.currentPhase.hasSkill('wansha')&&_status.currentPhase!=player){
if(card.name=='tao'&&!player.isDying()) return false;
if(card.name=='tao'&&_status.currentPhase&&_status.currentPhase.isIn()&&_status.currentPhase.hasSkill('wansha')&&_status.currentPhase!=player){
if(!player.isDying()) return false;
}
},
cardEnabled:function(card,player){
if(!_status.currentPhase) return;
if(_status.currentPhase.isIn()&&_status.currentPhase.hasSkill('wansha')&&_status.currentPhase!=player){
if(card.name=='tao'&&!player.isDying()) return false;
if(card.name=='tao'&&_status.currentPhase&&_status.currentPhase.isIn()&&_status.currentPhase.hasSkill('wansha')&&_status.currentPhase!=player){
if(!player.isDying()) return false;
}
}
}

View File

@ -4967,12 +4967,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
olkangrui:{
audio:2,
init:()=>{
game.addGlobalSkill('olkangrui_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('olkangrui'),true)) game.removeGlobalSkill('olkangrui_ai');
},
trigger:{global:'damageEnd'},
filter:function(event,player){
return event.player==_status.currentPhase&&event.player.getHistory('damage').indexOf(event)==0;
},
direct:true,
global:'olkangrui_ai',
content:function(){
'step 0'
player.chooseControl('cancel2').set('choiceList',[
@ -5058,15 +5063,26 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
},
ai:{
effect:{
target:function(card,player,target){
if(target!=player||!get.tag(card,'damage')) return;
var list=game.filterPlayer(current=>current.hasSkill('olkangrui')&&get.attitude(current,player)>0);
var history=player.getHistory('damage');
if(!list.length||history.length!=0) return;
return [1,2];
}
trigger:{player:'dieAfter'},
filter:()=>{
return !game.hasPlayer(i=>i.hasSkill('olkangrui'),true);
},
silent:true,
forceDie:true,
content:()=>{
game.removeGlobalSkill('olkangrui_ai');
},
ai:{
effect:{
target:function(card,player,target){
if(target!=player||!get.tag(card,'damage')) return;
var list=game.filterPlayer(current=>current.hasSkill('olkangrui')&&get.attitude(current,player)>0);
var history=player.getHistory('damage');
if(!list.length||history.length!=0) return;
return [1,2];
}
}
}
}
}
},

View File

@ -2362,6 +2362,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
//胡班
dcchongyi:{
audio:2,
init:()=>{
game.addGlobalSkill('dcchongyi_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('dcchongyi'),true)) game.removeGlobalSkill('dcchongyi_ai');
},
trigger:{global:'useCard'},
logTarget:'player',
filter:function(event,player){
@ -2387,7 +2393,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
target.addTempSkill('dcchongyi_sha');
},
group:'dcchongyi_end',
global:'dcchongyi_ai',
subSkill:{
ai:{
mod:{
@ -2403,6 +2408,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
})) return num+10;
},
},
trigger:{player:'dieAfter'},
filter:()=>{
return !game.hasPlayer(i=>i.hasSkill('dcchongyi'),true);
},
silent:true,
forceDie:true,
content:()=>{
game.removeGlobalSkill('dcchongyi_ai');
}
},
end:{
audio:'dcchongyi',

View File

@ -8662,10 +8662,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){
trigger.player.addMark('twlvren',1);
},
effect:{
player:function(card,player,target){
if(target.hasMark('twlvren')) return 0.33;
},
ai:{
effect:{
player:function(card,player,target){
if(target.hasMark('twlvren')) return 0.33;
}
}
},
marktext:'刃',
intro:{name2:'刃',content:'mark'},

View File

@ -4479,6 +4479,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
//谢灵毓
dcyuandi:{
audio:2,
init:()=>{
game.addGlobalSkill('dcyuandi_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('dcyuandi'),true)) game.removeGlobalSkill('dcyuandi_ai');
},
trigger:{global:'useCard'},
filter:function(event,player){
var evt=event.getParent('phaseUse');
@ -4489,7 +4495,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}).indexOf(event)==0;
},
direct:true,
global:'dcyuandi_ai',
content:function(){
'step 0'
var target=trigger.player;
@ -4533,6 +4538,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return num/3;
},
},
trigger:{player:'dieAfter'},
filter:()=>{
return !game.hasPlayer(i=>i.hasSkill('dcyuandi'),true);
},
silent:true,
forceDie:true,
content:()=>{
game.removeGlobalSkill('dcyuandi_ai');
}
},
}
},

View File

@ -881,6 +881,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
xinfu_guanwei:{
audio:2,
usable:1,
init:()=>{
game.addGlobalSkill('xinfu_guanwei_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('xinfu_guanwei'),true)) game.removeGlobalSkill('xinfu_guanwei_ai');
},
trigger:{
global:"phaseUseEnd",
},
@ -898,7 +904,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return num>1;
},
direct:true,
global:'xinfu_guanwei_ai',
content:function (){
'step 0'
var target=trigger.player;
@ -925,6 +930,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
subSkill:{
ai:{
trigger:{player:'dieAfter'},
filter:()=>{
return !game.hasPlayer(i=>i.hasSkill('xinfu_guanwei'),true);
},
silent:true,
forceDie:true,
content:()=>{
game.removeGlobalSkill('xinfu_guanwei_ai');
},
ai:{
effect:{
player_use:function(card,player,target){

View File

@ -2401,6 +2401,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
},
ciwei:{
init:()=>{
game.addGlobalSkill('ciwei_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('ciwei'),true)) game.removeGlobalSkill('ciwei_ai');
},
trigger:{global:'useCard'},
direct:true,
preHidden:true,
@ -2426,8 +2432,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger.targets.length=0;
trigger.all_excluded=true;
}
},
global:'ciwei_ai',
}
},
ciwei_ai:{
mod:{
@ -2448,6 +2453,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return num;
},
},
trigger:{player:'dieAfter'},
filter:()=>{
return !game.hasPlayer(i=>i.hasSkill('ciwei'),true);
},
silent:true,
forceDie:true,
content:()=>{
game.removeGlobalSkill('ciwei_ai');
}
},
caiyuan:{
trigger:{player:'phaseEnd'},