diff --git a/card/extra.js b/card/extra.js index 83ef9d2f0..1fb1be66d 100644 --- a/card/extra.js +++ b/card/extra.js @@ -242,6 +242,17 @@ game.import('card',function(lib,game,ui,get,ai,_status){ target:function(player,target){ if(target.hasSkill('huogong2')||target.countCards('h')==0) return 0; if(player.countCards('h')<=1) return 0; + if(_status.event.player == player){ + if(target.isAllCardsKnown(player)){ + if(!target.countCards('h',card=>{ + return player.countCards('h',card2=>{ + return get.suit(card2) == get.suit(card); + }); + })){ + return 0; + } + } + } if(target==player){ if(typeof _status.event.filterCard=='function'&& _status.event.filterCard({name:'huogong'},player,_status.event)){ diff --git a/game/game.js b/game/game.js index 4a9ed959d..27a1e999b 100644 --- a/game/game.js +++ b/game/game.js @@ -18050,6 +18050,7 @@ else{ game.log(player,'展示了',cards); } + game.addCardKnower(cards,'everyone'); game.delayx(event.delay_time||2.5); game.addVideo('showCards',player,[event.str,get.cardsInfo(cards)]); "step 1" @@ -18058,6 +18059,7 @@ }, viewCards:function(){ "step 0" + game.addCardKnower(event.cards,player); if(player==game.me){ event.dialog=ui.create.dialog(event.str,event.cards); if(event.isMine()){ @@ -19256,7 +19258,9 @@ for(var i in map){ var owner=(_status.connectMode?lib.playerOL:game.playerMap)[i]; var next=owner.lose(map[i][0],ui.special).set('type','gain').set('forceDie',true).set('getlx',false); - if(event.visible==true) next.visible=true; + if(event.visible==true){ + next.visible=true; + } event.relatedLose=next; } } @@ -19276,6 +19280,8 @@ var hs=source.getCards('hejsx'); if(hs.contains(cards[i])){ cards.splice(i--,1); + }else{ + cards[i].addKnower(event.visible?'everyone':source); } } } @@ -19768,6 +19774,10 @@ event.js=js; event.ss=ss; event.xs=xs; + game.clearCardKnowers(hs); + if(hs.length && !event.visible){ + this.getCards('h').forEach(hcard=>{hcard.clearKnowers();}); + } "step 2" if(num{return true}; + return this.getCards('h',function(card){ + return card.isKnownBy(other) && filter(card); + }); + } + //判断此角色的手牌是否已经被看光了。 + isAllCardsKnown(other){ + if(!other)other = _status.event.player; + if(!other)other = this; + return this.countCards('h',function(card){ + return !card.isKnownBy(other); + }) == 0; + } + //判断此角色是否有被知的牌。 + hasKnownCards(other,filter){ + if(!other)other = _status.event.player; + if(!other)other = this; + if(!filter)filter = (card)=>{return true}; + return this.countCards('h',function(card){ + return card.isKnownBy(other) && filter(card); + }) > 0; + } //Execute the delay card effect //执行延时锦囊牌效果 executeDelayCardEffect(card,target,judge,judge2){ @@ -28354,8 +28392,13 @@ let cards,selected=get.copy(ui.selected.cards); if(get.itemtype(ignore)==='cards') selected.addArray(ignore); else if(get.itemtype(ignore)==='card') selected.add(ignore); - if(this===viewer||get.itemtype(viewer)==='player'&&viewer.hasSkillTag('viewHandcard',null,this,true)) cards=this.getCards('h'); - else cards=this.getShownCards(); + /*if(this===viewer||get.itemtype(viewer)==='player'&&viewer.hasSkillTag('viewHandcard',null,this,true)) cards=this.getCards('h'); + else cards=this.getShownCards();*/ + if(this === viewer || get.itemtype(viewer) == 'player'){ + cards = this.getKnownCards(viewer); + }else{ + cards = this.getShownCards(); + } if(cards.some(card=>{ if(selected.includes(card)) return false; let name=get.name(card,this); @@ -28376,8 +28419,13 @@ let cards,selected=get.copy(ui.selected.cards); if(get.itemtype(ignore)==='cards') selected.addArray(ignore); else if(get.itemtype(ignore)==='card') selected.add(ignore); - if(this===viewer||get.itemtype(viewer)==='player'&&viewer.hasSkillTag('viewHandcard',null,this,true)) cards=this.getCards('h'); - else cards=this.getShownCards(); + /*if(this===viewer||get.itemtype(viewer)==='player'&&viewer.hasSkillTag('viewHandcard',null,this,true)) cards=this.getCards('h'); + else cards=this.getShownCards();*/ + if(this === viewer || get.itemtype(viewer) == 'player'){ + cards = this.getKnownCards(viewer); + }else{ + cards = this.getShownCards(); + } if(cards.some(card=>{ if(selected.includes(card)) return false; let name=get.name(card,this); @@ -30522,6 +30570,41 @@ aiexclude(){ _status.event._aiexclude.add(this); } + //为此牌添加知情者。参数可为数组,若参数为字符串'everyone',则所有玩家均为知情者。 + addKnower(player){ + if(!this._knowers){ + this._knowers = []; + } + if(typeof player == 'string'){ + this._knowers.add(player); + }else{ + let type = get.itemtype(player); + if(type == 'player'){ + this._knowers.add(player.playerid); + }else if(type == 'players'){ + player.forEach(p=>this._knowers.add(p.playerid)); + } + } + } + //清除此牌的知情者。 + clearKnowers(){ + if(this._knowers)delete this._knowers; + } + //判断玩家对此牌是否知情。 + isKnownBy(player){ + if(['e','j'].includes(get.position(this)))return true;//装备区或者判定区的牌,必知情。 + let owner = get.owner(this); + if(owner){ + if(owner == player)return true;//是牌主,必知情。 + if(player.hasSkillTag('viewHandcard',null,owner,true))return true;//有viewHandcard标签,必知情。 + if(owner.isUnderControl(true,player))return true;//被操控,必知情。 + } + if(get.is.shownCard(this))return true;//此牌是明置牌,必知情。 + if(this._knowers){ + return this._knowers.includes('everyone') || this._knowers.includes(player.playerid); + } + return false; + } getSource(name){ if(this.name==name) return true; var info=lib.card[this.name]; @@ -36146,6 +36229,20 @@ if(i.storage.renku) i.markSkill('renku'); } }, + //为牌添加知情者。 + addCardKnower:function(cards,players){ + if(get.itemtype(cards) == 'card'){ + cards = [cards]; + } + cards.forEach(card=>card.addKnower(players)); + }, + //移除牌的所有知情者。 + clearCardKnowers:function(cards){ + if(get.itemtype(cards) == 'card'){ + cards = [cards]; + } + cards.forEach(card=>card.clearKnowers()); + }, loseAsync:function(arg){ var next=game.createEvent('loseAsync'); next.forceDie=true;