yigui_gzwuxie写法优化

This commit is contained in:
mengxinzxz 2024-02-17 13:46:17 +08:00
parent a897045a8e
commit 6c29435e2d
1 changed files with 40 additions and 36 deletions

View File

@ -7661,7 +7661,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
}, },
check:function(button){ check:function(button){
return 1/(1+game.countPlayer(function(current){ return 1/(1+game.countPlayer(function(current){
return current.identity==button.link; return current.identity==lib.character[button.link][1];
})); }));
}, },
backup:function(links,player){ backup:function(links,player){
@ -7692,57 +7692,62 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
}, },
ai:{ ai:{
respondShan:true, respondShan:true,
skillTagFilter:function(player){ skillTagFilter:function(player,tag,arg){
if(arg=='respond'||!lib.inpile.includes('shan')) return false;
var storage=player.storage.yigui; var storage=player.storage.yigui;
if(!storage||!storage.character.length||storage.used.includes('shan')||!lib.inpile.includes('shan')) return false; if(!storage||!storage.character.length||storage.used.includes('shan')) return false;
}, },
order:0.1, order:0.1,
result:{player:1}, result:{player:1},
}, },
}, },
yigui_gzwuxie:{ yigui_gzwuxie:{
hiddenCard:function(player,name){ hiddenWuxie(player,info){
var storage=player.storage.yigui; if(!lib.inpile.includes('wuxie')) return false;
if(name!='wuxie'||!storage||!storage.character.length||storage.used.includes(name)||!lib.inpile.includes(name)) return false; const storage=player.storage.yigui;
return true; if(!storage||!storage.character||!storage.character.length||(storage.used&&storage.used.includes('wuxie'))) return false;
}, if(_status.connectMode) return true;
enable:'chooseToUse', const target=info.target;
filter:function(event,player){ if(!target) return false;
if(event.type!='wuxie'||!event.filterCard({name:'wuxie'},player,event)||!lib.inpile.includes('wuxie')) return false; const identity=target.identity;
var storage=player.storage.yigui,target=event.getParent(2).player;
if(!storage||!target||!storage.character.length||storage.used.includes('wuxie')) return false;
var identity=target.identity;
return ['unknown','ye'].includes(identity)||storage.character.some(function(i){ return ['unknown','ye'].includes(identity)||storage.character.some(function(i){
if(lib.character[i][1]=='ye') return true; if(lib.character[i][1]=='ye') return true;
var double=get.is.double(i,true); const double=get.is.double(i,true);
var groups=(double?double:[lib.character[i][1]]); return (double?double:[lib.character[i][1]]).includes(identity);
return groups.includes(identity); });
},
enable:'chooseToUse',
filter(event,player){
if(event.type!='wuxie'||!lib.inpile.includes('wuxie')) return false;
const storage=player.storage.yigui;
if(!storage||!storage.character||!storage.character.length||(storage.used&&storage.used.includes('wuxie'))) return false;
const info=event.info_map,target=info.target,identity=target.identity;
return ['unknown','ye'].includes(identity)||storage.character.some(function(i){
if(lib.character[i][1]=='ye') return true;
const double=get.is.double(i,true);
return (double?double:[lib.character[i][1]]).includes(identity);
}); });
}, },
chooseButton:{ chooseButton:{
dialog:function(event,player){ dialog(event,player){
var dialog=ui.create.dialog('役鬼','hidden'); let dialog=ui.create.dialog('役鬼','hidden');
dialog.add([player.storage.yigui.character,'character']); dialog.add([player.storage.yigui.character,'character']);
return dialog; return dialog;
}, },
filter:function(button,player){ filter(button,player){
var evt=_status.event.getParent('chooseToUse'); const evt=get.event().getParent('chooseToUse');
var target=evt.getParent(2).player,identity=target.identity; const info=evt.info_map,target=info.target,identity=target.identity;
if(['unknown','ye'].includes(identity)) return true; if(['unknown','ye'].includes(identity)) return true;
if(lib.character[button.link][1]=='ye') return true; if(lib.character[button.link][1]=='ye') return true;
var double=get.is.double(button.link,true); const double=get.is.double(button.link,true);
var groups=(double?double:[lib.character[button.link][1]]); return (double?double:[lib.character[button.link][1]]).includes(identity);
return groups.includes(identity);
}, },
check:function(button){ check(button){
return 1/(1+game.countPlayer(function(current){ return 1+Math.random();
return current.identity==button.link;
}));
}, },
backup:function(links,player){ backup(links,player){
var character=links[0]; return {
var next={ character:links[0],
character:character,
filterCard:()=>false, filterCard:()=>false,
selectCard:-1, selectCard:-1,
complexCard:true, complexCard:true,
@ -7750,9 +7755,9 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
popname:true, popname:true,
audio:'yigui', audio:'yigui',
viewAs:{name:'wuxie',isCard:true}, viewAs:{name:'wuxie',isCard:true},
onuse:function(result,player){ onuse(result,player){
player.logSkill('yigui'); player.logSkill('yigui');
var character=lib.skill.yigui_gzwuxie_backup.character; const character=lib.skill.yigui_gzwuxie_backup.character;
player.flashAvatar('yigui',character); player.flashAvatar('yigui',character);
player.storage.yigui.character.remove(character); player.storage.yigui.character.remove(character);
_status.characterlist.add(character); _status.characterlist.add(character);
@ -7762,7 +7767,6 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
player.storage.yigui.used.add(result.card.name); player.storage.yigui.used.add(result.card.name);
}, },
}; };
return next;
}, },
}, },
ai:{ ai:{