From 6919fc6a5e55cc47a74d3ea70bef9444fe3e49ab Mon Sep 17 00:00:00 2001 From: Spmario233 Date: Sat, 12 Aug 2023 22:57:27 +0800 Subject: [PATCH] cards update --- card/extra.js | 19 +++++++------ card/guozhan.js | 18 +++++++----- card/standard.js | 22 ++++++++------ card/yongjian.js | 10 +++---- card/zhulu.js | 74 ++++++++++++++++++++++++++++++------------------ game/game.js | 4 +-- 6 files changed, 88 insertions(+), 59 deletions(-) diff --git a/card/extra.js b/card/extra.js index 1162425e8..6c7e1736e 100644 --- a/card/extra.js +++ b/card/extra.js @@ -555,7 +555,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ cards.splice(i--,1); } } - var muniu=player.getEquip(5); + var muniu=player.getEquip('muniu'); if(!muniu||!cards.length){ for(var i=0;i=3&&get.attitude(current,player)>=3){ return true; } @@ -579,15 +580,15 @@ game.import('card',function(lib,game,ui,get,ai,_status){ players.sort(lib.sort.seat); var choice=players[0]; var next=player.chooseTarget('是否移动木牛流马?',function(card,player,target){ - return !target.isMin()&&player!=target&&target.isEmpty(5); - }); + return !target.isMin()&&player!=target&&target.canEquip(_status.event.muniu); + }).set('muniu',muniu) next.set('ai',function(target){ return target==_status.event.choice?1:-1; }); next.set('choice',choice); "step 3" if(result.bool){ - var card=player.getEquip(5); + var card=player.getEquip('muniu'); result.targets[0].equip(card); player.$give(card,result.targets[0]); player.line(result.targets,'green'); @@ -618,7 +619,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ mark:true, intro:{ content:function(storage,player){ - var muniu=player.getEquip(5); + var muniu=player.getEquip('muniu'); if(!muniu||!muniu.cards||!muniu.cards.length) return '共有〇张牌'; if(player.isUnderControl(true)){ return get.translation(muniu.cards); @@ -628,7 +629,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ } }, mark:function(dialog,storage,player){ - var muniu=player.getEquip(5); + var muniu=player.getEquip('muniu'); if(!muniu||!muniu.cards||!muniu.cards.length) return '共有〇张牌'; if(player.isUnderControl(true)){ dialog.addAuto(muniu.cards); @@ -638,7 +639,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ } }, markcount:function(storage,player){ - var muniu=player.getEquip(5); + var muniu=player.getEquip('muniu'); if(muniu&&muniu.cards) return muniu.cards.length; return 0; } @@ -658,7 +659,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ }).length>0; }, content:function(){ - var muniu=player.getEquip(5); + var muniu=player.getEquip('muniu'); if(muniu&&muniu.cards){ muniu.cards.removeArray(trigger.ss); lib.skill.muniu_skill.sync(muniu); diff --git a/card/guozhan.js b/card/guozhan.js index cc30f7378..235033d7f 100644 --- a/card/guozhan.js +++ b/card/guozhan.js @@ -830,8 +830,8 @@ game.import('card',function(lib,game,ui,get,ai,_status){ subtype:"equip2", skills:['huxinjing'], filterTarget:function(card,player,target){ - if(get.mode()!='guozhan') return true; - return player==target; + if(get.mode()=='guozhan'&&player!=target) return false; + return target.canEquip(card,true); }, selectTarget:function(){ return get.mode()=='guozhan'?-1:1; @@ -1279,7 +1279,9 @@ game.import('card',function(lib,game,ui,get,ai,_status){ return [1,player.maxHp]; }, filterCard:function(card,player){ - return card!=player.getEquip(5); + var cards=player.getEquips('dinglanyemingzhu'); + if(cards.length) return cards.some(card2=>card2!=card&&!ui.selected.cards.contains(card2)) + return true; }, prompt:'出牌阶段限一次,你可以弃置至多X张牌(X为你的体力上限),然后摸等量的牌' }, @@ -1726,13 +1728,15 @@ game.import('card',function(lib,game,ui,get,ai,_status){ target:player, card:event.card })) return false; + var cards=player.getEquips('huxinjing'); + if(!cards.length) return false; if(get.mode()!='guozhan'&&event.num>1) return true; return event.num>=player.hp; }, content:function(){ trigger.cancel(); - var e2=player.getEquip('huxinjing'); - if(e2){ + var e2=player.getEquips('huxinjing'); + if(e2.length){ player.discard(e2); } player.removeSkill('huxinjing'); @@ -1859,8 +1863,8 @@ game.import('card',function(lib,game,ui,get,ai,_status){ jingfanma_info:'你的进攻距离+1', huxinjing_bg:'镜', huxinjing:'护心镜', - huxinjing_info:'此牌可对其他角色使用。当你受到伤害时,若伤害值大于1或大于等于你的体力值,则你可以将【护心镜】置入弃牌堆,然后防止此伤害。', - huxinjing_info_guozhan:'当你受到伤害时,若伤害值大于等于你的体力值,则你可以将【护心镜】置入弃牌堆,然后防止此伤害。', + huxinjing_info:'此牌可对其他角色使用。当你受到伤害时,若伤害值大于1或大于等于你的体力值,则你可以将所有【护心镜】置入弃牌堆,然后防止此伤害。', + huxinjing_info_guozhan:'当你受到伤害时,若伤害值大于等于你的体力值,则你可以将所有【护心镜】置入弃牌堆,然后防止此伤害。', gz_haolingtianxia:'号令天下', gz_haolingtianxia_info:'出牌阶段,对一名体力值不为全场最少的角色使用。所有其他角色依次选择一项:①弃置一张牌(魏势力角色无需弃牌),视为对目标角色使用一张【杀】;②弃置目标角色的一张牌(魏势力角色改为获得其一张牌)。', gz_kefuzhongyuan:'克复中原', diff --git a/card/standard.js b/card/standard.js index 0681a0d67..e18416e8e 100644 --- a/card/standard.js +++ b/card/standard.js @@ -2043,17 +2043,20 @@ game.import('card',function(lib,game,ui,get,ai,_status){ }, mod:{ cardUsable:function(card,player,num){ - var cardx=player.getEquip('zhuge'); - if(card.name=='sha'&&(!cardx||player.hasSkill('zhuge_skill',null,false)||(!_status.zhuge_temp&&!ui.selected.cards.contains(cardx)))){ - if(get.is.versus()||get.is.changban()){ - return num+3; + var cards=player.getEquips('zhuge') + if(card.name=='sha'){ + if(!cards.length||player.hasSkill('zhuge_skill',null,false)||cards.some(card=>(card!=_status.zhuge_temp&&!ui.selected.cards.contains(card)))){ + if(get.is.versus()||get.is.changban()){ + return num+3; + } + return Infinity; } - return Infinity; } }, cardEnabled2:function(card,player){ if(!_status.event.addCount_extra||player.hasSkill('zhuge_skill',null,false)) return; - if(card&&card==player.getEquip('zhuge')){ + var cards=player.getEquips('zhuge'); + if(card&&cards.contains(card)){ try{ var cardz=get.card(); } @@ -2061,7 +2064,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ return; } if(!cardz||cardz.name!='sha') return; - _status.zhuge_temp=true; + _status.zhuge_temp=card; var bool=lib.filter.cardUsable(get.autoViewAs({name:'sha'},ui.selected.cards.concat([card])),player); delete _status.zhuge_temp; if(!bool) return false; @@ -2158,7 +2161,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){ "step 0" player.chooseToUse(get.prompt('qinglong',trigger.target),function(card,player,event){ if(get.name(card)!='sha') return false; - if(player.getEquip('qinglong')==card) return false; + if(!player.hasSkill('qinglong_skill',null,false)){ + var cards=player.getEquips('qinglong'); + if(!cards.some(card2=>card2!=card&&!ui.selected.cards.contains(card2))) return false; + } return lib.filter.filterCard.apply(this,arguments); },trigger.target,-1).set('addCount',false).logSkill='qinglong_skill'; } diff --git a/card/yongjian.js b/card/yongjian.js index 9f9649581..9bd82e9f2 100644 --- a/card/yongjian.js +++ b/card/yongjian.js @@ -161,7 +161,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ ai:{ order:9, value:function(card,player){ - if(player.getEquip(1)==card) return 0; + if(player.getEquips(1).contains(card)) return 0; return 4; }, equipValue:function(card,player){ @@ -195,7 +195,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ return 2; }, value:function(card,player){ - if(player.getEquip(1)==card) return -3; + if(player.getEquips(1).contains(card)) return -3; return 3; }, basic:{ @@ -229,7 +229,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ return 2; }, value:function(card,player){ - if(player.getEquip(2)==card) return -3; + if(player.getEquips(2).contains(card)) return -3; return 3; }, basic:{ @@ -263,7 +263,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ return 1; }, value:function(card,player){ - if(player.getEquip(2)==card) return -2.5; + if(player.getEquips(2).contains(card)) return -2.5; return 2.5; }, basic:{ @@ -297,7 +297,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ order:9, equipValue:0, value:function(card,player){ - if(player.getEquip(2)==card) return 0; + if(player.getEquips(2).contains(card)) return 0; return 0.5; }, basic:{ diff --git a/card/zhulu.js b/card/zhulu.js index 1755a0355..13e145a5e 100644 --- a/card/zhulu.js +++ b/card/zhulu.js @@ -81,7 +81,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ var equips=[]; for(var i=0;i1){ var next=target.chooseButton(true,function(button){ @@ -281,7 +281,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ }, result:{ target:function(player,target){ - var e5=target.getEquip(5); + var e5=target.getEquip('muniu'); if(e5&&e5.name=='muniu'&&e5.cards&&e5.cards.length>1) return -1; if(target.countCards('e',function(card){ return get.value(card,target)<=0; @@ -322,7 +322,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){ fullskin:true, type:'equip', subtype:'equip4', - filterTarget:lib.filter.notMe, + filterTarget:function(card,player,target){ + if(player==target) return false; + return target.canEquip(card,true) + }, selectTarget:1, toself:false, loseThrow:true, @@ -332,7 +335,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ ai:{ order:9, value:function(card,player){ - if(player.getEquip(4)==card) return 0; + if(player.getEquips(4).contains(card)) return 0; return 4; }, equipValue:function(card,player){ @@ -380,7 +383,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){ fullskin:true, type:'equip', subtype:'equip1', - filterTarget:lib.filter.notMe, + filterTarget:function(card,player,target){ + if(player==target) return false; + return target.canEquip(card,true) + }, selectTarget:1, toself:false, skills:['wufengjian_skill'], @@ -391,7 +397,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ return 2; }, value:function(card,player){ - if(player.getEquip(1)==card) return -1.5; + if(player.getEquips(1).contains(card)) return -1.5; return 1.5; }, basic:{ @@ -416,7 +422,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){ fullskin:true, type:'equip', subtype:'equip1', - filterTarget:lib.filter.notMe, + filterTarget:function(card,player,target){ + if(player==target) return false; + return target.canEquip(card,true) + }, selectTarget:1, toself:false, distance:{attackFrom:1}, @@ -427,7 +436,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ return 2; }, value:function(card,player){ - if(player.getEquip(1)==card) return -3; + if(player.getEquips(1).contains(card)) return -3; return 3; }, basic:{ @@ -452,7 +461,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){ fullskin:true, type:'equip', subtype:'equip2', - filterTarget:lib.filter.notMe, + filterTarget:function(card,player,target){ + if(player==target) return false; + return target.canEquip(card,true) + }, selectTarget:1, toself:false, skills:['yinfengjia_skill'], @@ -463,7 +475,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ return 1; }, value:function(card,player){ - if(player.getEquip(2)==card) return -2.5; + if(player.getEquips(2).contains(card)) return -2.5; return 2.5; }, basic:{ @@ -488,7 +500,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){ fullskin:true, type:'equip', subtype:'equip2', - filterTarget:lib.filter.notMe, + filterTarget:function(card,player,target){ + if(player==target) return false; + return target.canEquip(card,true) + }, selectTarget:1, toself:false, loseDelay:false, @@ -517,7 +532,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ ai:{ order:9.5, equipValue:function(card,player){ - if(card==player.getEquip(2)){ + if(player.getEquips(2).contains(card)){ if(player.sex!='male') return 0; var num=player.countCards('he',function(cardx){ return cardx!=card; @@ -575,7 +590,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){ fullskin:true, type:'equip', subtype:'equip5', - filterTarget:lib.filter.notMe, + filterTarget:function(card,player,target){ + if(player==target) return false; + return target.canEquip(card,true) + }, selectTarget:1, toself:false, skills:['jinhe_skill'], @@ -630,7 +648,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ ai:{ order:9.5, equipValue:function(card,player){ - if(card!=player.getEquip(5)) return 5; + if(!player.getEquips(5).contains(card)) return 5; if(_status.jinhe&&_status.jinhe[card.cardid]&&_status.event.name!='gainPlayerCard') return 3*player.countCards('h'); return 0; }, @@ -712,11 +730,11 @@ game.import('card',function(lib,game,ui,get,ai,_status){ enable:'phaseUse', filter:function(event,player){ if(!_status.jinhe) return false; - var card=player.getEquip(5); + var card=player.getEquip('jinhe'); return card&&card.name=='jinhe'&&_status.jinhe[card.cardid]!=undefined; }, prepare:function(cards,player){ - var card=player.getEquip(5); + var card=player.getEquip('jinhe'); if(card&&card.name=='jinhe'&&_status.jinhe[card.cardid]){ var tothrow=_status.jinhe[card.cardid].card; player.$throw(tothrow); @@ -725,7 +743,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ }, content:function(){ "step 0" - var card=player.getEquip(5); + var card=player.getEquip('jinhe'); if(card&&card.name=='jinhe'&&_status.jinhe[card.cardid]){ game.cardsDiscard(_status.jinhe[card.cardid].card); event.suit=get.suit(_status.jinhe[card.cardid].card); @@ -748,7 +766,7 @@ game.import('card',function(lib,game,ui,get,ai,_status){ order:1, result:{ player:function(player){ - var suit=get.suit(_status.jinhe[player.getEquip(5).cardid].card); + var suit=get.suit(_status.jinhe[player.getEquip('jinhe').cardid].card); var hs=player.getCards('h',function(card){ return get.suit(card)==suit; }); @@ -763,10 +781,10 @@ game.import('card',function(lib,game,ui,get,ai,_status){ mod:{ targetEnabled:function(card,player,target){ if(get.color(card)=='black'&&get.type(card,'trick')=='trick'&&!target.hasSkillTag('unequip2')&&!player.hasSkillTag('unequip',false,{ - name:card?card.name:null, - target:target, - card:card - })) return false; + name:card?card.name:null, + target:target, + card:card + })) return false; }, }, }, @@ -791,16 +809,16 @@ game.import('card',function(lib,game,ui,get,ai,_status){ forced:true, filter:function(event,player){ if(event.card.name!='sha') return false; - var card=player.getEquip('wufengjian'); - return player.countCards('he',function(cardx){ - return cardx!=card; - })>0; + var cards=player.getEquip('wufengjian'); + return player.hasCard(function(card){ + return !cards.contains(card); + },'he'); }, content:function(){ if(player!=game.me&&!player.isUnderControl()&&!player.isOnline()) game.delayx(); player.chooseToDiscard(true,'he',function(card){ - return card!=_status.event.card; - }).set('card',player.getEquip('wufengjian')); + return !_status.event.cards.contains(card); + }).set('cards',player.getEquips('wufengjian')); }, }, yajiaoqiang_skill:{ diff --git a/game/game.js b/game/game.js index 8de0d3ce7..b59e1f5a1 100644 --- a/game/game.js +++ b/game/game.js @@ -10736,7 +10736,7 @@ source.chooseButton([ '选择'+(player==source?'你':get.translation(player))+'的'+get.cnNumber(num)+'张'+get.translation(slot)+'牌置入弃牌堆', cards, - ],true,num).set('filterOk',function(){ + ],true,[1,num]).set('filterOk',function(){ var evt=_status.event; return ui.selected.buttons.reduce(function(num,button){ return num+get.numOf(get.subtypes(button.link,false),evt.slot) @@ -10822,7 +10822,7 @@ source.chooseButton([ '选择替换掉'+get.cnNumber(num)+'张'+get.translation(slot)+'牌', cards, - ],true,num).set('filterOk',function(){ + ],true,[1,num]).set('filterOk',function(){ var evt=_status.event; return ui.selected.buttons.reduce(function(num,button){ return num+get.numOf(get.subtypes(button.link,false),evt.slot)