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