diff --git a/card/standard.js b/card/standard.js index ab99d5ce1..07a473079 100644 --- a/card/standard.js +++ b/card/standard.js @@ -235,7 +235,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ if(get.cardtag(card,'yingbian_hit')){ hit=true; if(targets.some(target=>{ - return target.mayHaveShan(viewer,'use',target.getCards(i=>{ + return target.mayHaveShan(viewer,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))&&get.attitude(viewer,target)<0&&get.damageEffect(target,player,viewer,get.natureList(card))>0; })) base+=5; @@ -247,7 +247,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ } if(get.cardtag(card,'yingbian_damage')){ if(targets.some(target=>{ - return get.attitude(player,target)<0&&(hit||!target.mayHaveShan(viewer,'use',target.getCards(i=>{ + return get.attitude(player,target)<0&&(hit||!target.mayHaveShan(viewer,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))||player.hasSkillTag('directHit_ai',true,{ target:target, @@ -309,7 +309,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ if(!player.hasSkillTag('directHit_ai',true,{ target:target, card:card, - },true)) odds-=0.7*target.mayHaveShan(player,'use',target.getCards(i=>{ + },true)) odds-=0.7*target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }),'odds'); _status.event.putTempCache('sha_result','eff',{ diff --git a/character/diy.js b/character/diy.js index 0103bd2b1..10926cbce 100755 --- a/character/diy.js +++ b/character/diy.js @@ -3516,7 +3516,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ list.remove(player.storage.kyou_zhidian); player.chooseControl(list).set('prompt','掷典:请为'+get.translation(trigger.card)+'选择一种效果').set('choice',function(){ if(list.includes('不计入次数')&&player.hasSha()) return '不计入次数'; - if(list.includes('不可被响应')&&trigger.target.mayHaveShan(player,'use',trigger.target.getCards(i=>{ + if(list.includes('不可被响应')&&trigger.target.mayHaveShan(player,'use',trigger.target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))) return '不可被响应'; if(list.includes('伤害+1')) return '伤害+1'; diff --git a/character/extra.js b/character/extra.js index 4181a436d..bd169dfdc 100755 --- a/character/extra.js +++ b/character/extra.js @@ -1261,7 +1261,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } } var hasRuanshizi=game.hasPlayer(function(target){ - return target!=player&&player.canUse('sha',target,null,true)&&!target.mayHaveShan(player,'use',target.getCards(i=>{ + return target!=player&&player.canUse('sha',target,null,true)&&!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))&&get.attitude(player,target)<0&&get.effect(target,{name:'sha'},player,player)>0; }) diff --git a/character/huicui.js b/character/huicui.js index c70fb88f0..bdb4c7225 100644 --- a/character/huicui.js +++ b/character/huicui.js @@ -4843,26 +4843,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.chooseToDiscard('he',get.prompt('dccuijin',target),'弃置一张牌并令'+get.translation(trigger.player)+'使用的【杀】伤害+1,但若其未造成伤害,则你摸一张牌并对其造成1点伤害。').set('ai',function(card){ if(_status.event.goon) return 7-get.value(card); return 0; - }).set('goon',function(){ - var d1=true; - if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false - for(var target of trigger.targets){ - if(!target.mayHaveShan(player,'use',target.getCards(i=>{ - return i.hasGaintag('sha_notshan'); - }))||trigger.player.hasSkillTag('directHit_ai',true,{ - target:target, - card:trigger.card, - },true)){ - if(!target.hasSkill('gangzhi')) d1=false; - if(!target.hasSkillTag('filterDamage',null,{ - player:trigger.player, - card:trigger.card, - })&&get.attitude(player,target)<0) return true; - } - } - if(d1) return get.damageEffect(trigger.player,player,player)>0; - return false; - }()).logSkill=['dccuijin',target]; + }).set('goon',lib.skill.cuijin.checkx(trigger,player)).logSkill=['dccuijin',target]; 'step 1' if(result.bool){ if(typeof trigger.baseDamage!='number') trigger.baseDamage=1; @@ -11128,7 +11109,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ let ph=player.countCards('h'); if(game.hasPlayer(i=>{ if(!player.canUse('sha',i,true,true)||get.effect(i,{name:'sha'},player,player)<=0) return false; - return !ph||!i.mayHaveShan(player,'use',i.getCards(i=>{ + return !ph||!i.mayHaveShan(player,'use',i.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); })); })) return 1; diff --git a/character/jsrg.js b/character/jsrg.js index 7d55c92d6..2e6d32c4c 100644 --- a/character/jsrg.js +++ b/character/jsrg.js @@ -4270,7 +4270,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ result:{ target:function(player,target){ var eff=get.effect(target,{name:'sha',nature:'fire'},player,target)/30; - if(!target.mayHaveShan(player,'use',target.getCards(i=>{ + if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))) eff*=2; var del=target.countCards('h')-player.countCards('h')+1.5; @@ -7124,7 +7124,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(_status.event.all) return 1; if(ui.selected.buttons.length) return 0; return Math.random(); - }).set('all',!target.mayHaveShan(player,'use',target.getCards(i=>{ + }).set('all',!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))&&Math.random()<0.75).set('forceAuto',true); 'step 1' diff --git a/character/mobile.js b/character/mobile.js index 9ae621558..e46866bd2 100644 --- a/character/mobile.js +++ b/character/mobile.js @@ -9137,7 +9137,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ]).set('ai',function(){ var target=_status.event.getTrigger().target; var player=_status.event.player; - var num=target.mayHaveShan(player,'use',target.getCards(i=>{ + var num=target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))?0:1; if(get.attitude(player,target)>0) num=1-num; diff --git a/character/offline.js b/character/offline.js index 7f3019a92..bb204584c 100644 --- a/character/offline.js +++ b/character/offline.js @@ -168,7 +168,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ d1=true; if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false; for(var target of trigger.targets){ - if(!target.mayHaveShan(player,'use',target.getCards(i=>{ + if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))||trigger.player.hasSkillTag('directHit_ai',true,{ target:target, @@ -299,7 +299,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var effect=0; for(var target of trigger.targets){ var eff=get.effect(target,trigger.card,trigger.player,player); - if(!target.mayHaveShan(player,'use',target.getCards(i=>{ + if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))||trigger.player.hasSkillTag('directHit_ai',true,{ target:target, diff --git a/character/refresh.js b/character/refresh.js index efd96ef7a..de6503b6c 100755 --- a/character/refresh.js +++ b/character/refresh.js @@ -11142,7 +11142,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!target.isHealthy()) club+=2; if(!club&&!spade) return 1; if(name==='sha'){ - if(!target.mayHaveShan(player,'use',target.getCards(i=>{ + if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))) return; } diff --git a/character/shenhua.js b/character/shenhua.js index dc2054c5a..8762ece9a 100755 --- a/character/shenhua.js +++ b/character/shenhua.js @@ -3676,7 +3676,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ ai:{ effect:{ target:function(card,player,target,current){ - if(typeof card==='object'&&get.name(card)==='sha'&&target.mayHaveShan(player,'use',target.getCards(i=>{ + if(typeof card==='object'&&get.name(card)==='sha'&&target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))) return [0.6,0.75]; if(!target.hasFriend()&&!player.hasUnknown()) return; @@ -6221,7 +6221,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!target.isHealthy()) club+=2; if(!club&&!spade) return 1; if(card.name==='sha'){ - if(!target.mayHaveShan(player,'use',target.getCards(i=>{ + if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))) return; } @@ -7209,7 +7209,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ return get.attitude(target,current)<0&&get.damageEffect(current,target,target,'thunder')>0; })){ if(card.name==='sha'){ - if(!target.mayHaveShan(player,'use',target.getCards(i=>{ + if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))) return; } diff --git a/character/sp.js b/character/sp.js index 28aaed999..75acc6de9 100755 --- a/character/sp.js +++ b/character/sp.js @@ -5479,7 +5479,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ if(!player.hasSkillTag('directHit_ai',true,{ target:target, card:card, - },true)) odds-=0.7*target.mayHaveShan(player,'use',target.getCards(i=>{ + },true)) odds-=0.7*target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }),'odds'); _status.event.putTempCache('sha_result','eff',{ @@ -7275,7 +7275,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ } else{ var target=trigger.target; - if(trigger.targets.length>1||target.mayHaveShan(player,'use',target.getCards(i=>{ + if(trigger.targets.length>1||target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))) return 0; } @@ -14777,7 +14777,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ else if(get.tag(card,'respondShan')>0){ if(current<0&&used==target.getAttackRange()-1){ if(card.name==='sha'){ - if(!target.mayHaveShan(player,'use',target.getCards(i=>{ + if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))) return; } diff --git a/character/sp2.js b/character/sp2.js index decad8e61..2a919a7a3 100644 --- a/character/sp2.js +++ b/character/sp2.js @@ -5030,7 +5030,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ })) return 3; return Math.sqrt(target.countCards('he')); } - if(target.mayHaveShan(player,'use',target.getCards(i=>{ + if(target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))&&player.countCards('hs',function(card){ return !ui.selected.cards.includes(card)&&get.name(card)=='sha'&&player.canUse(card,target)&&get.effect(target,card,player,player)!=0; @@ -5364,7 +5364,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.addSkill('mouni2'); player.chooseTarget(get.prompt2('mouni'),lib.filter.notMe).set('ai',function(target){ var player=_status.event.player,cards=player.getCards('h','sha'); - if(get.attitude(player,target)>=0||!player.canUse(cards[0],target,false)||(!player.hasJudge('lebu')&&target.mayHaveShan(player,'use',target.getCards(i=>{ + if(get.attitude(player,target)>=0||!player.canUse(cards[0],target,false)||(!player.hasJudge('lebu')&&target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))&&!player.hasSkillTag('directHit_ai',true,{ target:target, diff --git a/character/tw.js b/character/tw.js index 7937f6deb..226a042eb 100644 --- a/character/tw.js +++ b/character/tw.js @@ -1095,7 +1095,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ }).set('goon',function(){ var d1=true; if(player.hasSkill('jueqing')||player.hasSkill('gangzhi')) d1=false; - if(!target.mayHaveShan(player,'use',target.getCards(i=>{ + if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))||player.hasSkillTag('directHit_ai',true,{ target:target, @@ -3697,7 +3697,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ expose:0.2, result:{ target:function(player,target){ - if(target.countCards('h')<=target.hp&&!target.mayHaveShan(player,'use',target.getCards(i=>{ + if(target.countCards('h')<=target.hp&&!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))&&get.effect(target,{name:'sha',isCard:true},player,player)>0) return -1; else if(target.countCards('h')>target.hp&&target.hp>2&&target.hasShan()) return 1; @@ -7273,7 +7273,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var player=_status.event.player; if(player.hp+player.countCards('hs',{name:['tao','jiu']})<=1) return -1; var num=1; - if((!target.mayHaveShan(player,'use',target.getCards(i=>{ + if((!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))||player.hasSkillTag('directHit_ai',true,{ target:target, @@ -11796,7 +11796,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ var d1=true; if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false; for(var target of trigger.targets){ - if(!target.mayHaveShan(player,'use',target.getCards(i=>{ + if(!target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))||trigger.player.hasSkillTag('directHit_ai',true,{ target:target, @@ -13986,6 +13986,31 @@ game.import('character',function(lib,game,ui,get,ai,_status){ filter:function(event,player){ return event.card.name=='sha'&&(event.player==player||player.inRange(event.player))&&player.countCards('he')>0; }, + checkx(event,player){ + let d1=true,e=false; + if(event.player.hasSkill('jueqing')||event.player.hasSkill('gangzhi')) d1=false; + for(let tar of event.targets){ + if(!tar.mayHaveShan(player,'use',tar.getCards('h',i=>{ + return i.hasGaintag('sha_notshan'); + }))||event.player.hasSkillTag('directHit_ai',true,{ + target:tar, + card:event.card, + },true)){ + if(!tar.hasSkill('gangzhi')) d1=false; + if(!tar.hasSkillTag('filterDamage',null,{ + player:event.player, + card:event.card, + })){ + let att=get.attitude(_status.event.player,tar); + if(att>0) return false; + if(att<0) e=true; + } + } + } + if(e) return true; + if(d1) return get.damageEffect(event.player,player,_status.event.player)>0; + return false; + }, content:function(){ 'step 0' if(player!=game.me&&!player.isOnline()) game.delayx(); @@ -13994,26 +14019,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ player.chooseToDiscard('he',get.prompt('cuijin',target),'弃置一张牌并令'+get.translation(trigger.player)+'使用的【杀】伤害+1,但若其未造成伤害,则你对其造成1点伤害。').set('ai',function(card){ if(_status.event.goon) return 7-get.value(card); return 0; - }).set('goon',function(){ - var d1=true; - if(trigger.player.hasSkill('jueqing')||trigger.player.hasSkill('gangzhi')) d1=false - for(var target of trigger.targets){ - if(!target.mayHaveShan(player,'use',target.getCards(i=>{ - return i.hasGaintag('sha_notshan'); - }))||trigger.player.hasSkillTag('directHit_ai',true,{ - target:target, - card:trigger.card, - },true)){ - if(!target.hasSkill('gangzhi')) d1=false; - if(!target.hasSkillTag('filterDamage',null,{ - player:trigger.player, - card:trigger.card, - })&&get.attitude(player,target)<0) return true; - } - } - if(d1) return get.damageEffect(trigger.player,player,player)>0; - return false; - }()).logSkill=['cuijin',target]; + }).set('goon',lib.skill.cuijin.checkx(trigger,player)).logSkill=['cuijin',target]; 'step 1' if(result.bool){ if(typeof trigger.baseDamage!='number') trigger.baseDamage=1; diff --git a/character/yijiang.js b/character/yijiang.js index cf811ec54..0bd4041af 100755 --- a/character/yijiang.js +++ b/character/yijiang.js @@ -2228,7 +2228,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){ case 2:{ var num=1.3; if(event.card.name=='sha'&&event.targets.filter(function(current){ - if(current.mayHaveShan(player,'use',current.getCards(i=>{ + if(current.mayHaveShan(player,'use',current.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))&&get.attitude(player,current)<=0){ if(current.hasSkillTag('useShan')) num=1.9; diff --git a/mode/guozhan.js b/mode/guozhan.js index 5822819e7..7ca75e0b6 100644 --- a/mode/guozhan.js +++ b/mode/guozhan.js @@ -3529,7 +3529,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ ]).set('prompt',get.prompt('gzliegong',trigger.target)).setHiddenSkill('gzliegong').set('ai',function(){ var player=_status.event.player,target=_status.event.getTrigger().target; if(get.attitude(player,target)>0) return 2; - return target.mayHaveShan(player,'use',target.getCards(i=>{ + return target.mayHaveShan(player,'use',target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))?1:0; }); @@ -10657,7 +10657,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){ goon=false; } else if(trigger.card.name=='sha'){ - if(trigger.target.mayHaveShan(player,'use',trigger.target.getCards(i=>{ + if(trigger.target.mayHaveShan(player,'use',trigger.target.getCards('h',i=>{ return i.hasGaintag('sha_notshan'); }))||trigger.target.hp>=3){ goon=false; diff --git a/noname/library/element/player.js b/noname/library/element/player.js index e5a44d4fa..11032e4ed 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -68,7 +68,7 @@ export class Player extends HTMLDivElement { const addedNodes = Array.from(mutation.addedNodes); const removedNodes = Array.from(mutation.removedNodes); // @ts-ignore - if(addedNodes.some(card=>!card.classList.contains('emptyequip')) || + if(addedNodes.some(card=>!card.classList.contains('emptyequip')) || // @ts-ignore removedNodes.some(card=>!card.classList.contains('emptyequip'))){ player.$handleEquipChange(); @@ -215,16 +215,16 @@ export class Player extends HTMLDivElement { */ stat; /** - * @type { { - * useCard: GameEventPromise[], - * respond: GameEventPromise[], - * skipped: GameEventPromise[], - * lose: GameEventPromise[], - * gain: GameEventPromise[], - * sourceDamage: GameEventPromise[], - * damage: GameEventPromise[], - * custom: GameEventPromise[], - * useSkill: GameEventPromise[], + * @type { { + * useCard: GameEventPromise[], + * respond: GameEventPromise[], + * skipped: GameEventPromise[], + * lose: GameEventPromise[], + * gain: GameEventPromise[], + * sourceDamage: GameEventPromise[], + * damage: GameEventPromise[], + * custom: GameEventPromise[], + * useSkill: GameEventPromise[], * }[] } */ actionHistory; @@ -336,8 +336,8 @@ export class Player extends HTMLDivElement { //新函数 /** * 怒气 - * @param { number } amount - * @param { boolean } [limit] + * @param { number } amount + * @param { boolean } [limit] */ changeFury(amount, limit) { if (typeof this.storage.stratagem_fury != 'number') this.storage.stratagem_fury = 0; @@ -352,11 +352,11 @@ export class Player extends HTMLDivElement { } /** * version 1.7 - * + * * 链式创建一次性技能的api。 * * 使用者只需要关注技能的效果,而不是技能的本身。 - * + * * v1.7 可传递作用域 * @example * ```js @@ -510,7 +510,7 @@ export class Player extends HTMLDivElement { _status.postReconnect.player_when[1][skillName] = true; return { /** - * @param { Required['filter'] } fun + * @param { Required['filter'] } fun */ filter(fun) { if (lib.skill[skillName] != skill) throw `This skill has been destroyed`; @@ -518,7 +518,7 @@ export class Player extends HTMLDivElement { return this; }, /** - * @param { Required['filter'] } fun + * @param { Required['filter'] } fun */ removeFilter(fun) { if (lib.skill[skillName] != skill) throw `This skill has been destroyed`; @@ -526,7 +526,7 @@ export class Player extends HTMLDivElement { return this; }, /** - * @param { Required['filter'] } fun + * @param { Required['filter'] } fun */ filter2(fun) { if (lib.skill[skillName] != skill) throw `This skill has been destroyed`; @@ -534,7 +534,7 @@ export class Player extends HTMLDivElement { return this; }, /** - * @param { Required['filter'] } fun + * @param { Required['filter'] } fun */ removeFilter2(fun) { if (lib.skill[skillName] != skill) throw `This skill has been destroyed`; @@ -542,7 +542,7 @@ export class Player extends HTMLDivElement { return this; }, /** - * @param { Required['content'] } fun + * @param { Required['content'] } fun */ then(fun) { if (lib.skill[skillName] != skill) throw `This skill has been destroyed`; @@ -551,7 +551,7 @@ export class Player extends HTMLDivElement { return this; }, /** - * @param { string } str + * @param { string } str */ popup(str) { if (lib.skill[skillName] != skill) throw `This skill has been destroyed`; @@ -559,7 +559,7 @@ export class Player extends HTMLDivElement { return this; }, /** - * @param { string } translation + * @param { string } translation */ translation(translation) { if (lib.skill[skillName] != skill) throw `This skill has been destroyed`; @@ -570,7 +570,7 @@ export class Player extends HTMLDivElement { return this; }, /** - * @param { SMap } obj + * @param { SMap } obj */ assign(obj) { if (lib.skill[skillName] != skill) throw `This skill has been destroyed`; @@ -578,7 +578,7 @@ export class Player extends HTMLDivElement { return this; }, /** - * @param { SMap } arg + * @param { SMap } arg */ vars(arg) { if (lib.skill[skillName] != skill) throw `This skill has been destroyed`; @@ -589,12 +589,12 @@ export class Player extends HTMLDivElement { }, /** * 传递外部作用域 - * + * * 一般是传递一个 code=>eval(code) 函数 - * + * * 传递后可在then中使用外部变量(vars的上位替代) - * - * @param {Function} _scope + * + * @param {Function} _scope */ apply(_scope) { if (lib.skill[skillName] != skill) throw `This skill has been destroyed`; @@ -650,8 +650,8 @@ export class Player extends HTMLDivElement { } /** * 获取该角色被other所知的牌 - * @param { Player } [other] - * @param { (card: Card) => boolean } [filter] + * @param { Player } [other] + * @param { (card: Card) => boolean } [filter] */ getKnownCards(other = _status.event.player, filter = card => true) { if (!other) other = this; @@ -661,7 +661,7 @@ export class Player extends HTMLDivElement { } /** * 判断此角色的手牌是否已经被看光了 - * @param { Player } [other] + * @param { Player } [other] */ isAllCardsKnown(other = _status.event.player) { if (!other) other = this; @@ -671,8 +671,8 @@ export class Player extends HTMLDivElement { } /** * 判断此角色是否有被知的牌。 - * @param { Player } [other] - * @param { (card: Card) => boolean } [filter] + * @param { Player } [other] + * @param { (card: Card) => boolean } [filter] */ hasKnownCards(other = _status.event.player, filter = card => true) { if (!other) other = this; @@ -682,21 +682,21 @@ export class Player extends HTMLDivElement { } /** * 数此角色被知道的牌 - * @param { Player } [other] - * @param { (card: Card) => boolean } [filter] + * @param { Player } [other] + * @param { (card: Card) => boolean } [filter] */ countKnownCards(other, filter) { return this.getKnownCards(other, filter).length; } /** * Execute the delay card effect - * + * * 执行延时锦囊牌效果 - * @param { Card | string } card - * @param { Player } target - * @param {*} judge - * @param {*} judge2 - * @returns + * @param { Card | string } card + * @param { Player } target + * @param {*} judge + * @param {*} judge2 + * @returns */ executeDelayCardEffect(card, target, judge, judge2) { const executeDelayCardEffect = game.createEvent('executeDelayCardEffect'); @@ -719,7 +719,7 @@ export class Player extends HTMLDivElement { } /** * Check if the card does not count toward hand limit - * + * * 检测此牌是否不计入手牌上限 * @param { Card } card */ @@ -729,10 +729,10 @@ export class Player extends HTMLDivElement { //Gift /** * Gift - * + * * 赠予 - * @param { Card | Card[] } cards - * @param { Player } target + * @param { Card | Card[] } cards + * @param { Player } target */ gift(cards, target) { const gift = game.createEvent('gift'); @@ -749,21 +749,21 @@ export class Player extends HTMLDivElement { } /** * Check if the player can gift the card - * + * * 检测角色是否能赠予此牌 - * @param { Card } card - * @param { Player } target - * @param { boolean } [strict] + * @param { Card } card + * @param { Player } target + * @param { boolean } [strict] */ canGift(card, target, strict) { return lib.filter.cardGiftable(card, this, target, strict); } /** * Check if the player refuses gifts - * + * * 检测角色是否拒绝赠予 - * @param { Card } card - * @param { Player } player + * @param { Card } card + * @param { Player } player */ refuseGifts(card, player) { return this.hasSkillTag('refuseGifts', null, { @@ -773,10 +773,10 @@ export class Player extends HTMLDivElement { } /** * Gift AI related - * + * * 赠予AI相关 - * @param { Card } card - * @param { Player } target + * @param { Card } card + * @param { Player } target */ getGiftAIResultTarget(card, target) { if (!card || target.refuseGifts(card, this)) return 0; @@ -786,8 +786,8 @@ export class Player extends HTMLDivElement { return Math.max(1, get.value(card, this) - get.value(card, target)); } /** - * @param { Card } card - * @param { Player } target + * @param { Card } card + * @param { Player } target */ getGiftEffect(card, target) { return this.getGiftAIResultTarget(card, target) * get.attitude(this, target); @@ -795,9 +795,9 @@ export class Player extends HTMLDivElement { //Recast /** * 重铸 - * @param { Card | Card[] } cards - * @param { (player: Player, cards: Card[]) => any } [recastingLose] - * @param { (player: Player, cards: Card[]) => any } [recastingGain] + * @param { Card | Card[] } cards + * @param { (player: Player, cards: Card[]) => any } [recastingLose] + * @param { (player: Player, cards: Card[]) => any } [recastingGain] */ recast(cards, recastingLose = (player, cards) => player.loseToDiscardpile(cards).log = false, @@ -820,11 +820,11 @@ export class Player extends HTMLDivElement { } /** * Check if the player can recast the card - * + * * 检测角色是否能重铸此牌 - * @param { Card } card - * @param { Player } [source] - * @param { boolean } [strict] + * @param { Card } card + * @param { Player } [source] + * @param { boolean } [strict] */ canRecast(card, source, strict) { return lib.filter.cardRecastable(card, this, source, strict); @@ -832,9 +832,9 @@ export class Player extends HTMLDivElement { //装备栏相关 /** * 判断一名角色的某个区域是否被废除 - * + * * type为要判断的区域 若为空 则判断玩家是否有任意一个被废除的区域 - * @param { string | number } [type] + * @param { string | number } [type] * @returns { boolean } */ hasDisabledSlot(type) { @@ -848,9 +848,9 @@ export class Player extends HTMLDivElement { } /** * 判断一名角色的某个区域被废除的数量 - * + * * 用法同 {@link hasDisabledSlot} - * @param { string | number } [type] + * @param { string | number } [type] */ countDisabledSlot(type) { const map = (this.disabledSlots || {}); @@ -874,7 +874,7 @@ export class Player extends HTMLDivElement { } /** * 判断一名角色是否有某个装备栏空着 - * @param { string | number } [type] + * @param { string | number } [type] * @returns { boolean } */ hasEmptySlot(type) { @@ -888,7 +888,7 @@ export class Player extends HTMLDivElement { } /** * 判断一名角色的某个装备栏空位的数量 - * @param { string | number } [type] + * @param { string | number } [type] */ countEmptySlot(type) { if (!type) return 0; @@ -903,18 +903,18 @@ export class Player extends HTMLDivElement { } /** * 判断一名角色是否有可以用于装备新装备牌的区域(排除金箍棒和六龙等“不可被替换装备”) - * + * * 用法同 {@link hasEnabledSlot} - * @param { string | number } [type] + * @param { string | number } [type] */ hasEquipableSlot(type) { return this.countEquipableSlot(type) > 0; } /** * 统计一名角色有多少个可以用于装备新的装备牌的区域 - * + * * 用法同 {@link hasEnabledSlot} - * @param { string | number } [type] + * @param { string | number } [type] */ countEquipableSlot(type) { if (!type) return 0; @@ -933,9 +933,9 @@ export class Player extends HTMLDivElement { } /** * 判断一名角色是否拥有未被废除的某个区域 - * + * * type为要判断的区域 若为空 则判断玩家是否有任意一个未被废除的区域 - * @param { string | number } [type] + * @param { string | number } [type] * @returns { boolean } */ hasEnabledSlot(type) { @@ -952,9 +952,9 @@ export class Player extends HTMLDivElement { } /** * 判断一名角色的某个区域未被废除的数量 - * + * * 用法同 {@link hasEnabledSlot} - * @param { string | number } [type] + * @param { string | number } [type] */ countEnabledSlot(type) { const map = (this.expandedSlots || {}); @@ -980,9 +980,9 @@ export class Player extends HTMLDivElement { } /** * 获取一名角色装备区内某种类型的装备牌 - * + * * 参数可以为数字/区域字符串/实体牌/虚拟牌/牌名 - * @param { number | string | Card | VCard } subtype + * @param { number | string | Card | VCard } subtype * @returns { Card[] } */ getEquips(subtype) { @@ -1018,7 +1018,7 @@ export class Player extends HTMLDivElement { } /** * 新的废除装备区 - * + * * 参数:废除来源角色(不写默认当前事件角色),废除区域(数字/区域字符串/数组,可以写多个,重复废除) */ disableEquip() { @@ -1055,7 +1055,7 @@ export class Player extends HTMLDivElement { } /** * 新的恢复装备区 - * + * * 参数:恢复来源角色(不写默认当前事件角色),恢复区域(数字/区域字符串/数组,可以写多个,重复恢复) */ enableEquip() { @@ -1092,7 +1092,7 @@ export class Player extends HTMLDivElement { } /** * 新的扩展装备区 - * + * * 参数:扩展来源角色(不写默认当前事件角色),扩展区域(数字/区域字符串/数组,可以写多个,重复扩展) */ expandEquip() { @@ -1135,7 +1135,7 @@ export class Player extends HTMLDivElement { } /** * 同步显示扩展装备区状态 - * @param { SMap } [map] + * @param { SMap } [map] */ $syncExpand(map) { if (!map) { @@ -1150,7 +1150,7 @@ export class Player extends HTMLDivElement { } /** * 同步装备区废除牌显示状态 - * @param { SMap } [map] + * @param { SMap } [map] */ $syncDisable(map) { const suits = { equip3: '+1马栏', equip4: '-1马栏', equip6: '特殊栏' }; @@ -1215,9 +1215,9 @@ export class Player extends HTMLDivElement { } //以下函数涉及到本次更新内容而进行修改 /** - * @param { string | Card | VCard | CardBaseUIData } name - * @param { boolean } [replace] - * @returns + * @param { string | Card | VCard | CardBaseUIData } name + * @param { boolean } [replace] + * @returns */ canEquip(name, replace) { const ranges = get.subtypes(name), rangex = [], combined = get.is.mountCombined(); @@ -1284,9 +1284,9 @@ export class Player extends HTMLDivElement { } /** * 向target发起协力 - * @param { Player } target - * @param {*} type - * @param {*} reason + * @param { Player } target + * @param {*} type + * @param {*} reason */ cooperationWith(target, type, reason) { if (!this.storage.cooperation) this.storage.cooperation = []; @@ -1349,7 +1349,7 @@ export class Player extends HTMLDivElement { } /** * @param { string } clan 氏族名称 - * @param { boolean } unseen 是否无视暗将的限制 + * @param { boolean } unseen 是否无视暗将的限制 */ hasClan(clan, unseen) { if (unseen || !this.isUnseen(0)) { @@ -1371,7 +1371,7 @@ export class Player extends HTMLDivElement { return false; } /** - * @param { string } skill + * @param { string } skill */ changeZhuanhuanji(skill) { let info = get.info(skill), zhuanhuan = info.zhuanhuanji; @@ -1383,7 +1383,7 @@ export class Player extends HTMLDivElement { }, this, skill); } /** - * @param { string } skill + * @param { string } skill */ $changeZhuanhuanji(skill) { var mark = this.marks[skill]; @@ -1404,7 +1404,7 @@ export class Player extends HTMLDivElement { } } /** - * @param { number } num + * @param { number } num */ setSeatNum(num) { _status.seatNumSettled = true; @@ -1418,7 +1418,7 @@ export class Player extends HTMLDivElement { } /** * 是否拥有某一性别 - * @param { string } sex + * @param { string } sex */ hasSex(sex) { if (this.sex == 'unknown') return false; @@ -1427,7 +1427,7 @@ export class Player extends HTMLDivElement { } /** * 是否和target同一性别 - * @param { Player } target + * @param { Player } target */ sameSexAs(target) { const sex1 = this.sex, sex2 = target.sex; @@ -1437,7 +1437,7 @@ export class Player extends HTMLDivElement { } /** * 是否和target不同性别 - * @param { Player } target + * @param { Player } target */ differentSexFrom(target) { var sex1 = this.sex, sex2 = target.sex; @@ -1446,14 +1446,14 @@ export class Player extends HTMLDivElement { return sex1 != sex2; } /** - * @param { string } skill + * @param { string } skill */ addSkillBlocker(skill) { if (!this.storage.skill_blocker) this.storage.skill_blocker = []; this.storage.skill_blocker.push(skill); } /** - * @param { string } skill + * @param { string } skill */ removeSkillBlocker(skill) { if (this.storage.skill_blocker) { @@ -1480,8 +1480,8 @@ export class Player extends HTMLDivElement { return next; } /** - * @param { Card | Card[] } cards - * @param { string } tag + * @param { Card | Card[] } cards + * @param { string } tag */ addGaintag(cards, tag) { if (get.itemtype(cards) == 'card') cards = [cards]; @@ -1494,8 +1494,8 @@ export class Player extends HTMLDivElement { }, this, cards, tag); } /** - * @param { string } tag - * @param { Card[] } [cards] + * @param { string } tag + * @param { Card[] } [cards] */ removeGaintag(tag, cards) { cards = cards || this.getCards('h'); @@ -1505,7 +1505,7 @@ export class Player extends HTMLDivElement { }, this, tag, cards); } /** - * @param { Player } target + * @param { Player } target */ canSave(target) { if (this.hasSkillTag('save', true, target, true)) return true; @@ -1519,8 +1519,8 @@ export class Player extends HTMLDivElement { return false; } /** - * @param { Card } card - * @param { Player } target + * @param { Card } card + * @param { Player } target */ canSaveCard(card, target) { const mod2 = game.checkMod(card, this, 'unchanged', 'cardEnabled2', this); @@ -1532,8 +1532,8 @@ export class Player extends HTMLDivElement { return savable; } /** - * @param { 0 | 1 | 2 } num - * @param { false } [log] + * @param { 0 | 1 | 2 } num + * @param { false } [log] */ showCharacter(num, log) { var toShow = []; @@ -1554,8 +1554,8 @@ export class Player extends HTMLDivElement { return next; } /** - * @param { 0 | 1 | 2 } num - * @param { false } [log] + * @param { 0 | 1 | 2 } num + * @param { false } [log] */ $showCharacter(num, log) { if (num == 0 && !this.isUnseen(0)) { @@ -1666,9 +1666,9 @@ export class Player extends HTMLDivElement { return next; } /** - * @param { Player } target - * @param { string } name - * @param {*} rotate + * @param { Player } target + * @param { string } name + * @param {*} rotate */ $throwEmotion(target, name, rotate) { game.addVideo('throwEmotion', this, [target.dataset.position, name]); @@ -1712,7 +1712,7 @@ export class Player extends HTMLDivElement { }, 600); } /** - * @param { boolean } bool + * @param { boolean } bool */ tryJudgeAnimate(bool) { game.broadcast(function (player, bool) { @@ -1722,9 +1722,9 @@ export class Player extends HTMLDivElement { else this.popup('判定失效', 'fire', false); } /** - * @param { string } name - * @param { string } popname - * @param { 'main' | 'vice' | boolean } checkShow + * @param { string } name + * @param { string } popname + * @param { 'main' | 'vice' | boolean } checkShow */ trySkillAnimate(name, popname, checkShow) { if (!game.online && lib.config.skill_animation_type != 'off' && lib.skill[name] && lib.skill[name].skillAnimation) { @@ -1751,10 +1751,10 @@ export class Player extends HTMLDivElement { } } /** - * @param { Card } card - * @param { string } name - * @param { string } [nature] - * @param { string } [popname] + * @param { Card } card + * @param { string } name + * @param { string } [nature] + * @param { string } [popname] */ tryCardAnimate(card, name, nature, popname) { game.broadcast(function (player, card, name, nature, popname) { @@ -1770,7 +1770,7 @@ export class Player extends HTMLDivElement { } } /** - * @param { string } name + * @param { string } name */ hasUsableCard(name) { if (this.countCards('hs', name)) return true; @@ -1792,7 +1792,7 @@ export class Player extends HTMLDivElement { } } /** - * @param { Player } to + * @param { Player } to * @returns { boolean } */ inRange(to) { @@ -1868,33 +1868,33 @@ export class Player extends HTMLDivElement { return m <= range; } /** - * @param { Player } source + * @param { Player } source */ inRangeOf(source) { return source.inRange(this); } /** * Get the player's HP not less than 0. Set “raw” to true to get the player's raw HP instead. - * + * * 获取角色的体力值。设置“raw”为true以获取角色的体力。 - * - * @param { boolean } [raw] + * + * @param { boolean } [raw] */ getHp(raw) { return raw ? this.hp : Math.max(0, this.hp); } /** * Set “raw” to true to get the player's raw damaged HP instead. - * + * * 设置“raw”为true以获取角色已损失的体力。 - * - * @param { boolean } [raw] + * + * @param { boolean } [raw] */ getDamagedHp(raw) { return this.maxHp - this.getHp(raw); } /** - * @param { string } group + * @param { string } group */ changeGroup(group, log, broadcast) { var next = game.createEvent('changeGroup'); @@ -1916,7 +1916,7 @@ export class Player extends HTMLDivElement { return next; } /** - * @param { Player } target + * @param { Player } target */ chooseToDuiben(target) { var next = game.createEvent('chooseToDuiben'); @@ -1926,7 +1926,7 @@ export class Player extends HTMLDivElement { return next; } /** - * @param { Player } target + * @param { Player } target */ chooseToPSS(target) { var next = game.createEvent('chooseToPSS'); @@ -1942,7 +1942,7 @@ export class Player extends HTMLDivElement { return next; } /** - * @param { boolean } [horse] + * @param { boolean } [horse] */ chooseToDisable(horse) { var next = game.createEvent('chooseToDisable'); @@ -1952,7 +1952,7 @@ export class Player extends HTMLDivElement { return next; } /** - * @param { boolean } [notmeisok] + * @param { boolean } [notmeisok] */ isPhaseUsing(notmeisok) { if (!notmeisok && _status.currentPhase != this) return false; @@ -1960,7 +1960,7 @@ export class Player extends HTMLDivElement { return _status.event.name == 'phaseUse' || _status.event.getParent('phaseUse').name == 'phaseUse'; } /** - * @param { Player } target + * @param { Player } target */ swapEquip(target) { var next = game.createEvent('swapEquip'); @@ -1970,9 +1970,9 @@ export class Player extends HTMLDivElement { return next; } /** - * @param { Player } target - * @param { boolean } [goon] - * @param { boolean} [bool] + * @param { Player } target + * @param { boolean } [goon] + * @param { boolean} [bool] */ canCompare(target, goon, bool) { if (this == target) return false; @@ -2994,7 +2994,7 @@ export class Player extends HTMLDivElement { else if (count < num) this.addMark(name, num - count, log); } /** - * @param {*} i + * @param {*} i * @returns { number } */ countMark(i) { @@ -3252,7 +3252,7 @@ export class Player extends HTMLDivElement { for (let i = 0; i < arg1.length; i++) { if (arg1[i] == 'h') { for(let card of get.iterableChildNodes(this.node.handcards1,this.node.handcards2)){ - if(!card.classList.contains('removing') + if(!card.classList.contains('removing') && !card.classList.contains('glows') && filter(card)){ yield card; } @@ -3260,8 +3260,8 @@ export class Player extends HTMLDivElement { } else if (arg1[i] == 's') { for(let card of get.iterableChildNodes(this.node.handcards1,this.node.handcards2)){ - if (!card.classList.contains('removing') - && card.classList.contains('glows') + if (!card.classList.contains('removing') + && card.classList.contains('glows') && filter(card)) { yield card; } @@ -3269,8 +3269,8 @@ export class Player extends HTMLDivElement { } else if (arg1[i] == 'e') { for(let card of get.iterableChildNodes(this.node.equips)){ - if(!card.classList.contains('removing') - && !card.classList.contains('feichu') + if(!card.classList.contains('removing') + && !card.classList.contains('feichu') && !card.classList.contains('emptyequip') && filter(card)){ yield card; @@ -7512,11 +7512,11 @@ export class Player extends HTMLDivElement { else{ if (this.hasSkill(skill) && this.tempSkills[skill] == undefined) return; this.addSkill(skill, checkConflict, true, true); - + if (!expire) expire = { global: ['phaseAfter', 'phaseBeforeStart'] }; else if (typeof expire == 'string' || Array.isArray(expire)) expire = { global: expire }; this.tempSkills[skill] = expire; - + if (get.objtype(expire) == 'object') { const roles = ['player', 'source', 'target', 'global']; for (const i of roles) { @@ -7537,9 +7537,9 @@ export class Player extends HTMLDivElement { else{ if (this.isTempBanned(skill)) return; this.setStorage(`temp_ban_${skill}`, true); - + if (log !== false && this.hasSkill(skill)) game.log(this, '的技能', `#g【${get.translation(skill)}】`, '暂时失效了'); - + if (!expire) expire = { global: ['phaseAfter', 'phaseBeforeStart'] }; else if (typeof expire == 'string' || Array.isArray(expire)) expire = { global: expire }; this.when(expire).assign({ @@ -8456,7 +8456,7 @@ export class Player extends HTMLDivElement { else if (get.itemtype(ignore) === 'card') selected.add(ignore); if (this === viewer || get.itemtype(viewer) == 'player') cards = this.getKnownCards(viewer); else cards = this.getShownCards(); - cards = cards.filter(card => { + count += cards.filter(card => { if (selected.includes(card)) return false; let name = get.name(card, this); if (name == 'sha' || name == 'hufu' || name == 'yuchanqian') { @@ -8465,8 +8465,7 @@ export class Player extends HTMLDivElement { return true; } return false; - }); - count += cards.length; + }).length; if (count && rvt !== 'count') return rvt === 'odds' ? 1 : true; let hs = this.getCards('hs').filter(i => !cards.includes(i)).length; if (!hs) { @@ -8501,7 +8500,7 @@ export class Player extends HTMLDivElement { else if (get.itemtype(ignore) === 'card') selected.add(ignore); if (this === viewer || get.itemtype(viewer) == 'player') cards = this.getKnownCards(viewer); else cards = this.getShownCards(); - cards = cards.filter(card => { + count += cards.filter(card => { if (selected.includes(card)) return false; let name = get.name(card, this); if (name === 'shan' || name === 'hufu') { @@ -8510,8 +8509,7 @@ export class Player extends HTMLDivElement { return true; } return false; - }); - count += cards.length; + }).length; if (count && rvt !== 'count') return rvt === 'odds' ? 1 : true; let hs = this.getCards('hs').filter(i => !cards.includes(i)).length; if (!hs) { @@ -9502,7 +9500,7 @@ export class Player extends HTMLDivElement { for(let i=1;i<=4;i++){ let add = false; if((i == 4 || i == 3) && get.is.mountCombined()){ - add = this.hasEmptySlot('equip3_4') && !this.getEquips('equip3_4').length; + add = this.hasEmptySlot('equip3_4') && !this.getEquips('equip3_4').length; }else{ add = this.hasEmptySlot(i) && !this.getEquips(i).length; } diff --git a/noname/library/index.js b/noname/library/index.js index 6422d05c9..8d679504f 100644 --- a/noname/library/index.js +++ b/noname/library/index.js @@ -9681,8 +9681,8 @@ export class Library extends Uninstantable { }, //装备栏相关 /** - * @param { Card } card - * @param { Player } player + * @param { Card } card + * @param { Player } player * @returns { boolean } */ canBeReplaced: function (card, player) { @@ -10323,7 +10323,7 @@ export class Library extends Uninstantable { if (game.hasPlayer(current => { if (!player.canUse(card, current)) return false; const storage = player.storage, zhibi = storage.zhibi; - return (zhibi && !zhibi.includes(current) || get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && current.mayHaveShan(player, 'use', current.getCards(i => { + return (zhibi && !zhibi.includes(current) || get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1)) && current.mayHaveShan(player, 'use', current.getCards('h', i => { return i.hasGaintag('sha_notshan'); })) && player.hasSkill('jiu'); })) return 1; @@ -10396,7 +10396,7 @@ export class Library extends Uninstantable { if (game.hasPlayer(current => { if (!player.canUse(card, current)) return false; const storage = player.storage, zhibi = storage.zhibi; - return (zhibi && !zhibi.includes(current) || (get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1))) && current.mayHaveShan(player, 'use', current.getCards(i => { + return (zhibi && !zhibi.includes(current) || (get.effect(current, card, player, player) >= 2 - Math.max(0, (storage.stratagem_fury || 0) - 1))) && current.mayHaveShan(player, 'use', current.getCards('h', i => { return i.hasGaintag('sha_notshan'); })); })) return get.order(card, player) + 0.5;