rename Disabled to DisabledSlot, removed isEmpty

This commit is contained in:
Spmario233 2023-08-13 00:47:44 +08:00
parent 6919fc6a5e
commit 322b7ec991
17 changed files with 253 additions and 231 deletions

View File

@ -3447,10 +3447,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
forced:true,
charlotte:true,
filter:function(event,player){
return !player.isDisabled(1);
return player.hasEnabledSlot(1);
},
content:function(){
if(player.isEmpty(1)){
if(player.hasEmptySlot(1)){
var card=get.cardPile2(function(card){
return get.subtype(card)=='equip1'&&!get.cardtag(card,'gifts')&&player.canUse(card,player);
});
@ -4176,12 +4176,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filterCard:function(card,player){
if(!player) player=_status.event.player;
return game.hasPlayer(function(current){
return current!=player&&current.isEmpty(get.subtype(card,false));
return current!=player&&current.canEquip(card);
});
},
position:'e',
filterTarget:function(card,player,target){
return target!=player&&target.isEmpty(get.subtype(ui.selected.cards[0],false));
return target!=player&&target.canEquip(ui.selected.cards[0]);
},
check:function(card){
if(get.value(card)<=0) return 10;
@ -6536,7 +6536,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(player==target) return false;
var card=ui.selected.cards[0];
if(get.type(card,false)=='delay') return target.canAddJudge({name:card.name});
return target.isEmpty(get.subtype(card,false));
return target.canEquip(card);
},
discard:false,
lose:false,
@ -10200,16 +10200,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 0'
var list=['equip1','equip2','equip3','equip4','equip5'];
for(var i=0;i<list.length;i++){
if(player.isDisabled(list[i])||player.storage.kengo_guidui2&&player.storage.kengo_guidui2.contains(list[i])) list.splice(i--,1);
if(!player.hasEnabledSlot(list[i])||player.storage.kengo_guidui2&&player.storage.kengo_guidui2.contains(list[i])) list.splice(i--,1);
}
player.chooseControl(list).set('prompt','请选择废除一个装备栏').ai=function(){
if(list.contains('equip1')&&player.isEmpty('equip1')&&player.countCards('h',function(card){
if(list.contains('equip1')&&player.hasEmptySlot('equip1')&&player.countCards('h',function(card){
return card.name=='sha'&&player.getUseValue(card)>0
})) return 'equip1';
if(list.contains('equip3')&&player.isEmpty('equip3')) return 'equip3';
if(list.contains('equip4')&&player.isEmpty('equip4')) return 'equip4';
if(list.contains('equip5')&&player.isEmpty('equip5')) return 'equip5';
if(list.contains('equip2')&&player.isEmpty('equip2')) return 'equip2';
if(list.contains('equip3')&&player.hasEmptySlot('equip3')) return 'equip3';
if(list.contains('equip4')&&player.hasEmptySlot('equip4')) return 'equip4';
if(list.contains('equip5')&&player.hasEmptySlot('equip5')) return 'equip5';
if(list.contains('equip2')&&player.hasEmptySlot('equip2')) return 'equip2';
return list.randomGet();
};
'step 1'

View File

@ -3734,7 +3734,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else{
event.target2=result.targets[0];
var list=['手牌区'];
if(lib.card[card.name].type=='equip'&&event.target2.isEmpty(lib.card[card.name].subtype)) list.push('装备区');
if(lib.card[card.name].type=='equip'&&event.target2.canEquip(card)) list.push('装备区');
if(lib.card[card.name].type=='delay'&&!event.target2.storage._disableJudge&&!event.target2.hasJudge(card.name)) list.push('判定区');
if(list.length==1) event._result={control:list[0]};
else{
@ -4011,7 +4011,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filter:function(event,player){
var num=event.name=='phase'?5:3;
if(num==3?event.numFixed:!game.hasPlayer(function(current){
return current.countDisabled()<5;
return current.hasEnabledSlot();
})) return false;
return game.countPlayer(function(current){
return current.isDamaged();
@ -4027,7 +4027,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
else{
player.chooseTarget(get.prompt('olzhiti'),'废除一名角色的一个随机装备栏',function(card,player,target){
return target.countDisabled()<5;
return target.hasEnabledSlot();
}).set('ai',function(target){
return -get.attitude(_status.event.player,target)*(target.countCards('e')+1)
});
@ -4038,13 +4038,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.logSkill('olzhiti',target);
var list=[];
for(var i=1;i<6;i++){
if(!target.isDisabled(i)) list.add((i==3||i==4)?6:i);
if(target.hasEnabledSlot(i)) list.add((i==3||i==4)?6:i);
}
var num=list.randomGet();
if(num!=6) target.disableEquip(num);
else{
target.disableEquip(3);
target.disableEquip(4);
target.disableEquip(3,4);
}
}
},
@ -6401,7 +6400,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return player!=event.player&&event.player.isIn()&&_status.currentPhase==player;
},
check:function(event,player){
if(player.countDisabled()<5&&player.isDisabled(5)) return false;
if(player.hasEnabledSlot()&&!player.hasEnabledSlot(5)) return false;
return true;
},
bannedList:[
@ -6425,7 +6424,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(func(listm[i])) list.add(listm[i]);
}
event.skills=list;
if(player.countDisabled()<5){
if(player.hasEnabledSlot()){
player.chooseToDisable().ai=function(event,player,list){
if(list.contains('equip5')) return 'equip5';
return list.randomGet();

View File

@ -4704,9 +4704,6 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2,
enable:'phaseUse',
usable:1,
isDisabled:function(player,pos){
return pos>0?player.isDisabled(pos):player.storage._disableJudge;
},
chooseButton:{
dialog:function(event,player){
var dialog=ui.create.dialog('弥笃:选择要废除或恢复的装备栏或判定区','hidden');
@ -4714,10 +4711,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
dialog.noforcebutton=true;
var list1=[],list2=[];
for(var i=1;i<6;i++){
(player.isDisabled(i)?list2:list1).push(i);
for(var j=0;j<player.countEnabledSlot(i);j++){
list1.push(i);
}
if(player.isDisabled(i)) list2.push(i);
}
(player.storage._disableJudge?list2:list1).push(-1);
var addTable=function(list){
(player.isDisabledJudge()?list2:list1).push(-1);
var addTable=function(list,bool){
var table=document.createElement('div');
table.classList.add('add-setting');
table.style.margin='0';
@ -4726,7 +4726,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
for(var i of list){
var td=ui.create.div('.shadowed.reduce_radius.pointerdiv.tdnode');
td.innerHTML='<span>'+(i>0?get.translation('equip'+i)+'栏':'判定区')+'</span>';
td.link=i;
td.link=[i,bool];
td.addEventListener(lib.config.touchscreen?'touchend':'click',ui.click.button);
for(var j in lib.element.button){
td[j]=lib.element.button[j];
@ -4738,43 +4738,43 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
if(list1.length){
dialog.addText('未废除');
addTable(list1);
addTable(list1,true);
}
if(list2.length){
dialog.addText('已废除');
addTable(list2);
addTable(list2,false);
}
return dialog;
},
filter:function(button,player){
if(!ui.selected.buttons.length) return true;
if(lib.skill.midu.isDisabled(player,ui.selected.buttons[0].link)) return false;
return !player.isDisabled(button.link);
if(!ui.selected.buttons[0].link[1]) return false;
return button.link[1]
},
check:function(button){
var player=_status.event.player;
if(lib.skill.midu.isDisabled(player,button.link)){
if(button.link<=0) return -10;
if(!button.link[1]){
if(button.link[0]<=0) return -10;
if(player.hasCard(function(card){
return get.subtype(card)==('equip'+button.link);
return get.subtype(card)==('equip'+button.link[0]);
},'hs')) return 15;
return 10;
}
if(button.link<=0||player.isEmpty(button.link)&&!player.hasCard(function(card){
return get.subtype(card)==('equip'+button.link)&&player.canUse(card,player)&&get.effect(player,card,player,player)>0;
if(button.link[0]<=0||player.hasEmptySlot(button.link[0])&&!player.hasCard(function(card){
return get.subtype(card)==('equip'+button.link[0])&&player.canUse(card,player)&&get.effect(player,card,player,player)>0;
},'hs')) return 5;
return 0;
},
select:[1,6],
select:[1,Infinity],
backup:function(links,player){
if(lib.skill.midu.isDisabled(player,links[0])){
if(!links[0][1]){
return {
audio:'midu',
selectCard:-1,
selectTarget:-1,
filterCard:()=>false,
filterTarget:()=>false,
equip:links[0],
equip:links[0][0],
content:function(){
var pos=lib.skill.midu_backup.equip;
if(pos<=0) player.enableJudge();
@ -4789,15 +4789,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
selectCard:-1,
filterCard:()=>false,
filterTarget:true,
equip:links.sort(),
equip:links.map(i=>i[0]).sort(),
content:function(){
var list=lib.skill.midu_backup.equip,bool=false;
for(var i of list){
if(i<=0) bool=true;
else player.disableEquip(i);
var list=lib.skill.midu_backup.equip,num=list.length,bool=false;
if(list.contains(-1)){
list.remove(-1);
bool=true;
}
if(list.length>0) player.disableEquip(list);
if(bool) player.disableJudge();
target.draw(list.length)
target.draw(num)
},
ai:{
tag:{
@ -4811,7 +4812,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
},
prompt:function(links,player){
if(lib.skill.midu.isDisabled(player,links[0])){
if(!links[0][1]){
return '恢复一个装备栏或判定区并获得〖活墨〗';
}
var numc=get.cnNumber(links.length);
@ -4828,11 +4829,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
xianwang:{
mod:{
globalTo:function(source,player,distance){
var num=player.countDisabled();
var num=player.countDisabledSlot();
if(num>0) return distance+(num>2?2:1);
},
globalFrom:function(source,player,distance){
var num=source.countDisabled();
var num=source.countDisabledSlot();
if(num>0) return distance-(num>2?2:1);
},
},
@ -5513,7 +5514,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var info=get.info(i);
return info&&!get.is.locked(i)&&!info.limited&&!info.juexingji&&!info.zhuSkill&&!info.charlotte;
});
if(!skills.length&&target.isEmpty(2)) return 1;
if(!skills.length&&target.hasEmptySlot(2)) return 1;
return -0.5*skills.length;
},
},
@ -6458,7 +6459,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
mod:{
targetInRange:function(card,player,target){
if(player.countDisabled()>=5) return true;
for(var i=1;i<=5;i++){
if(!player.hasDisabledSlot(i)) return false;
}
return true;
},
},
marktext:'萍',
@ -6469,7 +6473,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{global:'useCardAfter'},
filter:function(event,player){
return player!=event.player&&event.targets.contains(player)&&
player.countDisabled()<5&&!player.getStorage('fuping').contains(event.card.name);
player.hasEnabledSlot()&&!player.getStorage('fuping').contains(event.card.name);
},
logTarget:'player',
prompt2:(event)=>('废除一个装备栏并记录【'+get.translation(event.card.name)+'】'),
@ -7273,14 +7277,14 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(num>=5) return false;
var num2=0;
for(var i=1;i<=5;i++){
if(event.player.isEmpty(i)) num2++;
num2+=event.player.countEmptySlot(i);
}
return num<num2;
},
content:function(){
var num2=0;
for(var i=1;i<=5;i++){
if(trigger.player.isEmpty(i)) num2++;
num2+=trigger.player.countEmptySlot(i);
}
player.drawTo(num2);
},

View File

@ -11151,99 +11151,100 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var next=player.chooseTarget(2,function(card,player,target){
if(ui.selected.targets.length){
if(!_status.event.ingame){
return target.isEmpty(2)?true:false;
var cards=ui.selected.targets[0].getEquip(2);
return target.canEquip(card)
}
var from=ui.selected.targets[0];
if(target.isMin()) return false;
var es=from.getCards('e');
for(var i=0;i<es.length;i++){
if(['equip3','equip4'].contains(get.subtype(es[i]))&&target.getEquip('liulongcanjia')) continue;
if(es[i].name=='liulongcanjia'&&target.countCards('e',{subtype:['equip3','equip4']})>1) continue;
if(target.isEmpty(get.subtype(es[i]))) return true;
}
for(var i=0;i<es.length;i++){
if(['equip3','equip4'].contains(get.subtype(es[i]))&&target.getEquip('liulongcanjia')) continue;
if(es[i].name=='liulongcanjia'&&target.countCards('e',{subtype:['equip3','equip4']})>1) continue;
if(target.canEquip(es[i])) return true;
}
return false;
}
else{
if(!event.ingame){
if(target.getEquip(2)) return true;
return false;
}
else{
if(!event.ingame){
if(target.getEquip(2)) return true;
return false;
}
return target.countCards('e')>0;
}
});
next.set('ingame',event.ingame)
next.set('ai',function(target){
var player=_status.event.player;
var att=get.attitude(player,target);
if(ui.selected.targets.length==0){
if(att<0){
if(game.hasPlayer(function(current){
if(get.attitude(player,current)>0){
var es=target.getCards('e');
for(var i=0;i<es.length;i++){
if(['equip3','equip4'].contains(get.subtype(es[i]))&&current.getEquip('liulongcanjia')) continue;
else if(es[i].name=='liulongcanjia'&&target.countCards('e',{subtype:['equip3','equip4']})>1) continue;
else if(current.isEmpty(get.subtype(es[i]))) return true;
}
return false;
return target.countCards('e')>0;
}
});
next.set('ingame',event.ingame)
next.set('ai',function(target){
var player=_status.event.player;
var att=get.attitude(player,target);
if(ui.selected.targets.length==0){
if(att<0){
if(game.hasPlayer(function(current){
if(get.attitude(player,current)>0){
var es=target.getCards('e');
for(var i=0;i<es.length;i++){
if(['equip3','equip4'].contains(get.subtype(es[i]))&&current.getEquip('liulongcanjia')) continue;
else if(es[i].name=='liulongcanjia'&&target.countCards('e',{subtype:['equip3','equip4']})>1) continue;
else if(current.canEquip(es[i])) return true;
}
})) return -att;
}
return 0;
return false;
}
})) return -att;
}
if(att>0){
var es=ui.selected.targets[0].getCards('e');
var i;
for(i=0;i<es.length;i++){
if(['equip3','equip4'].contains(get.subtype(es[i]))&&target.getEquip('liulongcanjia')) continue;
if(es[i].name=='liulongcanjia'&&target.countCards('e',{subtype:['equip3','equip4']})>1) continue;
if(target.isEmpty(get.subtype(es[i]))) break;
}
if(i==es.length) return 0;
}
return -att*get.attitude(player,ui.selected.targets[0]);
});
next.set('multitarget',true);
next.set('targetprompt',['被移走','移动目标']);
next.set('prompt',prompt);
'step 1'
if(result.bool){
player.line2(result.targets,'green');
event.targets=result.targets;
return 0;
}
else event.finish();
'step 2'
game.delay();
'step 3'
if(targets.length==2){
if(!event.ingame){
event._result={
bool:true,
links:[targets[0].getEquip(2)],
};
if(att>0){
var es=ui.selected.targets[0].getCards('e');
var i;
for(i=0;i<es.length;i++){
if(['equip3','equip4'].contains(get.subtype(es[i]))&&target.getEquip('liulongcanjia')) continue;
if(es[i].name=='liulongcanjia'&&target.countCards('e',{subtype:['equip3','equip4']})>1) continue;
if(target.canEquip(es[i])) break;
}
else{
player.choosePlayerCard('e',true,function(button){
return get.equipValue(button.link);
},targets[0]).set('targets0',targets[0]).set('targets1',targets[1]).set('filterButton',function(button){
var targets1=_status.event.targets1;
if(['equip3','equip4'].contains(get.subtype(button.link))&&targets1.getEquip('liulongcanjia')) return false;
if(button.link.name=='liulongcanjia'&&targets1.countCards('e',{subtype:['equip3','equip4']})>1) return false;
return !targets1.countCards('e',{subtype:get.subtype(button.link)});
if(i==es.length) return 0;
}
return -att*get.attitude(player,ui.selected.targets[0]);
});
next.set('multitarget',true);
next.set('targetprompt',['被移走','移动目标']);
next.set('prompt',prompt);
'step 1'
if(result.bool){
player.line2(result.targets,'green');
event.targets=result.targets;
}
else event.finish();
'step 2'
game.delay();
'step 3'
if(targets.length==2){
if(!event.ingame){
event._result={
bool:true,
links:[targets[0].getEquip(2)],
};
}
else{
player.choosePlayerCard('e',true,function(button){
return get.equipValue(button.link);
},targets[0]).set('targets0',targets[0]).set('targets1',targets[1]).set('filterButton',function(button){
var targets1=_status.event.targets1;
if(['equip3','equip4'].contains(get.subtype(button.link))&&targets1.getEquip('liulongcanjia')) return false;
if(button.link.name=='liulongcanjia'&&targets1.countCards('e',{subtype:['equip3','equip4']})>1) return false;
return !targets1.countCards('e',{subtype:get.subtype(button.link)});
});
}
}
else event.finish();
'step 4'
if(result.bool&&result.links.length){
var link=result.links[0];
if(get.position(link)=='e') event.targets[1].equip(link);
else if(link.viewAs) event.targets[1].addJudge({name:link.viewAs},[link]);
else event.targets[1].addJudge(link);
event.targets[0].$give(link,event.targets[1],false)
game.delay();
});
}
}
else event.finish();
'step 4'
if(result.bool&&result.links.length){
var link=result.links[0];
if(get.position(link)=='e') event.targets[1].equip(link);
else if(link.viewAs) event.targets[1].addJudge({name:link.viewAs},[link]);
else event.targets[1].addJudge(link);
event.targets[0].$give(link,event.targets[1],false)
game.delay();
}
},
audio:true,
enable:"phaseUse",
@ -12440,7 +12441,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(target.isMin()) return false;
var es=from.getCards('e');
for(var i=0;i<es.length;i++){
if(target.isEmpty(get.subtype(es[i]))) return true;
if(target.canEquip(es[i])) return true;
}
return false;
}
@ -12464,7 +12465,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
})) return 14;
if(target.countCards('e',function(card){
return get.value(card,target)<0&&game.hasPlayer(function(current){
return current!=target&&get.attitude(player,current)<0&&current.isEmpty(get.subtype(card))
return current!=target&&get.attitude(player,current)<0&&current.canEquip(card)
});
})>0) return 9;
}
@ -12473,7 +12474,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(current!=target&&get.attitude(player,current)>0){
var es=target.getCards('e');
for(var i=0;i<es.length;i++){
if(get.value(es[i],target)>0&&current.isEmpty(get.subtype(es[i]))&&get.value(es[i],current)>0) return true;
if(get.value(es[i],target)>0&&current.canEquip(es[i])&&get.value(es[i],current)>0) return true;
}
}
})){
@ -12489,7 +12490,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(sgnatt!=0&&att2!=0&&
get.sgn(get.value(es[i],ui.selected.targets[0]))==-att2&&
get.sgn(get.value(es[i],target))==sgnatt&&
target.isEmpty(get.subtype(es[i]))){
target.canEquip(es[i])){
return Math.abs(att);
}
}
@ -12538,7 +12539,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return targets1.canAddJudge(button.link);
}
else{
return targets1.isEmpty(get.subtype(button.link));
return targets1.canEquip(button.link);
}
});
}

View File

@ -1666,7 +1666,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(current.isMin()) return false;
var es=target.getCards('e');
for(var i=0;i<es.length;i++){
if(current.isEmpty(get.subtype(es[i]))) return true;
if(current.canEquip(es[i])) return true;
}
return false;
});
@ -1688,7 +1688,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(sgnatt!=0&&att2!=0&&sgnatt!=att2&&
get.sgn(get.value(es[i],from))==-att2&&
get.sgn(get.effect(target,es[i],player,target))==sgnatt&&
target.isEmpty(get.subtype(es[i]))){
target.canEquip(es[i])){
return Math.abs(att);
}
}
@ -1740,7 +1740,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return targets1.canAddJudge(button.link);
}
else{
return targets1.isEmpty(get.subtype(button.link));
return targets1.canEquip(button.link);
}
});
}
@ -3181,7 +3181,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
forced:true,
trigger:{target:'useCardToTargeted'},
filter:function(event,player){
if(!player.isEmpty(2)) return false;
if(!player.hasEmptySlot(2)) return false;
if(event.card.name!='sha') return false;
return event.nature;
},
@ -8773,7 +8773,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
zyshangyi:'尚义',
zyshangyi_info:'出牌阶段限一次。你可以令一名其他角色观看你的手牌,然后你观看其手牌并可以弃置其中一张牌。',
zymingshi:'名士',
zymingshi_info:'锁定技。若你的防具栏为空且未废除,属性【杀】对你无效。',
zymingshi_info:'锁定技。若你有空置的防具栏,属性【杀】对你无效。',
gzsuishi:'随势',
gzsuishi2:'随势',
gzsuishi_info:'锁定技其他角色进入濒死状态时若伤害来源与你势力相同你摸一张牌其他角色死亡时若其与你势力相同你失去1点体力。',

View File

@ -740,7 +740,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
old_fuyin:{
mod:{
targetEnabled:function(card,player,target){
if((card.name=='juedou'||card.name=='sha'||card.name=='huogong')&&player!=target&&player.countCards('h')>=target.countCards('h')&&target.isEmpty(2)) return false;
if((card.name=='juedou'||card.name=='sha'||card.name=='huogong')&&player!=target&&player.countCards('h')>=target.countCards('h')&&target.hasEmptySlot(2)) return false;
},
},
},

View File

@ -3057,7 +3057,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(get.sgn(get.value(es[i],current))!=-att||get.value(es[i],current)<5) return false;
var att2=get.sgn(get.attitude(player,current2));
if(att==att2||att2!=get.sgn(get.effect(current2,es[i],player,current2))) return false;
return current!=current2&&!current2.isMin()&&current2.isEmpty(get.subtype(es[i]));
return current!=current2&&!current2.isMin()&&current2.canEquip(es[i]);
})){
return true;
}
@ -5083,7 +5083,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!target.getHistory('sourceDamage').length){
var cards=target.getCards('e');
for(var i of cards){
if(player.isEmpty(get.subtype(i))) return true;
if(player.canEquip(i)) return true;
}
}
return target.getHistory('useCard',function(evt){
@ -5102,7 +5102,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!target.getHistory('sourceDamage').length){
var cards=target.getCards('e');
for(var i of cards){
if(player.isEmpty(get.subtype(i))) list.push(i);
if(player.canEquip(i)) list.push(i);
}
}
if(list.length){
@ -6735,7 +6735,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
});
for(var i=0;i<es.length;i++){
if(game.hasPlayer(function(current2){
return current!=current2&&!current2.isMin()&&current2.isEmpty(get.subtype(es[i]));
return current!=current2&&!current2.isMin()&&current2.canEquip(es[i]);
})){
return true;
}
@ -6761,7 +6761,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return !_status.event.cards.contains(card);
});
for(var i=0;i<es.length;i++){
if(target.isEmpty(get.subtype(es[i]))) return true;
if(target.canEquip(es[i])) return true;
}
return false;
}
@ -6779,7 +6779,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(target==player&&player.hasSkill('decadexuanfeng')){
if(player.countCards('e',function(card){
return !_status.event.cards.contains(card)&&game.hasPlayer(function(current){
return current!=target&&current.isEmpty(get.subtype(card))&&get.effect(current,card,player,player)<0;
return current!=target&&current.canEquip(card)&&get.effect(current,card,player,player)<0;
});
})>0) return 18;
return 7;
@ -6787,7 +6787,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else if(att>0){
if(target.countCards('e',function(card){
return get.value(card,target)<0&&!_status.event.cards.contains(card)&&game.hasPlayer(function(current){
return current!=target&&current.isEmpty(get.subtype(card))&&get.effect(current,card,player,player)<0;
return current!=target&&current.canEquip(card)&&get.effect(current,card,player,player)<0;
});
})>0) return 9;
}
@ -6798,7 +6798,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return !_status.event.cards.contains(card);
});
for(var i=0;i<es.length;i++){
if(get.value(es[i],target)>0&&current.isEmpty(get.subtype(es[i]))&&get.effect(current,es[i],player,current)>0) return true;
if(get.value(es[i],target)>0&&current.canEquip(card)&&get.effect(current,es[i],player,current)>0) return true;
}
}
})){
@ -6818,7 +6818,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return get.attitude(player,current)<0&&current.countDiscardableCards(player,'he')>0&&get.damageEffect(current,player,player)>0;
});
if(bool&&player.countCards('e',function(card){
return !_status.event.cards.contains(card)&&target.isEmpty(get.subtype(card))&&get.effect(target,card,player,player)>0;
return !_status.event.cards.contains(card)&&target.canEquip(card)&&get.effect(target,card,player,player)>0;
})) return 2.5*Math.abs(att);
else if(bool) return 1/Math.max(1,Math.abs(att));
else return get.damageEffect(target,player,player);
@ -6826,7 +6826,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(sgnatt!=0&&att2!=0&&sgnatt!=att2&&
get.sgn(get.value(es[i],ui.selected.targets[0]))==-att2&&
get.sgn(get.effect(target,es[i],player,target))==sgnatt&&
target.isEmpty(get.subtype(es[i]))){
target.canEquip(es[i])){
return Math.abs(att);
}
}
@ -6865,7 +6865,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},targets[0]).set('nojudge',event.nojudge||false).set('targets0',targets[0]).set('targets1',targets[1]).set('filterButton',function(button){
if(_status.event.cards.contains(button.link)) return false;
var targets1=_status.event.targets1;
return targets1.isEmpty(get.subtype(button.link));
return targets1.canEquip(button.link);
}).set('cards',cards);
}
else{
@ -6900,7 +6900,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
};
for(var i=0;i<friends.length;i++){
for(var j=1;j<=5;j++){
if(friends[i].isEmpty(j)){
if(friends[i].hasEmptySlot(j)){
vacancies['equip'+j]++;
}
}
@ -7566,7 +7566,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else{
var filterTarget=function(card,player,target){
return target!=player&&target.countCards('e',function(card){
return player.isEmpty(get.subtype(card));
return player.canEquip(card);
});
}
if(game.hasPlayer(function(current){
@ -7577,7 +7577,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(att>0&&!target.hasSkillTag('noe')) return 0;
var num=0;
target.countCards('e',function(card){
if(player.isEmpty(get.subtype(card))){
if(player.canEquip(card)){
var eff=get.effect(player,card,player,player);
if(eff>num) num=eff;
}
@ -7594,7 +7594,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
event.target=target;
player.logSkill('rezishou',target);
player.choosePlayerCard(target,'e','将一张装备牌移至你的装备区').set('filterButton',function(button){
return _status.event.player.isEmpty(get.subtype(button.link));
return _status.event.player.canEquip(button.link);
});
}
else event.finish();
@ -8325,7 +8325,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(target.isMin()) return false;
var es=from.getCards('e');
for(var i=0;i<es.length;i++){
if(target.isEmpty(get.subtype(es[i]))) return true;
if(target.canEquip(es[i])) return true;
}
return false;
}
@ -8341,7 +8341,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(att>0){
if(target.countCards('e',function(card){
return get.value(card,target)<0&&game.hasPlayer(function(current){
return current!=player&&current!=target&&get.attitude(player,current)<0&&current.isEmpty(get.subtype(card))&&get.effect(current,card,player,player)>0;
return current!=player&&current!=target&&get.attitude(player,current)<0&&current.canEquip(card)&&get.effect(current,card,player,player)>0;
});
})>0) return 9;
}
@ -8350,7 +8350,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(current!=target&&current!=player&&get.attitude(player,current)>0){
var es=target.getCards('e');
for(var i=0;i<es.length;i++){
if(get.value(es[i],target)>0&&current.isEmpty(get.subtype(es[i]))&&get.effect(current,es[i],player,player)>0) return true;
if(get.value(es[i],target)>0&&current.canEquip(es[i])&&get.effect(current,es[i],player,player)>0) return true;
}
}
})){
@ -8366,7 +8366,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(sgnatt!=0&&att2!=0&&sgnatt!=att2&&
get.sgn(get.value(es[i],ui.selected.targets[0]))==-att2&&
get.sgn(get.value(es[i],target))==sgnatt&&
target.isEmpty(get.subtype(es[i]))){
target.canEquip(es[i])){
return Math.abs(att);
}
}
@ -8404,7 +8404,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
},targets[0]).set('targets0',targets[0]).set('targets1',targets[1]).set('filterButton',function(button){
var targets1=_status.event.targets1;
return targets1.isEmpty(get.subtype(button.link));
return targets1.canEquip(button.link);
});
}
else{
@ -8433,7 +8433,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var att2=get.sgn(get.attitude(player,current2));
if(att==att2||att2!=get.sgn(get.value(es[i],current2))) return false;
}
return current!=current2&&!current2.isMin()&&current2.isEmpty(get.subtype(es[i]));
return current!=current2&&!current2.isMin()&&current2.canEquip(es[i]);
})){
return true;
}
@ -11709,7 +11709,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(!target.hasSex('male')) return false;
var card=ui.selected.cards[0];
if(!card) return false;
if(get.position(card)=='e'&&!target.isEmpty(get.subtype(card))) return false;
if(get.position(card)=='e'&&!target.canEquip(card)) return false;
return true;
},
discard:false,
@ -11718,7 +11718,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
content:function(){
'step 0'
if(get.position(cards[0])=='e') event._result={index:0};
else if(get.type(cards[0])!='equip'||!target.isEmpty(get.subtype(cards[0]))) event._result={index:1};
else if(get.type(cards[0])!='equip'||!target.canEquip(cards[0])) event._result={index:1};
else player.chooseControl().set('choiceList',[
'将'+get.translation(cards[0])+'置入'+get.translation(target)+'的装备区',
'弃置'+get.translation(cards[0]),

View File

@ -3976,8 +3976,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
filterTarget:function(card,player,target){
if(target.isMin()) return false;
var type=get.subtype(card);
return player!=target&&target.isEmpty(type);
return player!=target&&target.canEquip(card);
},
content:function(){
target.equip(cards[0]);
@ -5418,7 +5417,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
inherit:'bagua_skill',
filter:function(event,player){
if(!lib.skill.bagua_skill.filter(event,player)) return false;
if(!player.isEmpty(2)) return false;
if(!player.hasEmptySlot(2)) return false;
return true;
},
ai:{
@ -5428,7 +5427,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(player==target&&get.subtype(card)=='equip2'){
if(get.equipValue(card)<=7.5) return 0;
}
if(!target.isEmpty(2)) return;
if(!target.hasEmptySlot(2)) return;
return lib.skill.bagua_skill.ai.effect.target.apply(this,arguments);
}
}

View File

@ -1,4 +1,5 @@
'use strict';
game.import('character',function(lib,game,ui,get,ai,_status){
return {
name:'shiji',
@ -402,21 +403,20 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(att>0){
if(target.hasCard(function(card){
if(get.value(card,target)<=0&&game.hasPlayer(function(current){
return current!=target&&current.isEmpty(get.subtype(card,false))&&get.effect(current,card,player,player)>0;
return current!=target&&current.canEquip(card,false)&&get.effect(current,card,player,player)>0;
})) return true;
return false;
},'e')) return 2*att;
if(!target.hasCard(function(card){
var sub=get.subtype(card,false);
return game.hasPlayer(function(current){
return current!=target&&current.isEmpty(sub);
return current!=target&&current.canEquip(card);
})
},'e')) return 1;
}
else if(att<0){
if(target.hasCard(function(card){
if(get.value(card,target)>=4.5&&game.hasPlayer(function(current){
return current!=target&&current.isEmpty(get.subtype(card,false))&&get.effect(current,card,player,player)>0;
return current!=target&&current.canEquip(card)&&get.effect(current,card,player,player)>0;
})) return true;
return false;
},'e')) return -att;
@ -433,9 +433,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else event.finish();
'step 2'
var es=target.getCards('e',function(card){
var sub=get.subtype(card,false);
return game.hasPlayer(function(current){
return current!=target&&current.isEmpty(sub);
return current!=target&&current.canEquip(card);
})
});
if(es.length){
@ -443,7 +442,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
else player.chooseButton(['移动'+get.translation(target)+'的一张装备牌',es],true).set('ai',function(button){
var player=_status.event.player,target=_status.event.getParent().target,card=button.link;
if(game.hasPlayer(function(current){
return current!=target&&current.isEmpty(get.subtype(card,false))&&get.effect(current,card,player,player)>0;
return current!=target&&current.canEquip(card)&&get.effect(current,card,player,player)>0;
})) return -get.value(card,target)*get.attitude(player,target);
return 0;
});
@ -453,8 +452,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(result.bool){
event.card=result.links[0];
player.chooseTarget(true,'选择'+get.translation(event.card)+'的移动目标',function(card,player,target){
return target.isEmpty(_status.event.subtype);
}).set('subtype',get.subtype(event.card)).set('ai',function(target){
return target.canEquip(_status.event.card);
}).set('card',event.card).set('ai',function(target){
var evt=_status.event;
return get.effect(target,evt.getParent().card,evt.player,evt.player);
});
@ -1999,15 +1998,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filter:function(event,player){
if(event.player!=player.storage.chuhai2) return false;
for(var i=1;i<6;i++){
if(player.isEmpty(i)) return true;
if(player.hasEmptySlot(i)) return true;
}
return false;
},
content:function(){
for(var i=1;i<7;i++){
if(player.isEmpty(i)){
if(player.hasEmptySlot(i)){
var sub='equip'+i,card=get.cardPile(function(card){
return get.subtype(card,false)==sub&&!get.cardtag(card,'gifts');
return get.subtype(card,false)==sub&&!get.cardtag(card,'gifts')&&player.canEquip(card);
});
if(card){
player.$gain2(card);
@ -2994,16 +2993,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
filterTarget:function(card,player,target){
for(var i=1;i<6;i++){
if(target.isEmpty(i)) return true;
if(target.hasEmptySlot(i)) return true;
}
return false;
},
content:function(){
'step 0'
event.num=0;
event.num=1;
player.awakenSkill('rongbei');
'step 1'
while(!target.isEmpty(event.num)){
while(!target.hasEmptySlot(event.num)){
event.num++;
if(event.num>5){
event.finish();
@ -4602,7 +4601,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:'muzhen',
filterTarget:[
function(card,player,target){
return target.countCards('h')>0&&target.isEmpty(ui.selected.cards[0]);
return target.countCards('h')>0&&target.canEquip(ui.selected.cards[0]);
},
function(card,player,target){
return target.countCards('e')>0;
@ -4610,9 +4609,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
][links[0]],
filterCard:[
function(card,player){
if(ui.selected.targets.length) return ui.selected.targets[0].isEmpty(card);
if(ui.selected.targets.length) return ui.selected.targets[0].canEquip(card);
return game.hasPlayer(function(current){
return current.countCards('h')>0&&current.isEmpty(card);
return current.countCards('h')>0&&current.canEquip(card);
})
},
true,

View File

@ -5901,16 +5901,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return !event.numFixed&&event.num>0;
},
check:function(event,player){
if(player.isEmpty(2)||player.isEmpty(5)||player.isEmpty(1)) return true;
if(player.hasEmptySlot(2)||player.hasEmptySlot(5)||player.hasEmptySlot(1)) return true;
return false;
},
prompt2:'摸牌阶段开始时,你可以少摸一张牌并声明一种装备牌的副类别,然后从牌堆或弃牌堆中获得一张该副类别的牌。',
content:function(){
'step 0'
player.chooseControl('equip1','equip2','equip6','equip5').set('prompt','选择获得一种副类别的装备牌').set('ai',function(card){
if(player.isEmpty(2)) return 'equip2';
if(player.isEmpty(5)) return 'equip5';
if(player.isEmpty(1)) return 'equip1';
if(player.hasEmptySlot(2)) return 'equip2';
if(player.hasEmptySlot(5)) return 'equip5';
if(player.hasEmptySlot(1)) return 'equip1';
return 'equip6';
});
'step 1'
@ -7818,7 +7818,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger:{global:'phaseBegin'},
direct:true,
filter:function(event,player){
return event.player.isIn()&&event.player.isEmpty(5)&&player.hasCard(lib.skill.zhuangshu.filterCard,'he');
return event.player.isIn()&&event.player.hasEmptySlot(5)&&player.hasCard(lib.skill.zhuangshu.filterCard,'he');
},
filterCard:function(card){
if(_status.connectMode) return true;
@ -7842,7 +7842,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 1'
if(result.bool){
var name='zhuangshu_'+get.type2(result.cards[0],result.cards[0].original=='h'?player:false);
if(lib.card[name]&&trigger.player.isIn&&trigger.player.isEmpty(5)){
if(lib.card[name]&&trigger.player.isIn&&trigger.player.hasEmptySlot(5)){
var target=game.findPlayer(function(current){
var equip=current.getEquip(5);
return equip&&equip.name==name;
@ -11880,7 +11880,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}).set('ai',function(target){
var player=_status.event.player;
var att=get.attitude(player,target)
if(target.getEquip(2)&&player.isEmpty(2)){
if(target.getEquip(2)&&player.hasEmptySlot(2)){
return -2*att;
}
return -att;
@ -16154,7 +16154,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
inherit:'bagua_skill',
filter:function(event,player){
if(!lib.skill.bagua_skill.filter(event,player)) return false;
if(!player.isEmpty(2)) return false;
if(!player.hasEmptySlot(2)) return false;
return true;
},
ai:{
@ -20901,7 +20901,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
position:'he',
filterTarget:function(card,player,target){
return target.isEmpty(get.subtype(card));
return target.canEquip(card);
},
ai1:function(card){
return 6-get.value(card);
@ -21160,7 +21160,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
"step 1"
if(result.bool){
event.card=result.links[0];
if(player.isEmpty(get.subtype(event.card))){
if(player.canEquip(event.card)){
player.chooseBool('是否将'+get.translation(event.card)+'置入自己的装备区?').ai=function(){
return true;
};
@ -21870,7 +21870,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
//priority:15,
filter:function (event,player){
if(player.hasSkill('smh_huoji')||player.hasSkill('smh_lianhuan')) return false;
if(!player.isEmpty(2)) return false;
if(!player.hasEmptySlot(2)) return false;
if(event.nature) return true;
return get.type(event.card,'trick')=='trick';
},
@ -21887,7 +21887,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(player==target&&get.subtype(card)=='equip2'){
if(get.equipValue(card)<=8) return 0;
}
if(!target.isEmpty(2)) return;
if(!target.hasEmptySlot(2)) return;
if(get.tag(card,'natureDamage')) return 'zerotarget';
if(get.type(card)=='trick'&&get.tag(card,'damage')){
return 'zeroplayertarget';

View File

@ -1139,7 +1139,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
event.num=target.countCards('e');
var subtypes=[];
for(var i=1;i<7;i++){
if(target.isEmpty(i)) subtypes.push('equip'+i);
if(target.hasEmptySlot(i)) subtypes.push('equip'+i);
}
if(subtypes.length){
subtypes.randomSort();
@ -5890,7 +5890,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
check:function(event,player){
for(var i=5;i>0;i--){
if(player.isEmpty(i)) return ('equip'+i);
if(player.hasEmptySlot(i)) return ('equip'+i);
}
return 'cancel2';
},
@ -8986,7 +8986,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
for(var i=0;i<event.toequip.length;i++){
if(get.type(card)=='equip'&&get.subtype(card)==get.subtype(event.toequip[i])) bool1=false;
}
return (get.type(card)=='equip'&&!event.toequip.contains(card)&&target.isEmpty(get.subtype(card))&&bool1);
return (get.type(card)=='equip'&&!event.toequip.contains(card)&&target.hasEmptySlot(card)&&bool1);
});
if(equip) event.toequip.push(equip);
else event.num=0;

View File

@ -8483,7 +8483,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
usable:1,
content:function(){
var card=get.cardPile(function(card){
return get.type(card)=='equip'&&player.isEmpty(get.subtype(card));
return get.type(card)=='equip'&&player.canEquip(card);
});
if(card){
player.$gain2(card);
@ -9013,12 +9013,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var val=get.value(i);
if(att>0){
if(val<=Math.min(0,equip)&&game.hasPlayer(function(current){
return current!=target&&current.isEmpty(get.subtype(i))&&get.effect(current,i,player,player)>0;
return current!=target&&current.canEquip(i)&&get.effect(current,i,player,player)>0;
})) equip=val;
}
else{
if(val>Math.max(0,equip)&&game.hasPlayer(function(current){
return current!=target&&current.isEmpty(get.subtype(i))&&get.effect(current,i,player,player)>0;
return current!=target&&current.canEquip(i)&&get.effect(current,i,player,player)>0;
})) equip=val;
}
}
@ -9121,7 +9121,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return targets1.canAddJudge(button.link);
}
else{
return targets1.isEmpty(get.subtype(button.link));
return targets1.canEquip(button.link);
}
}).set('ai',function(button){
var player=_status.event.player,target=_status.event.targets1,source=_status.event.targets0;
@ -11538,7 +11538,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
filterCard:{type:'equip'},
filterTarget:function(card,player,target){
var card=ui.selected.cards[0];
return target.isEmpty(get.subtype(card));
return target.canEquip(card);
},
discard:false,
lose:false,

View File

@ -8645,7 +8645,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
event.num=1;
'step 1'
var type='equip'+num;
if(!player.isEmpty(type)) return;
if(!player.hasEmptySlot(type)) return;
var card=get.cardPile2(function(card){
return get.subtype(card,false)==type&&player.canUse(card,player);
});

View File

@ -10835,7 +10835,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
"step 0"
var next;
if(trigger.player.hasCard(function(card){
return player.isEmpty(get.subtype(card));
return player.canEquip(card);
},'e')){
next=player.chooseControl('移动装备','draw_card','cancel2',function(event,player){
var source=_status.event.sourcex;
@ -10865,7 +10865,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(result.control=='移动装备'){
player.logSkill('qieting',trigger.player);
player.choosePlayerCard(trigger.player,'e','将一张装备牌移至你的装备区',true).set('filterButton',function(button){
return _status.event.player.isEmpty(get.subtype(button.link));
return _status.event.player.canEquip(button.link);
}).set('ai',function(button){
return get.effect(player,button.link,player,player);
});

View File

@ -10761,7 +10761,7 @@
if(!event.slots.length) return;
var slotsx=[...new Set(event.slots)].sort();
for(var slot of slotsx){
var lost=player.countDisabled(slot),gain=Math.min(lost,get.numOf(event.slots,slot));
var lost=player.countDisabledSlot(slot),gain=Math.min(lost,get.numOf(event.slots,slot));
if(lost<=0) continue;
else{
game.log(player,'恢复了'+get.cnNumber(gain)+'个','#g'+get.translation(slot)+'栏');
@ -11827,7 +11827,7 @@
'step 0'
var list=[];
for(var i=1;i<=5;i++){
if(player.hasDisabled(i)) list.push('equip'+i);
if(player.hasDisabledSlot(i)) list.push('equip'+i);
}
if(!list.length) event.finish();
else if(list.length==1){
@ -18133,20 +18133,20 @@
//装备栏相关
//判断一名角色的某个区域是否被废除
//type为要判断的区域 若为空 则判断玩家是否有任意一个被废除的区域
hasDisabled:function(type){
hasDisabledSlot:function(type){
var player=this;
if(type=='horse') return player.hasDisabled(3)&&player.hasDisabled(4);
return player.countDisabled(type)>0;
if(type=='horse') return player.hasDisabledSlot(3)&&player.hasDisabledSlot(4);
return player.countDisabledSlot(type)>0;
},
//判断一名角色的某个区域被废除的数量
//用法同上
countDisabled:function(type){
countDisabledSlot:function(type){
var player=this;
var map=(player.disabledSlots||{});
if(type==undefined){
num=0;
for(var i=1;i<=5;i++){
num+=player.countDisabled(i);
num+=player.countDisabledSlot(i);
}
return num;
}
@ -18157,11 +18157,28 @@
return 0;
}
},
//判断一名角色是否有某个装备栏空着
hasEmptySlot:function(type){
var player=this;
if(type=='horse') return player.hasEmptySlot(3)&&player.hasEmptySlot(4);
return player.countEmptySlot(type)>0;
},
//判断一名角色的某个装备栏空位的数量
countEmptySlot:function(type){
if(!type) return 0;
var player=this;
if(typeof type=='number') type=('equip'+type);
return Math.max(0,player.countEnabledSlot(type)-player.getEquips(type).reduce(function(num,card){
var types=get.subtypes(card,false);
return num+get.numOf(types,type);
},0))
},
//判断一名角色是否有可以用于装备牌的区域(考虑金箍棒等“不可被替换装备”)
//用法同下
countEquipableSlot:function(type){
if(!type) return false;
if(!type) return 0;
var player=this;
if(typeof type=='number') type=('equip'+type);
return Math.max(0,player.countEnabledSlot(type)-player.getEquips(type).reduce(function(num,card){
var types=get.subtypes(card,false);
if(!lib.filter.canBeReplaced(card,player)) num+=get.numOf(types,type);
@ -18192,7 +18209,7 @@
var slots=1;
var num=map[type];
if(typeof num=='number'&&num>0) slots+=num;
slots-=player.countDisabled(type);
slots-=player.countDisabledSlot(type);
return slots;
}
},
@ -18396,8 +18413,11 @@
return true;
},
//以下函数将不再进行后续维护
countDisabled:function(){
return this.countDisabledSlot.apply(this,arguments)
},
isDisabled:function(arg){
return this.hasDisabled(arg)&&!this.hasEnabledSlot(arg);
return this.hasDisabledSlot(arg)&&!this.hasEnabledSlot(arg);
},
isEmpty:function(num){
return this.countEnabledSlot(num)>this.getEquips(num);

View File

@ -1890,7 +1890,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
event.num=1.5;
'step 1'
var card=cards.shift();
if(player.isEmpty(get.subtype(card))&&Math.random()<event.num){
if(player.canEquip(card)&&Math.random()<event.num){
player.equip(card);
event.num=0.5;
}
@ -2494,7 +2494,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
priority:-0.3,
equipSkill:false,
filter:function(event,player){
if(!player.isEmpty(2)) return false;
if(!player.hasEmptySlot(2)) return false;
return lib.skill.renwang_skill.filter.apply(this,arguments);
},
},
@ -2615,7 +2615,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
priority:6,
audio:true,
filter:function(event,player){
if(!player.isEmpty('equip2')) return false;
if(!player.hasEmptySlot('equip2')) return false;
if(event.card.name=='nanman') return true;
if(event.card.name=='wanjian') return true;
return event.card.name=='sha'&&!get.nature(event.card);
@ -2626,7 +2626,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
ai:{
effect:{
target:function(card,player,target,current){
if(!target.isEmpty('equip2')) return;
if(!target.hasEmptySlot('equip2')) return;
if(card.name=='nanman'||card.name=='wanjian') return 'zerotarget';
if(card.name=='sha'){
var equip1=player.getEquip(1);

View File

@ -966,7 +966,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
equipSkill:true,
mod:{
maxHandcard:function(player,num){
if(!player.isEmpty(2)) return;
if(!player.hasEmptySlot(2)) return;
if(player.hasSkill('huangjintianbingfu')){
num+=player.getExpansions('huangjintianbingfu').length;
}
@ -978,14 +978,14 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
audio:'tianshu',
inherit:'taipingyaoshu',
filter:function(event,player){
if(!player.isEmpty(2)) return false;
if(!player.hasEmptySlot(2)) return false;
return lib.skill.taipingyaoshu.filter(event,player);
},
noHidden:true,
ai:{
effect:{
target:function(card,player,target){
if(!target.isEmpty(2)) return;
if(!target.hasEmptySlot(2)) return;
if(player==target&&get.subtype(card)=='equip2'){
if(get.equipValue(card)<=7.5) return 0;
}
@ -11987,7 +11987,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
if(player==target) return false;
var card=ui.selected.cards[0];
if(get.type(card)!='equip') return true;
return target.isEmpty(get.subtype(card));
return target.canEquip(card);
},
prompt:get.prompt2('gzhuyuan'),
complexSelect:true,
@ -12053,7 +12053,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
},
position:'he',
filterTarget:function(card,player,target){
return target.isEmpty(get.subtype(card));
return target.canEquip(card);
},
ai1:function(card){
return 6-get.value(card);