mirror of
https://github.com/exane/not-gwent-online
synced 2024-11-23 19:36:53 +00:00
monster faction ability fix
This commit is contained in:
parent
b5d28bcc08
commit
7f0d7f9db8
@ -197,7 +197,7 @@ Battleside = (function(){
|
||||
var allCards = close.concat(range.concat(siege));
|
||||
var rnd = (Math.random() * allCards.length) | 0;
|
||||
|
||||
if(allCards[rnd].getType === 4) return null;
|
||||
//if(allCards[rnd].getType === 4) return null;
|
||||
|
||||
return allCards[rnd];
|
||||
}
|
||||
@ -632,6 +632,13 @@ Battleside = (function(){
|
||||
var rndCard = null;
|
||||
if(this.deck.getFaction() === Deck.FACTION.MONSTERS){
|
||||
rndCard = this.getRandomCardOnField();
|
||||
if(rndCard) {
|
||||
rndCard.__lock = true;
|
||||
console.log("Monsters faction ability triggered!");
|
||||
this.sendNotification(this.getName() + ": Monsters faction ability triggered! " + rndCard.getName());
|
||||
} else {
|
||||
this.sendNotification(this.getName() + ": Monsters faction ability triggered! But no card found.");
|
||||
}
|
||||
}
|
||||
var cards1 = this.field[Card.TYPE.CLOSE_COMBAT].removeAll();
|
||||
var cards2 = this.field[Card.TYPE.RANGED].removeAll();
|
||||
@ -640,12 +647,6 @@ Battleside = (function(){
|
||||
|
||||
var cards = cards1.concat(cards2.concat(cards3.concat(cards4)));
|
||||
this.addToDiscard(cards);
|
||||
|
||||
if(rndCard){
|
||||
this.removeFromDiscard(rndCard);
|
||||
this.placeCard(rndCard, {disabled: true}); //disabled == no abilities get triggered
|
||||
console.log("Monsters faction ability triggered!");
|
||||
}
|
||||
}
|
||||
|
||||
r.addToDiscard = function(cards){
|
||||
|
@ -1,3 +1,5 @@
|
||||
var _ = require("underscore");
|
||||
|
||||
var Field = (function(){
|
||||
var Field = function(side, hasHornField){
|
||||
if(!(this instanceof Field)){
|
||||
@ -86,13 +88,27 @@ var Field = (function(){
|
||||
r.removeAll = function(){
|
||||
var tmp = this._cards.slice();
|
||||
var self = this;
|
||||
tmp.forEach(function(card){
|
||||
/*tmp.forEach(function(card){
|
||||
card.reset();
|
||||
for(var event in card._uidEvents) {
|
||||
self.side.off(event, card.getUidEvents(event));
|
||||
}
|
||||
})
|
||||
this._cards = [];
|
||||
})*/
|
||||
for(var i = 0; i < tmp.length; i++) {
|
||||
var card = tmp[i];
|
||||
if(card.__lock){
|
||||
delete card.__lock;
|
||||
continue;
|
||||
}
|
||||
card.reset();
|
||||
for(var event in card._uidEvents) {
|
||||
self.side.off(event, card.getUidEvents(event));
|
||||
}
|
||||
this._cards[i] = null;
|
||||
}
|
||||
|
||||
this._cards = _.without(this._cards, null);
|
||||
|
||||
if(this.getHorn()){
|
||||
var card = this.getHorn();
|
||||
card.reset();
|
||||
|
Loading…
Reference in New Issue
Block a user