修复场上只有一名角色时,要求选择其他角色的一些技能

This commit is contained in:
copcap 2023-07-30 16:53:20 +08:00
parent 06e049a727
commit 8e108696f9
No known key found for this signature in database
GPG Key ID: 9AE7B8AF097EC926
12 changed files with 52 additions and 27 deletions

View File

@ -1195,6 +1195,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
forced:true,
filter:function(event,player){
if(!game.hasPlayer(current=>current!=player)) return false;
var card=event.card,type=get.type2(card);
for(var i=player.actionHistory.length-1; i>=0; i--){
var history=player.actionHistory[i].useCard;
@ -1629,7 +1630,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(cards.length) player.discard(cards);
}
'step 1'
if(!player.isIn()) event.finish();
if(!player.isIn()||!game.hasPlayer(current=>current!=player)) event.finish();
else player.chooseTarget('烈誓:令一名其他角色选择另一项',lib.filter.notMe,true).set('ai',target=>{
var player=_status.event.player,chosen=_status.event.getParent().choice,att=get.attitude(player,target);
if(chosen=='damage'){

View File

@ -8817,7 +8817,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return result.bool;
};
'step 1'
if(result.bool){
if(result.bool&&game.hasPlayer(current=>current!=player)){
player.chooseTarget(lib.filter.notMe,true,'选择一名其他角色对其造成1点雷属性伤害').set('ai',function(target){
var player=_status.event.player;
return get.damageEffect(target,player,player,'thunder');
@ -12731,6 +12731,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
popup:false,
charlotte:true,
filter:function(event,player){
if(!game.hasPlayer(current=>current!=player)) return false;
return event.skill=='junktaoluan_backup'||event.skill=='junktaoluan5'||event.skill=='junktaoluan4';
},
content:function(){

View File

@ -1764,6 +1764,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
get.translation(mark)+'】</div><div>'+lib.translate[mark+'_info']+'</div></div>'])
}
var target=game.filterPlayer(i=>i!=player)[0];
if(!game.hasPlayer(current=>current!=player)) target=player;
event.target=target;
player.chooseButton(['引路:令'+get.translation(target)+'获得2枚〖引路〗标记',[list,'textbutton']]).set('ai',button=>{
var mark=button.link;
@ -3214,7 +3215,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
onremove:['dcsilve','dcsilve_self'],
filter:function(event,player){
return (event.name!='phase'||game.phaseNumber==0);
return game.hasPlayer(current=>current!=player)&&(event.name!='phase'||game.phaseNumber==0);
},
content:function(){
'step 0'
@ -4113,6 +4114,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2,
enable:'phaseUse',
usable:2,
filter:function(event,player){
return game.hasPlayer(current=>current!=player);
},
chooseButton:{
dialog:function(event,player){
var dialog=ui.create.dialog('劝谏:令一名其他角色…','hidden');
@ -6487,7 +6491,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 0'
player.draw();
'step 1'
if(player.countCards('h')>0){
if(player.countCards('h')>0&&game.hasPlayer(current=>current!=player)){
var suits=lib.suit.slice(0),cards=player.getExpansions('yuanyu');
for(var i of cards) suits.remove(get.suit(i,false));
var str='选择一张手牌,作为“怨”置于武将牌上;同时选择一名其他角色,令该角色获得〖怨语〗的后续效果。'
@ -8414,6 +8418,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
filter:function(event,player,name){
if(player.hasSkill('zhiwei2')) return false;
if(!game.hasPlayer(current=>current!=player)) return false;
if(get.mode()=='guozhan') return event.name=='showCharacter'&&(event.toShow.contains('gz_luyusheng')||event.toShow.contains('luyusheng'));
return event.name!='showCharacter'&&(name!='phaseBefore'||game.phaseNumber==0);
},

View File

@ -2011,7 +2011,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
group:['sbanguo_move','sbanguo_damage','sbanguo_dying'],
filter:function(event,player){
return (event.name!='phase'||game.phaseNumber==0);
return game.hasPlayer(current=>current!=player)&&(event.name!='phase'||game.phaseNumber==0);
},
content:function(){
'step 0'
@ -2423,6 +2423,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
group:['yijin_upstart','yijin_die'],
filter:function(event,player){
if(!game.hasPlayer(current=>current!=player)) return false;
return lib.skill.yijin.getKane(player).length;
},
getKane:function(player){
@ -2691,7 +2692,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
enable:'phaseUse',
usable:1,
filter:function(event,player){
return game.countPlayer()>2;
return game.countPlayer(current=>current!=player)>=2;
},
filterTarget:lib.filter.notMe,
selectTarget:2,
@ -8079,7 +8080,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else event.finish();
}
'step 1'
if(result.bool){
if(result.bool&&game.hasPlayer(current=>current!=player)){
event.card=result.links[0];
player.chooseTarget(true,lib.filter.notMe,'选择一名其他角色获得'+get.translation(event.card)).set('ai',function(target){
return get.value(_status.event.getParent().card,target)*get.attitude(_status.event.player,target);
@ -9172,7 +9173,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else event.finish();
'step 2'
var max=Math.min(player.hp,target.countCards('he'));
if(max>0){
if(max>0&&target.isIn()){
player.choosePlayerCard('he',target,true,[1,max]).set('forceAuto',true).set('prompt','将'+get.translation(target)+'的至多'+get.cnNumber(max)+'张牌置于其武将牌上');
}
else event.finish();

View File

@ -3726,7 +3726,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
dutySkill:true,
filter:function(event,player){
return (event.name!='phase'||game.phaseNumber==0);
return game.hasPlayer(current=>current!=player)&&(event.name!='phase'||game.phaseNumber==0);
},
content:function(){
'step 0'

View File

@ -12145,7 +12145,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
forced:true,
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);
},
audio:6,
content:function(){
@ -18744,6 +18744,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
global:'loseAsyncAfter',
},
filter:function(event,player){
if(!game.hasPlayer(current=>current!=player)) return false;
if(event.type!='discard'||event.getlx===false) return false;
var evt=event.getl(player);
if(!evt||!evt.cards2) return false;

View File

@ -3816,7 +3816,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
event.finish();
'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;
}).set('ai',function(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'},
direct:true,
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(){
'step 0'
@ -9648,7 +9649,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
forced:true,
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(){
'step 0'

View File

@ -713,7 +713,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
onremove:true,
filter:function(event,player){
return (event.name!='phase'||game.phaseNumber==0);
return game.hasPlayer(current=>current!=player)&&(event.name!='phase'||game.phaseNumber==0);
},
group:['twyanshi_hurt','twyanshi_damage'],
content:function(){
@ -5019,7 +5019,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else event.finish();
'step 2'
game.delayx();
if(player.getExpansions('twxingwu').length<3) event.finish();
if(player.getExpansions('twxingwu').length<3||!game.hasPlayer(current=>current!=player)) event.finish();
'step 3'
player.chooseButton(['是否移去三张“星舞”牌并发射核弹?',player.getExpansions('twxingwu')],3).set('ai',function(button){
if(_status.event.goon) return 1;
@ -8300,7 +8300,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:3,
trigger:{global:'phaseBefore',player:'enterGame'},
filter:function(event,player){
return event.name!='phase'||game.phaseNumber==0;
return game.hasPlayer(current=>current!=player)&&(event.name!='phase'||game.phaseNumber==0);
},
forced:true,
content:function(){
@ -10710,7 +10710,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
};
} else event.finish();
'step 3'
if(result.bool){
if(result.bool&&game.hasPlayer(current=>current!=player)){
player.chooseTarget('选择一名其他角色对其造成2点雷电伤害',lib.filter.notMe,true).set('ai',target=>get.damageEffect(target,player,player,'thunder'));
}
'step 4'
@ -13294,6 +13294,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){
'step 0'
var choiceList=['令一名其他角色与你各摸一张牌','令自己下个出牌阶段可以多发动一次【外使】'];
event.count=0;
if(game.hasPlayer(current=>current!=player)){
choiceList.shift();
event.count++;
}
if(lib.skill.chijie.filter&&lib.skill.chijie.filter({},player)) choiceList.push('将自己的势力变更为场上存在的一个其他势力');
player.chooseControl('cancel2').set('prompt',get.prompt('renshe')).set('choiceList',choiceList).set('ai',function(){
if(game.hasPlayer(function(current){
@ -13306,13 +13311,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else{
event.index=result.index;
player.logSkill('renshe');
if(event.index==0){
if(event.index+event.count==0){
player.chooseTarget('请选择一名角色,与其各摸一张牌',lib.filter.notMe,true).ai=function(target){
if(target.hasSkillTag('nogain')) return 0.1;
return get.attitude(_status.event.player,target);
};
}
else if(result.index==1){
else if(result.index+event.count==1){
player.storage.waishi++;
event.finish();
}

View File

@ -2207,7 +2207,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){
'step 0'
player.recover();
player.chooseTarget('残肆:选择一名其他角色',true,lib.filter.notMe).set('ai',target=>{
if(!game.hasPlayer(current=>current!=player)) event.finish();
else player.chooseTarget('残肆:选择一名其他角色',true,lib.filter.notMe).set('ai',target=>{
var player=_status.event.player;
var list=['recover','sha','juedou','huogong'];
return list.reduce((p,c)=>{
@ -3140,8 +3141,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else choiceList[0]='<span style="opacity:0.5; ">'+choiceList[0]+(used?'(同名牌被使用过)':'(已选择)')+'</span>';
if(!player.hasSkill('dczhanmeng_choice1')) list.push('选项二');
else choiceList[1]='<span style="opacity:0.5">'+choiceList[1]+'(已选择)</span>';
if(!player.hasSkill('dczhanmeng_choice2')) list.push('选项三');
else choiceList[2]='<span style="opacity:0.5">'+choiceList[2]+'(已选择)</span>';
var other=game.hasPlayer(current=>current!=player);
if(!player.hasSkill('dczhanmeng_choice2')&&other) list.push('选项三');
else choiceList[2]='<span style="opacity:0.5">'+choiceList[2]+(!other?'(没人啦)':'(已选择)')+'</span>';
list.push('cancel2');
player.chooseControl(list).set('prompt',get.prompt('dczhanmeng')).set('ai',()=>{
var choices=_status.event.controls.slice().remove('cancel2');
@ -3375,7 +3377,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
forced:true,
direct:true,
filter:function(event,player){
return (event.name!='phase'||game.phaseNumber==0);
return game.hasPlayer(current=>current!=player)&&(event.name!='phase'||game.phaseNumber==0);
},
content:function(){
'step 0'
@ -4157,7 +4159,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} else event.redo();
event.nowProperty++;
'step 2'
player.chooseTarget('梦解对一名其他角色造成1点伤害',true,lib.filter.notMe).set('ai',target=>get.damageEffect(target,player,player));
if(!game.hasPlayer(current=>current!=player)) event._result={bool:false};
else player.chooseTarget('梦解对一名其他角色造成1点伤害',true,lib.filter.notMe).set('ai',target=>get.damageEffect(target,player,player));
'step 3'
if(result.bool){
player.logSkill('dcmengjie',result.targets[0]);
@ -4196,7 +4199,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
game.delayx();
event.goto(1);
'step 10'
player.chooseTarget('梦解:令一名其他角色将手牌补至上限',true,(card,player,target)=>{
if(!game.hasPlayer(current=>current!=player)) event._result={bool:false};
else player.chooseTarget('梦解:令一名其他角色将手牌补至上限',true,(card,player,target)=>{
return target!=player;
}).set('ai',target=>{
var att=get.attitude(_status.event.player,target);
@ -8836,6 +8840,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
direct:true,
skillAnimation:true,
animationColor:'gray',
filter:function(event,player){
return game.hasPlayer(current=>current!=player);
},
content:function(){
'step 0'
player.chooseTarget('请选择【毒逝】的目标','选择一名其他角色,令其获得技能【毒逝】',true,lib.filter.notMe).set('forceDie',true).set('ai',function(target){
@ -10918,7 +10925,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
dcxinyou_info:'出牌阶段限一次。你可以将体力回复至上限并将手牌补至体力上限。若你以此法获得了至少两张牌你于结束阶段失去1点体力回复了体力你于结束阶段弃置两张牌。',
zerong:'笮融',
dccansi:'残肆',
dccansi_info:'锁定技。准备阶段你回复1点体力并选择一名其他角色其回复1点体力然后你视为对其依次使用以下能使用的牌【杀】无距离限制、【决斗】、【火攻】。当其以此法受到1点伤害后你摸两张牌。',
dccansi_info:'锁定技。准备阶段你回复1点体力然后选择一名其他角色其回复1点体力你视为对其依次使用以下能使用的牌【杀】无距离限制、【决斗】、【火攻】。当其以此法受到1点伤害后你摸两张牌。',
dcfozong:'佛宗',
dcfozong_info:'锁定技。出牌阶段开始时若你的手牌数大于7你将X张手牌置于武将牌上X为你的手牌数-7。然后若你的武将牌上有至少七张牌其他角色依次选择一项1.获得其中的一张牌并令你回复1点体力2.令你失去1点体力。',
dc_ruiji:'芮姬',

View File

@ -2409,6 +2409,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
popup:false,
charlotte:true,
filter:function(event,player){
if(!game.hasPlayer(current=>current!=player)) return false;
return event.skill=='xintaoluan_backup'||event.skill=='xintaoluan5'||event.skill=='xintaoluan4';
},
content:function(){
@ -5084,6 +5085,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
popup:false,
charlotte:true,
filter:function(event,player){
if(!game.hasPlayer(current=>current!=player)) return false;
return event.skill=='taoluan_backup'||event.skill=='taoluan5'||event.skill=='taoluan4';
},
content:function(){

View File

@ -22462,6 +22462,7 @@
}
if(!name) return false;
if(this.hasJudge(name)) return false;
if(this.isOut()) return false;
var mod=game.checkMod(card,this,this,'unchanged','targetEnabled',this);
if(mod!='unchanged') return mod;
return true;

View File

@ -2642,7 +2642,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
forced:true,
content:function(){
'step 0'
var list=game.players.slice(0);
var list=game.filterPlayer();
list.remove(player);
if(list.length){
var target=list.randomGet();