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:{ mod:{
globalFrom:function(from,to,num){ globalFrom:function(from,to,num){
return num-game.countPlayer(function(current){ 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:{ nslongyue:{
init:()=>{
game.addGlobalSkill('nslongyue_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('nslongyue'),true)) game.removeGlobalSkill('nslongyue_ai');
},
trigger:{global:'useCard'}, trigger:{global:'useCard'},
filter:function(event,player){ filter:function(event,player){
return get.type(event.card,'trick')=='trick'&&event.player.getHistory('useCard').indexOf(event)==0; 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:{ ai:{
expose:0.2, expose:0.2,
}, }
global:'nslongyue_ai',
}, },
nslongyue_ai:{ nslongyue_ai:{
mod:{ mod:{
@ -11940,6 +11945,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
})) return num+6; })) 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:{ nszhenyin:{
trigger:{global:'judge'}, trigger:{global:'judge'},

View File

@ -1638,11 +1638,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
}, },
meiying:{ meiying:{
global:'meiying2',
globalSilent:true, globalSilent:true,
trigger:{global:'phaseEnd'}, trigger:{global:'phaseEnd'},
filter:function(event,player){ 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, direct:true,
content:function(){ content:function(){
@ -1665,18 +1666,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
expose:0.1 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:{ jianwu:{
trigger:{player:'shaBegin'}, trigger:{player:'shaBegin'},
forced:true, forced:true,

View File

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

View File

@ -1678,7 +1678,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2, audio:2,
zhuSkill:true, zhuSkill:true,
forced: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:{ subSkill:{
effect:{ effect:{
mod:{ mod:{
@ -1688,6 +1693,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return distance-game.countPlayer(current=>current.group=='qun'); 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:{ ai:{
threaten:100, threaten:100,
reverseEquip:true, reverseEquip:true,
ai:{ effect:{
effect:{ player:(card,player,target)=>{
player:(card,player,target)=>{ if(typeof card!=='object') return;
if(typeof card!=='object') return; let suit=get.suit(card);
let suit=get.suit(card); if(!lib.suit.contains(suit)||player.hasCard(function(i){
if(!lib.suit.contains(suit)||player.hasCard(function(i){ return get.suit(i,player)==suit;
return get.suit(i,player)==suit; },'h')) return;
},'h')) return; return [1,game.countPlayer(current=>{
return [1,game.countPlayer(current=>{ return current.countCards('e',card=>{
return current.countCards('e',card=>{ return get.suit(card,current)==suit;
return get.suit(card,current)==suit; });
}); })];
})]; },
}, target:(card,player,target)=>{
target:(card,player,target)=>{ if(card.name==='sha'&&!player.hasSkillTag('directHit_ai',true,{
if(card.name==='sha'&&!player.hasSkillTag('directHit_ai',true,{ target:target,
target:target, card:card
card:card },true)&&game.hasPlayer(current=>{
},true)&&game.hasPlayer(current=>{ return current.hasCard(cardx=>{
return current.hasCard(cardx=>{ return get.subtype(cardx)==='equip3';
return get.subtype(cardx)==='equip3'; },'e');
},'e'); })) return [0, -0.5];
})) return [0, -0.5];
}
} }
} }
} }
@ -3731,7 +3729,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
yjdumou:{ yjdumou:{
audio:2, audio:2,
forced:true, forced:true,
global:'yjdumou_du',
mod:{ mod:{
cardname:function(card,player,name){ cardname:function(card,player,name){
if(player==_status.currentPhase&&card.name=='du') return 'guohe'; 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'}); 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:{ subSkill:{
du:{ du:{
mod:{ mod:{
@ -3749,6 +3752,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
aiValue:function(player,card,num){ aiValue:function(player,card,num){
if(get.name(card)=='du'&&card.name!='du') return get.value({name:card.name}); 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:{ ai:{
threaten:2, threaten:2,
ai:{ noh:true,
noh:true, skillTagFilter:function(player,tag){
skillTagFilter:function(player,tag){ if(tag=='noh'){
if(tag=='noh'){ if(player.countCards('h')!=2) return false;
if(player.countCards('h')!=2) return false;
}
} }
} }
} }
@ -5354,15 +5352,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
wansha2:{ wansha2:{
mod:{ mod:{
cardSavable:function(card,player){ cardSavable:function(card,player){
if(!_status.currentPhase) return; if(card.name=='tao'&&_status.currentPhase&&_status.currentPhase.isIn()&&_status.currentPhase.hasSkill('wansha')&&_status.currentPhase!=player){
if(_status.currentPhase.isIn()&&_status.currentPhase.hasSkill('wansha')&&_status.currentPhase!=player){ if(!player.isDying()) return false;
if(card.name=='tao'&&!player.isDying()) return false;
} }
}, },
cardEnabled:function(card,player){ cardEnabled:function(card,player){
if(!_status.currentPhase) return; if(card.name=='tao'&&_status.currentPhase&&_status.currentPhase.isIn()&&_status.currentPhase.hasSkill('wansha')&&_status.currentPhase!=player){
if(_status.currentPhase.isIn()&&_status.currentPhase.hasSkill('wansha')&&_status.currentPhase!=player){ if(!player.isDying()) return false;
if(card.name=='tao'&&!player.isDying()) return false;
} }
} }
} }

View File

@ -4967,12 +4967,17 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
olkangrui:{ olkangrui:{
audio:2, audio:2,
init:()=>{
game.addGlobalSkill('olkangrui_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('olkangrui'),true)) game.removeGlobalSkill('olkangrui_ai');
},
trigger:{global:'damageEnd'}, trigger:{global:'damageEnd'},
filter:function(event,player){ filter:function(event,player){
return event.player==_status.currentPhase&&event.player.getHistory('damage').indexOf(event)==0; return event.player==_status.currentPhase&&event.player.getHistory('damage').indexOf(event)==0;
}, },
direct:true, direct:true,
global:'olkangrui_ai',
content:function(){ content:function(){
'step 0' 'step 0'
player.chooseControl('cancel2').set('choiceList',[ player.chooseControl('cancel2').set('choiceList',[
@ -5058,15 +5063,26 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
}, },
ai:{ ai:{
effect:{ trigger:{player:'dieAfter'},
target:function(card,player,target){ filter:()=>{
if(target!=player||!get.tag(card,'damage')) return; return !game.hasPlayer(i=>i.hasSkill('olkangrui'),true);
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];
}
}, },
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:{ dcchongyi:{
audio:2, audio:2,
init:()=>{
game.addGlobalSkill('dcchongyi_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('dcchongyi'),true)) game.removeGlobalSkill('dcchongyi_ai');
},
trigger:{global:'useCard'}, trigger:{global:'useCard'},
logTarget:'player', logTarget:'player',
filter:function(event,player){ filter:function(event,player){
@ -2387,7 +2393,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
target.addTempSkill('dcchongyi_sha'); target.addTempSkill('dcchongyi_sha');
}, },
group:'dcchongyi_end', group:'dcchongyi_end',
global:'dcchongyi_ai',
subSkill:{ subSkill:{
ai:{ ai:{
mod:{ mod:{
@ -2403,6 +2408,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
})) return num+10; })) 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:{ end:{
audio:'dcchongyi', audio:'dcchongyi',

View File

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

View File

@ -4479,6 +4479,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
//谢灵毓 //谢灵毓
dcyuandi:{ dcyuandi:{
audio:2, audio:2,
init:()=>{
game.addGlobalSkill('dcyuandi_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('dcyuandi'),true)) game.removeGlobalSkill('dcyuandi_ai');
},
trigger:{global:'useCard'}, trigger:{global:'useCard'},
filter:function(event,player){ filter:function(event,player){
var evt=event.getParent('phaseUse'); var evt=event.getParent('phaseUse');
@ -4489,7 +4495,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}).indexOf(event)==0; }).indexOf(event)==0;
}, },
direct:true, direct:true,
global:'dcyuandi_ai',
content:function(){ content:function(){
'step 0' 'step 0'
var target=trigger.player; var target=trigger.player;
@ -4533,6 +4538,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return num/3; 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:{ xinfu_guanwei:{
audio:2, audio:2,
usable:1, usable:1,
init:()=>{
game.addGlobalSkill('xinfu_guanwei_ai');
},
onremove:()=>{
if(!game.hasPlayer(i=>i.hasSkill('xinfu_guanwei'),true)) game.removeGlobalSkill('xinfu_guanwei_ai');
},
trigger:{ trigger:{
global:"phaseUseEnd", global:"phaseUseEnd",
}, },
@ -898,7 +904,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return num>1; return num>1;
}, },
direct:true, direct:true,
global:'xinfu_guanwei_ai',
content:function (){ content:function (){
'step 0' 'step 0'
var target=trigger.player; var target=trigger.player;
@ -925,6 +930,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
subSkill:{ subSkill:{
ai:{ 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:{ ai:{
effect:{ effect:{
player_use:function(card,player,target){ player_use:function(card,player,target){

View File

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