修复许劭【评鉴】检索武将牌范围仅限于剩余武将牌堆以及不能检测viewAs类技能的bug

This commit is contained in:
mengxinzxz 2023-07-31 16:01:47 +08:00 committed by GitHub
parent 3dd3e9f131
commit 6fa835056b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 165 additions and 147 deletions

View File

@ -3816,7 +3816,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
event.finish(); event.finish();
'step 6' 'step 6'
player.chooseTarget('令一名其他角色弃置一张点数为6的牌否则交给你一张牌',true,function(card,player,current){ if(!game.hasPlayer(current=>current!=player)) event.finish();
else player.chooseTarget('令一名其他角色弃置一张点数为6的牌否则交给你一张牌',true,function(card,player,current){
return current!=player&&current.countCards('he')>0; return current!=player&&current.countCards('he')>0;
}).set('ai',function(target){ }).set('ai',function(target){
var player=_status.event.player,att=get.attitude(player,target); var player=_status.event.player,att=get.attitude(player,target);
@ -4504,7 +4505,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{player:'phaseBegin'}, trigger:{player:'phaseBegin'},
direct:true, direct:true,
filter:function(event,player){ filter:function(event,player){
return player.phaseNumber==1&&!player.storage.jielie; return player.phaseNumber==1&&!player.storage.jielie&&game.hasPlayer(current=>current!=player);
}, },
content:function(){ content:function(){
'step 0' 'step 0'
@ -7916,199 +7917,216 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
}, },
pingjian:{ pingjian:{
audio:2,
trigger:{
player:['damageEnd','phaseJieshuBegin'],
},
initList:function(){ initList:function(){
var list=[]; var list=[];
if(_status.connectMode) var list=get.charactersOL(); if(_status.connectMode) list=get.charactersOL();
else{ else{
var list=[]; var list=[];
for(var i in lib.character){ for(var i in lib.character){
if(lib.filter.characterDisabled2(i)||lib.filter.characterDisabled(i)) continue; if(!lib.filter.characterDisabled2(i)&&!lib.filter.characterDisabled(i)) list.push(i);
list.push(i);
} }
} }
game.countPlayer2(function(current){ game.countPlayer2(function(current){
list.remove(current.name); list.remove(current.name);
list.remove(current.name1); list.remove(current.name1);
list.remove(current.name2); list.remove(current.name2);
if(current.storage.rehuashen&&current.storage.rehuashen.character) list.removeArray(current.storage.rehuashen.character)
}); });
_status.characterlist=list; _status.characterlist=list;
}, },
init:function(player){
player.addSkill('pingjian_check');
if(!player.storage.pingjian_check) player.storage.pingjian_check={};
},
onremove:function(player){
player.removeSkill('pingjian_check');
},
audio:2,
trigger:{player:['damageEnd','phaseJieshuBegin']},
frequent:true, frequent:true,
content:function(){ content:function(){
'step 0' 'step 0'
if(!player.storage.pingjian) player.storage.pingjian=[]; if(!_status.characterlist){
event._result={bool:true}; lib.skill.pingjian.initList();
'step 1' }
if(result.bool){ var allList=_status.characterlist.slice(0);
if(!_status.characterlist){ game.countPlayer(function(current){
lib.skill.pingjian.initList(); allList.add(current.name);
} allList.add(current.name1);
var list=[]; allList.add(current.name2);
var skills=[]; });
var map=[]; var list=[];
_status.characterlist.randomSort(); var skills=[];
var name2=event.triggername; var map=[];
for(var i=0;i<_status.characterlist.length;i++){ allList.randomSort();
var name=_status.characterlist[i]; var name2=event.triggername;
if(name.indexOf('zuoci')!=-1||name.indexOf('xushao')!=-1) continue; for(var i=0;i<allList.length;i++){
var skills2=lib.character[name][3]; var name=allList[i];
for(var j=0;j<skills2.length;j++){ if(name.indexOf('zuoci')!=-1||name.indexOf('xushao')!=-1) continue;
if(player.storage.pingjian.contains(skills2[j])) continue; var skills2=lib.character[name][3];
if(skills.contains(skills2[j])){ for(var j=0;j<skills2.length;j++){
if(player.getStorage('pingjian').contains(skills2[j])) continue;
if(skills.contains(skills2[j])){
list.add(name);
if(!map[name]) map[name]=[];
map[name].push(skills2[j]);
skills.add(skills2[j]);
continue;
}
var list2=[skills2[j]];
game.expandSkills(list2);
for(var k=0;k<list2.length;k++){
var info=lib.skill[list2[k]];
if(!info||!info.trigger||!info.trigger.player||info.silent||info.limited||info.juexingji||info.zhuanhuanji||info.hiddenSkill||info.dutySkill) continue;
if(info.trigger.player==name2||Array.isArray(info.trigger.player)&&info.trigger.player.contains(name2)){
if(info.ai&&(info.ai.combo||info.ai.notemp||info.ai.neg)) continue;
if(info.init) info.init(player,list2[k]);
if(info.filter){
try{
var bool=info.filter(trigger,player,name2);
if(!bool) continue;
}
catch(e){
continue;
}
}
list.add(name); list.add(name);
if(!map[name]) map[name]=[]; if(!map[name]) map[name]=[];
map[name].push(skills2[j]); map[name].push(skills2[j]);
skills.add(skills2[j]); skills.add(skills2[j]);
continue; break;
}
var list2=[skills2[j]];
game.expandSkills(list2);
for(var k=0;k<list2.length;k++){
var info=lib.skill[list2[k]];
if(!info||!info.trigger||!info.trigger.player||info.silent||info.limited||info.juexingji||info.zhuanhuanji||info.hiddenSkill||info.dutySkill) continue;
if(info.trigger.player==name2||Array.isArray(info.trigger.player)&&info.trigger.player.contains(name2)){
if(info.init||info.ai&&(info.ai.combo||info.ai.notemp||info.ai.neg)) continue;
if(info.filter){
try{
var bool=info.filter(trigger,player,name2);
if(!bool) continue;
}
catch(e){
continue;
}
}
list.add(name);
if(!map[name]) map[name]=[];
map[name].push(skills2[j]);
skills.add(skills2[j]);
break;
}
} }
} }
if(list.length>2) break;
}
if(!skills.length){
//player.draw();
event.finish();
}
else{
//skills.unshift('摸一张牌');
player.chooseControl(skills).set('dialog',['请选择要发动的技能',[list,'character']]).set('ai',function(){return 0});
} }
if(list.length>2) break;
} }
if(skills.length) player.chooseControl(skills).set('dialog',['评鉴:请选择尝试发动的技能',[list,'character']]);
else event.finish(); else event.finish();
'step 2' 'step 1'
if(result.control=='摸一张牌'){ player.markAuto('pingjian',[result.control]);
player.draw(); player.addTempSkill(result.control);
return; player.storage.pingjian_check[result.control]=(trigger.name=='damage'?trigger:'phaseJieshu');
if(trigger.name=='damage'){
var info=lib.translate[result.control+'_info'];
if(info&&info.indexOf('1点伤害')+info.indexOf('一点伤害')!=-2) trigger.num=1;//暂时想到的让多点伤害只执行一次的拙见
} }
player.storage.pingjian.add(result.control);
player.addTempSkill(result.control,event.triggername=='damageEnd'?'damageAfter':'phaseJieshu');
}, },
group:'pingjian_use', group:'pingjian_use',
phaseUse_special:['xinfu_lingren'], phaseUse_special:[],
ai:{threaten:5},
}, },
pingjian_use:{ pingjian_use:{
audio:'pingjian', audio:'pingjian',
enable:'phaseUse', enable:'phaseUse',
usable:1, usable:1,
position:'he', prompt:()=>lib.translate.pingjian_info,
content:function(){ content:function(){
'step 0' 'step 0'
if(!player.storage.pingjian) player.storage.pingjian=[]; var list=[];
event._result={bool:true}; var skills=[];
'step 1' var map=[];
if(result.bool){ if(!_status.characterlist){
var list=[]; lib.skill.pingjian.initList();
var skills=[]; }
var map=[]; var allList=_status.characterlist.slice(0);
if(!_status.characterlist){ game.countPlayer(function(current){
lib.skill.pingjian.initList(); allList.add(current.name);
} allList.add(current.name1);
_status.characterlist.randomSort(); allList.add(current.name2);
for(var i=0;i<_status.characterlist.length;i++){ });
var name=_status.characterlist[i]; allList.randomSort();
if(name.indexOf('zuoci')!=-1||name.indexOf('xushao')!=-1) continue; for(var i=0;i<allList.length;i++){
var skills2=lib.character[name][3]; var name=allList[i];
for(var j=0;j<skills2.length;j++){ if(name.indexOf('zuoci')!=-1||name.indexOf('xushao')!=-1) continue;
if(player.storage.pingjian.contains(skills2[j])) continue; var skills2=lib.character[name][3];
if(skills.contains(skills2[j])||lib.skill.pingjian.phaseUse_special.contains(skills2[j])){ for(var j=0;j<skills2.length;j++){
if(player.getStorage('pingjian').contains(skills2[j])) continue;
var info=lib.translate[skills2[j]+'_info'];
if(skills.contains(skills2[j])||(info&&info.indexOf('当你于出牌阶段')!=-1)){
list.add(name);
if(!map[name]) map[name]=[];
map[name].push(skills2[j]);
skills.add(skills2[j]);
continue;
}
var list2=[skills2[j]];
game.expandSkills(list2);
for(var k=0;k<list2.length;k++){
var info=lib.skill[list2[k]];
if(!info||!info.enable||info.charlotte||info.limited||info.juexingji||info.zhuanhuanji||info.hiddenSkill||info.dutySkill) continue;
if((info.enable=='phaseUse'||(Array.isArray(info.enable)&&info.enable.contains('phaseUse')))||(info.enable=='chooseToUse'||(Array.isArray(info.enable)&&info.enable.contains('chooseToUse')))){
if(info.ai&&(info.ai.combo||info.ai.notemp||info.ai.neg)) continue;
var evt=event.getParent(2);
if(info.init) info.init(player,list2[k]);
if(info.onChooseToUse) info.onChooseToUse(evt);
if(info.filter){
try{
var bool=info.filter(evt,player);
if(!bool) continue;
}
catch(e){
continue;
}
}
if(info.viewAs&&typeof info.viewAs!='function'){
if(evt.filterCard&&!evt.filterCard(info.viewAs,player,evt)) continue;
if(info.viewAsFilter&&info.viewAsFilter(player)==false) continue;
}
list.add(name); list.add(name);
if(!map[name]) map[name]=[]; if(!map[name]) map[name]=[];
map[name].push(skills2[j]); map[name].push(skills2[j]);
skills.add(skills2[j]); skills.add(skills2[j]);
continue; break;
}
var list2=[skills2[j]];
game.expandSkills(list2);
for(var k=0;k<list2.length;k++){
var info=lib.skill[list2[k]];
if(!info||!info.enable||info.viewAs||info.limited||info.juexingji||info.zhuanhuanji||info.hiddenSkill||info.dutySkill) continue;
if(info.enable=='phaseUse'||Array.isArray(info.enable)&&info.enable.contains('phaseUse')){
if(info.init||info.onChooseToUse||info.ai&&(info.ai.combo||info.ai.notemp||info.ai.neg)) continue;
if(info.filter){
try{
var bool=info.filter(event.getParent(2),player);
if(!bool) continue;
}
catch(e){
continue;
}
}
list.add(name);
if(!map[name]) map[name]=[];
map[name].push(skills2[j]);
skills.add(skills2[j]);
break;
}
} }
} }
if(list.length>2) break;
}
if(!skills.length){
//player.draw();
event.finish();
}
else{
//skills.unshift('摸一张牌');
player.chooseControl(skills).set('dialog',['请选择要发动的技能',[list,'character']]).set('ai',function(){return 0});
} }
if(list.length>2) break;
} }
if(skills.length) player.chooseControl(skills).set('dialog',['评鉴:请选择尝试发动的技能',[list,'character']]);
else event.finish(); else event.finish();
'step 2' 'step 1'
if(result.control=='摸一张牌'){ player.markAuto('pingjian',[result.control]);
player.draw(); player.addTempSkill(result.control);
return; player.storage.pingjian_check[result.control]='phaseUse';
}
player.storage.pingjian.add(result.control);
player.addTempSkill(result.control,'phaseUseEnd');
player.addTempSkill('pingjian_temp','phaseUseEnd');
player.storage.pingjian_temp=result.control;
//event.getParent(2).goto(0);
}, },
ai:{order:10,result:{player:1}}, ai:{order:12,result:{player:1}},
}, },
pingjian_temp:{ pingjian_check:{
onremove:true, charlotte:true,
trigger:{player:['useSkillBegin','useCard1']}, trigger:{player:['useSkill','logSkillBegin']},
silent:true,
firstDo:true,
filter:function(event,player){ filter:function(event,player){
var info=lib.skill[event.skill]; if(get.info(event.skill).charlotte) return false;
if(!info) return false; var skill=event.sourceSkill||event.skill;
if(event.skill==player.storage.pingjian_temp) return true; return player.storage.pingjian_check[skill];
if(info.sourceSkill==player.storage.pingjian_temp||info.group==player.storage.pingjian_temp) return true;
if(Array.isArray(info.group)&&info.group.contains(player.storage.pingjian_temp)) return true;
return false;
}, },
direct:true,
firstDo:true,
priority:Infinity,
content:function(){ content:function(){
player.removeSkill(player.storage.pingjian_temp); var skill=trigger.sourceSkill||trigger.skill;
player.removeSkill('pingjian_temp'); player.removeSkill(skill);
delete player.storage.pingjian_check[skill];
},
group:'pingjian_check2',
},
pingjian_check2:{
charlotte:true,
trigger:{player:['phaseUseEnd','damageEnd','phaseJieshuBegin']},
filter:function(event,player){
return Object.keys(player.storage.pingjian_check).find(function(skill){
if(event.name!='damage') return player.storage.pingjian_check[skill]==event.name;
return player.storage.pingjian_check[skill]==event;
});
},
direct:true,
lastDo:true,
priority:-Infinity,
content:function(){
var skills=Object.keys(player.storage.pingjian_check).filter(function(skill){
if(trigger.name!='damage') return player.storage.pingjian_check[skill]==trigger.name;
return player.storage.pingjian_check[skill]==trigger;
});
player.removeSkill(skills);
for(var skill of skills) delete player.storage.pingjian_check[skill];
}, },
}, },
//上兵伐谋 //上兵伐谋
@ -9648,7 +9666,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
forced:true, forced:true,
filter:function(event){ filter:function(event){
return game.players.length>1&&(event.name!='phase'||game.phaseNumber==0); return game.hasPlayer(current=>current!=player)&&(event.name!='phase'||game.phaseNumber==0);
}, },
content:function(){ content:function(){
'step 0' 'step 0'
@ -10121,8 +10139,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
xugong:"许贡", xugong:"许贡",
zhangchangpu:"张昌蒲", zhangchangpu:"张昌蒲",
pingjian:'评荐', pingjian:'评荐',
pingjian_info:'结束阶段开始时/当你受到伤害后/出牌阶段限一次,你可以令系统随机从剩余武将牌堆中检索出三张拥有发动时机为结束阶段开始时/当你受到伤害后/出牌阶段的技能的武将牌。然后你可以选择尝试发动其中一个技能。每个技能每局只能选择一次。',
pingjian_use:'评荐', pingjian_use:'评荐',
pingjian_info:'结束阶段开始时/当你受到伤害后/出牌阶段限一次,你可以令系统随机检索出三张拥有发动时机为结束阶段开始时/当你受到伤害后/出牌阶段的技能的武将牌。然后你可以选择尝试发动其中一个技能。每个技能每局游戏只能选择一次。',
songshu:'颂蜀', songshu:'颂蜀',
songshu_info:'出牌阶段,你可以和其他角色拼点。若你没赢,你与其各摸两张牌,且你本阶段内不能再发动〖颂蜀〗。', songshu_info:'出牌阶段,你可以和其他角色拼点。若你没赢,你与其各摸两张牌,且你本阶段内不能再发动〖颂蜀〗。',