From dd76e7e2b82c1849c7ebea4a1c02767f660e153c Mon Sep 17 00:00:00 2001 From: mengxinzxz <139629761+mengxinzxz@users.noreply.github.com> Date: Thu, 7 Sep 2023 12:52:01 +0800 Subject: [PATCH] canSave --- character/mobile.js | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/character/mobile.js b/character/mobile.js index 83397c84c..63cfdf2fa 100644 --- a/character/mobile.js +++ b/character/mobile.js @@ -8482,15 +8482,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ logTarget:'player', check:function(event,player){ if(get.attitude(player,event.player)<4) return false; - if(player.countCards('h',function(card){ - var mod2=game.checkMod(card,player,'unchanged','cardEnabled2',player); - if(mod2!='unchanged') return mod2; - var mod=game.checkMod(card,player,event.player,'unchanged','cardSavable',player); - if(mod!='unchanged') return mod; - var savable=get.info(card).savable; - if(typeof savable=='function') savable=savable(card,player,event.player); - return savable; - })>=1+event.num-event.player.hp) return false; + if(player.countCards('hs',card=>player.canSaveCard(card,target))>=1+event.num-event.player.hp) return false; if(event.player==player||event.player==get.zhu(player)) return true; return !player.hasUnknown(); }, @@ -10155,15 +10147,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ trigger:{global:'dying'}, check:function(event,player){ if(get.attitude(player,event.player)<4) return false; - if(player.countCards('h',function(card){ - var mod2=game.checkMod(card,player,'unchanged','cardEnabled2',player); - if(mod2!='unchanged') return mod2; - var mod=game.checkMod(card,player,event.player,'unchanged','cardSavable',player); - if(mod!='unchanged') return mod; - var savable=get.info(card).savable; - if(typeof savable=='function') savable=savable(card,player,event.player); - return savable; - })>=1-event.player.hp) return false; + if(player.countCards('hs',card=>player.canSaveCard(card,target))>=1-event.player.hp) return false; if(event.player==player||event.player==get.zhu(player)) return true; if(_status.currentPhase&&get.damageEffect(_status.currentPhase,player,player)<0) return false; return !player.hasUnknown();