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();
'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();
},
ai:{
@ -157,7 +157,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
subtype:'equip1',
distance:{attackFrom:-1},
fullskin:true,
skills:['qixingbaodao'],
global:'qixingbaodao',
selectTarget:[-1,-2],
ai:{
order:9,
@ -449,7 +449,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}
},
qixingbaodao:{
trigger:{player:'equipAfter'},
trigger:{player:'equipBegin'},
forced:true,
equipSkill:true,
filter:function(event,player){
@ -694,7 +694,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){
yitianjian:'倚天剑',
yitianjian_info:'当你因执行【杀】的效果而造成伤害后若你已受伤则你可弃置一张手牌然后回复1点体力。',
qixingbaodao:'七星宝刀',
qixingbaodao_info:'锁定技。当此牌进入你的装备区,你弃置装备区和判定区内的所有其他牌。',
qixingbaodao_info:'锁定技。当此牌进入你的装备区,你弃置装备区和判定区内的所有其他牌。',
duanjian:'断剑',
duanjian_info:'这是一把坏掉的武器…',
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(){
if(trigger.name=='lose'){
trigger.cards.remove(player.getEquips('ruyijingubang'));
trigger.cards.removeArray(player.getEquips('ruyijingubang'));
}
else{
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(){
"step 0"
game.log(player,'进入了弃牌阶段');
event.num=(function(){
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());
})();
event.num=Math.max(0,player.countCards('he',card=>!player.canIgnoreHandcard(card))-player.getHandcardLimit());
if(event.num<=0) event.finish();
else{
if(lib.config.show_phase_prompt){

View File

@ -6265,16 +6265,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
phaseDiscardContent:function(){
"step 0"
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--;
}
}
num=Math.max(0,num-player.getHandcardLimit());
event.num=num;
event.num=Math.max(0,player.countCards('he',card=>!player.canIgnoreHandcard(card))-player.getHandcardLimit());
if(event.num<=0) event.finish();
else{
if(lib.config.show_phase_prompt){

View File

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