From b7578780ec65978656b17a3f49404d49a06e1fb0 Mon Sep 17 00:00:00 2001 From: Tipx-L <138244655+Tipx-L@users.noreply.github.com> Date: Sun, 27 Aug 2023 09:11:39 -0700 Subject: [PATCH] Add lib.filter.ignoredHandcard. --- card/yongjian.js | 8 ++++---- character/collab.js | 2 +- character/ddd.js | 12 +----------- character/diy.js | 11 +---------- game/game.js | 21 +++++++++++---------- 5 files changed, 18 insertions(+), 36 deletions(-) diff --git a/card/yongjian.js b/card/yongjian.js index f42767f49..ce5b6d6b3 100644 --- a/card/yongjian.js +++ b/card/yongjian.js @@ -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:'不要因为手快而装给自己。', diff --git a/character/collab.js b/character/collab.js index 5de2d131d..b2739cf66 100644 --- a/character/collab.js +++ b/character/collab.js @@ -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'); diff --git a/character/ddd.js b/character/ddd.js index 75637ccb1..c658ac347 100644 --- a/character/ddd.js +++ b/character/ddd.js @@ -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!player.canIgnoreHandcard(card))-player.getHandcardLimit()); if(event.num<=0) event.finish(); else{ if(lib.config.show_phase_prompt){ diff --git a/character/diy.js b/character/diy.js index cc31e6c90..a98a335c2 100755 --- a/character/diy.js +++ b/character/diy.js @@ -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!player.canIgnoreHandcard(card))-player.getHandcardLimit()); if(event.num<=0) event.finish(); else{ if(lib.config.show_phase_prompt){ diff --git a/game/game.js b/game/game.js index c4b46ee2a..161d3cc81 100644 --- a/game/game.js +++ b/game/game.js @@ -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!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)value!='`').join(''); + return [...str].filter(value=>value!='`').join(''); }, numStr:function(num,method){ if(num==Infinity){