Add lib.filter.ignoredHandcard.

This commit is contained in:
Tipx-L 2023-08-27 09:11:39 -07:00
parent 8516c7299c
commit b7578780ec
5 changed files with 18 additions and 36 deletions

View File

@ -76,7 +76,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
} }
else event.finish(); else event.finish();
'step 2' 'step 2'
if(result.index==0) player.gain(event.show_card,target,'give','bySelf'); if(result.index==0) target.give(event.show_card,player);
else target.damage(); else target.damage();
}, },
ai:{ ai:{
@ -157,7 +157,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
subtype:'equip1', subtype:'equip1',
distance:{attackFrom:-1}, distance:{attackFrom:-1},
fullskin:true, fullskin:true,
skills:['qixingbaodao'], global:'qixingbaodao',
selectTarget:[-1,-2], selectTarget:[-1,-2],
ai:{ ai:{
order:9, order:9,
@ -449,7 +449,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
} }
}, },
qixingbaodao:{ qixingbaodao:{
trigger:{player:'equipAfter'}, trigger:{player:'equipBegin'},
forced:true, forced:true,
equipSkill:true, equipSkill:true,
filter:function(event,player){ filter:function(event,player){
@ -694,7 +694,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
yitianjian:'倚天剑', yitianjian:'倚天剑',
yitianjian_info:'当你因执行【杀】的效果而造成伤害后若你已受伤则你可弃置一张手牌然后回复1点体力。', yitianjian_info:'当你因执行【杀】的效果而造成伤害后若你已受伤则你可弃置一张手牌然后回复1点体力。',
qixingbaodao:'七星宝刀', qixingbaodao:'七星宝刀',
qixingbaodao_info:'锁定技。当此牌进入你的装备区,你弃置装备区和判定区内的所有其他牌。', qixingbaodao_info:'锁定技。当此牌进入你的装备区,你弃置装备区和判定区内的所有其他牌。',
duanjian:'断剑', duanjian:'断剑',
duanjian_info:'这是一把坏掉的武器…', duanjian_info:'这是一把坏掉的武器…',
duanjian_append:'<span class="text" style="font-family: yuanli">不要因为手快而装给自己。</span>', duanjian_append:'<span class="text" style="font-family: yuanli">不要因为手快而装给自己。</span>',

View File

@ -982,7 +982,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
content:function(){ content:function(){
if(trigger.name=='lose'){ if(trigger.name=='lose'){
trigger.cards.remove(player.getEquips('ruyijingubang')); trigger.cards.removeArray(player.getEquips('ruyijingubang'));
} }
else{ else{
while(trigger.slots.contains('equip1')) trigger.slots.remove('equip1'); while(trigger.slots.contains('equip1')) trigger.slots.remove('equip1');

View File

@ -3864,17 +3864,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
discard:function(){ discard:function(){
"step 0" "step 0"
game.log(player,'进入了弃牌阶段'); game.log(player,'进入了弃牌阶段');
event.num=(function(){ event.num=Math.max(0,player.countCards('he',card=>!player.canIgnoreHandcard(card))-player.getHandcardLimit());
var num=0;
var hs=player.getCards('he');
num+=hs.length;
for(var i=0;i<hs.length;i++){
if(game.checkMod(hs[i],player,false,'ignoredHandcard',player)==true){
num--;
}
}
return Math.max(0,num-player.getHandcardLimit());
})();
if(event.num<=0) event.finish(); if(event.num<=0) event.finish();
else{ else{
if(lib.config.show_phase_prompt){ if(lib.config.show_phase_prompt){

View File

@ -6265,16 +6265,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}, },
phaseDiscardContent:function(){ phaseDiscardContent:function(){
"step 0" "step 0"
var num=0; event.num=Math.max(0,player.countCards('he',card=>!player.canIgnoreHandcard(card))-player.getHandcardLimit());
var hs=player.getCards('he');
num+=hs.length;
for(var i=0;i<hs.length;i++){
if(game.checkMod(hs[i],player,false,'ignoredHandcard',player)==true){
num--;
}
}
num=Math.max(0,num-player.getHandcardLimit());
event.num=num;
if(event.num<=0) event.finish(); if(event.num<=0) event.finish();
else{ else{
if(lib.config.show_phase_prompt){ if(lib.config.show_phase_prompt){

View File

@ -18282,6 +18282,11 @@
}, },
player:{ player:{
//新函数 //新函数
//Check if the card does not count toward hand limit
//检测此牌是否不计入手牌上限
canIgnoreHandcard:function(card){
return lib.filter.ignoredHandcard(card,this);
},
//Recast //Recast
//重铸 //重铸
recast:function(cards,recastingLose,recastingGain){ recast:function(cards,recastingLose,recastingGain){
@ -25120,14 +25125,7 @@
}, },
needsToDiscard:function(num){ needsToDiscard:function(num){
if(typeof num!='number') num=0; if(typeof num!='number') num=0;
var hs=this.getCards('h'); return Math.max(0,num+this.countCards('h',card=>!this.canIgnoreHandcard(card))-this.getHandcardLimit());
num+=hs.length;
for(var i=0;i<hs.length;i++){
if(game.checkMod(hs[i],this,false,'ignoredHandcard',this)==true){
num--;
}
}
return Math.max(0,num-this.getHandcardLimit());
}, },
distanceTo:function(target,method){ distanceTo:function(target,method){
return get.distance(this,target,method); return get.distance(this,target,method);
@ -28402,6 +28400,9 @@
all:function(){ all:function(){
return true; return true;
}, },
//Check if the card does not count toward the player's hand limit
//检测此牌是否不计入此角色的手牌上限
ignoredHandcard:(card,player)=>game.checkMod(card,player,false,'ignoredHandcard',player),
//Check if the card is recastable //Check if the card is recastable
//检查此牌是否可重铸 //检查此牌是否可重铸
cardRecastable:(card,player,source,raw)=>{ cardRecastable:(card,player,source,raw)=>{
@ -28607,7 +28608,7 @@
} }
var num=info.usable; var num=info.usable;
if(typeof num=='function') num=num(card,player); if(typeof num=='function') num=num(card,player);
num=game.checkMod(card,player,num,event,'cardUsable',player); num=game.checkMod(card,player,num,'cardUsable',player);
if(typeof num!='number') return true; if(typeof num!='number') return true;
else return(player.countUsed(card)<num); else return(player.countUsed(card)<num);
}, },
@ -54165,7 +54166,7 @@
}, },
verticalStr:function(str,sp){ verticalStr:function(str,sp){
if(typeof str!='string') return ''; if(typeof str!='string') return '';
return str.split('').filter(value=>value!='`').join(''); return [...str].filter(value=>value!='`').join('');
}, },
numStr:function(num,method){ numStr:function(num,method){
if(num==Infinity){ if(num==Infinity){