🐛 fix moving trap when rearrange signis

This commit is contained in:
WEBXOSS 2017-06-10 22:35:31 +08:00
parent 3fa794e683
commit 785ba75b1c
2 changed files with 8 additions and 2 deletions

View file

@ -1141,8 +1141,8 @@ Card.prototype.changeSigniZone = function (zone) {
// 交换 zone.cards // 交换 zone.cards
var oldZone = this.zone; var oldZone = this.zone;
var tmp = oldZone.cards; var tmp = oldZone.getNonTrapCards().concat(zone.trap || []);
oldZone.cards = zone.cards; oldZone.cards = zone.getNonTrapCards().concat(oldZone.trap || []);
zone.cards = tmp; zone.cards = tmp;
// 设置 card.zone // 设置 card.zone
oldZone.cards.forEach(function (card) { oldZone.cards.forEach(function (card) {

View file

@ -59,6 +59,12 @@ Zone.prototype.getActualCards = function () {
},this); },this);
}; };
Zone.prototype.getNonTrapCards = function() {
return this.cards.filter(function (card) {
return (card !== this.trap);
},this);
};
Zone.prototype.getSigni = function() { Zone.prototype.getSigni = function() {
return this.player.signis.filter(function (signi) { return this.player.signis.filter(function (signi) {
return signi.zone === this; return signi.zone === this;