简化结党冲突人士写法,减少map定义次数

This commit is contained in:
mengxinzxz 2023-11-14 18:25:35 +08:00
parent ca20d31c81
commit b2f7613de6
1 changed files with 6 additions and 8 deletions

View File

@ -1607,18 +1607,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var others=list.randomGets(4); var others=list.randomGets(4);
if(others.length==1) event._result={bool:true,links:others}; if(others.length==1) event._result={bool:true,links:others};
else{ else{
var conflictList,map={ var map={
'scs_bilan':'scs_hankui', 'scs_bilan':'scs_hankui',
'scs_hankui':'scs_bilan', 'scs_hankui':'scs_bilan',
'scs_duangui':'scs_guosheng', 'scs_duangui':'scs_guosheng',
'scs_guosheng':'scs_duangui', 'scs_guosheng':'scs_duangui',
},list=others.slice(); },map2=lib.skill.mbdanggu.conflictMap(player);
if(map[first]&&others.some(changshi=>map[first]==changshi)) conflictList=[others.find(changshi=>map[first]==changshi)]; var conflictList=others.filter(changshi=>{
else conflictList=others.filter(changshi=>{ if(map[first]&&others.some(changshi2=>map[first]==changshi2)) return map[first]==changshi;
var map=lib.skill.mbdanggu.conflictMap(player); else return map2[first].includes(changshi);
var names=map[first]; }),list=others.slice();
return names.contains(changshi);
});
if(conflictList.length){ if(conflictList.length){
var conflict=conflictList.randomGet(); var conflict=conflictList.randomGet();
list.remove(conflict); list.remove(conflict);