及时移除部分失效的全局ai以提高游戏流畅度

This commit is contained in:
157 2023-12-28 11:19:56 +08:00
parent a8d60ed38f
commit 67d3559612
10 changed files with 130 additions and 31 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

@ -3729,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';
@ -3738,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:{
@ -3747,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

@ -5352,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

@ -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

@ -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'},