Skip to content

Commit

Permalink
Merge pull request #2028 from zhichaoxi2006/PR-Branch
Browse files Browse the repository at this point in the history
添加addCardtag和removeCardtag
  • Loading branch information
nonameShijian authored Oct 23, 2024
2 parents cc7981e + 4ad2bd7 commit 92bf48c
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions noname/library/element/card.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,40 @@ export class Card extends HTMLDivElement {
}
return this;
}
/**
* 给此牌添加特定的cardtag(如添加应变条件)
* @param { string } tag
*/
addCardtag(tag) {
let card = this;
game.broadcastAll(function (card, tag) {
if (!_status.cardtag) {
_status.cardtag = {};
}
if (!_status.cardtag[tag]) {
_status.cardtag[tag] = [];
}
_status.cardtag[tag].add(card.cardid);
card.$init([card.suit, card.number, card.name, card.nature]);
}, card, tag);
}
/**
* 给此牌移除特定的cardtag(如移除应变条件)
* @param { string } tag
*/
removeCardtag(tag) {
let card = this;
game.broadcastAll(function (card, tag) {
if (!_status.cardtag) {
_status.cardtag = {};
}
if (!_status.cardtag[tag]) {
_status.cardtag[tag] = [];
}
_status.cardtag[tag].remove(card.cardid);
card.$init([card.suit, card.number, card.name, card.nature]);
}, card, tag);
}
updateTransform(bool, delay) {
if (delay) {
var that = this;
Expand Down

0 comments on commit 92bf48c

Please sign in to comment.