mirror of
https://github.com/exane/not-gwent-online
synced 2024-11-23 19:36:53 +00:00
try catch statements without try catch. dont know why I did it this way
This commit is contained in:
parent
382e7f5c32
commit
2b068d4655
@ -389,8 +389,12 @@ var Battle = (function(){
|
|||||||
r.userLeft = function(sideName){
|
r.userLeft = function(sideName){
|
||||||
var side = this[sideName];
|
var side = this[sideName];
|
||||||
|
|
||||||
side.foe.send("foe:left", null, true);
|
|
||||||
|
|
||||||
|
if(side.foe){
|
||||||
|
side.foe.send("foe:left", null, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("side foe not defined!", side.foe);
|
||||||
}
|
}
|
||||||
|
|
||||||
r.shutDown = function(){
|
r.shutDown = function(){
|
||||||
|
@ -77,7 +77,13 @@ Battleside = (function(){
|
|||||||
this.receive("decoy:replaceWith", function(data){
|
this.receive("decoy:replaceWith", function(data){
|
||||||
if(self._isWaiting) return;
|
if(self._isWaiting) return;
|
||||||
var card = self.findCardOnFieldByID(data.cardID);
|
var card = self.findCardOnFieldByID(data.cardID);
|
||||||
if(card === -1) throw new Error("decoy:replace | unknown card");
|
/*if(card === -1) throw new Error("decoy:replace | unknown card");*/
|
||||||
|
if(card === -1) {
|
||||||
|
console.log("decoy:replace | unknown card: ", card);
|
||||||
|
self.sendNotificationTo(self, "Possible bug occured: unknown card was chosen by playing decoy ability.");
|
||||||
|
//self.endTurn();
|
||||||
|
return;
|
||||||
|
}
|
||||||
self.runEvent("Decoy:replaceWith", self, [card]);
|
self.runEvent("Decoy:replaceWith", self, [card]);
|
||||||
})
|
})
|
||||||
this.receive("cancel:decoy", function(){
|
this.receive("cancel:decoy", function(){
|
||||||
|
@ -75,7 +75,9 @@ var Field = (function(){
|
|||||||
this._cards[index] = newCard;
|
this._cards[index] = newCard;
|
||||||
oldCard.reset();
|
oldCard.reset();
|
||||||
for(var event in oldCard._uidEvents) {
|
for(var event in oldCard._uidEvents) {
|
||||||
this.side.off(event, oldCard.getUidEvents(event));
|
if(this.side && this.side.off){
|
||||||
|
this.side.off(event, oldCard.getUidEvents(event));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return oldCard;
|
return oldCard;
|
||||||
}
|
}
|
||||||
@ -102,13 +104,15 @@ var Field = (function(){
|
|||||||
}
|
}
|
||||||
this._cards[i] = null;
|
this._cards[i] = null;
|
||||||
}*/
|
}*/
|
||||||
tmp.forEach(function(card, i) {
|
tmp.forEach(function(card, i){
|
||||||
card.reset();
|
card.reset();
|
||||||
if(card.__lock){
|
if(card.__lock){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for(var event in card._uidEvents) {
|
for(var event in card._uidEvents) {
|
||||||
this.side.off(event, card.getUidEvents(event));
|
if(this.side && this.side.off){
|
||||||
|
this.side.off(event, card.getUidEvents(event));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._cards[i] = null;
|
this._cards[i] = null;
|
||||||
}, this)
|
}, this)
|
||||||
@ -137,7 +141,9 @@ var Field = (function(){
|
|||||||
cards.forEach(function(card){
|
cards.forEach(function(card){
|
||||||
card.reset();
|
card.reset();
|
||||||
for(var event in card._uidEvents) {
|
for(var event in card._uidEvents) {
|
||||||
this.side.off(event, card.getUidEvents(event));
|
if(this.side && this.side.off){
|
||||||
|
this.side.off(event, card.getUidEvents(event));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res.push(_cards.splice(self.getPosition(card), 1)[0]);
|
res.push(_cards.splice(self.getPosition(card), 1)[0]);
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user