mirror of
https://github.com/exane/not-gwent-online
synced 2024-11-23 19:36:53 +00:00
revamp tight bond ability
This commit is contained in:
parent
289a812288
commit
f3d8f1c4a1
@ -474,11 +474,19 @@ Battleside = (function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
r.setTightBond = function(card){
|
r.setTightBond = function(card){
|
||||||
var field = this.field[card.getType()];
|
var field = this.field[card.getType()];/*
|
||||||
var pos = field.getPosition(card);
|
var pos = field.getPosition(card);*/
|
||||||
var cards = field.get();
|
var cards = field.get();
|
||||||
|
|
||||||
if(pos < 0) return;
|
card.resetTightBond();
|
||||||
|
|
||||||
|
cards.forEach(function(c) {
|
||||||
|
if(c.getID() === card.getID()) return;
|
||||||
|
if(c.getName() !== card.getName()) return;
|
||||||
|
card.setBoost(card.getID() + "|tight_bond|"+c.getID(), "tight_bond");
|
||||||
|
});
|
||||||
|
|
||||||
|
/*if(pos < 0) return;
|
||||||
if(pos >= 1 && cards[pos - 1].getName() === cards[pos].getName()){
|
if(pos >= 1 && cards[pos - 1].getName() === cards[pos].getName()){
|
||||||
cards[pos].setBoost(cards[pos].getID() + "|left", "tight_bond");
|
cards[pos].setBoost(cards[pos].getID() + "|left", "tight_bond");
|
||||||
}
|
}
|
||||||
@ -491,7 +499,7 @@ Battleside = (function(){
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cards[pos].setBoost(cards[pos].getID() + "|right", 0);
|
cards[pos].setBoost(cards[pos].getID() + "|right", 0);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
r.checkAbilities = function(card, obj, __flag){
|
r.checkAbilities = function(card, obj, __flag){
|
||||||
|
@ -137,6 +137,13 @@ var Card = (function(){
|
|||||||
return this._id;
|
return this._id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r.resetTightBond = function() {
|
||||||
|
for(var key in this._boost) {
|
||||||
|
if(this._boost[key] !== "tight_bond") continue;
|
||||||
|
delete this._boost[key];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
r.getBoost = function(){
|
r.getBoost = function(){
|
||||||
var res = 0;
|
var res = 0;
|
||||||
var doubles = 0;
|
var doubles = 0;
|
||||||
|
@ -74,6 +74,9 @@ var Field = (function(){
|
|||||||
var index = this.getPosition(oldCard);
|
var index = this.getPosition(oldCard);
|
||||||
this._cards[index] = newCard;
|
this._cards[index] = newCard;
|
||||||
oldCard.reset();
|
oldCard.reset();
|
||||||
|
for(var event in oldCard._uidEvents) {
|
||||||
|
this.side.off(event, oldCard.getUidEvents(event));
|
||||||
|
}
|
||||||
return oldCard;
|
return oldCard;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,7 +91,7 @@ var Field = (function(){
|
|||||||
r.removeAll = function(){
|
r.removeAll = function(){
|
||||||
var tmp = this._cards.slice();
|
var tmp = this._cards.slice();
|
||||||
var self = this;
|
var self = this;
|
||||||
for(var i = 0; i < tmp.length; i++) {
|
/*for(var i = 0; i < tmp.length; i++) {
|
||||||
var card = tmp[i];
|
var card = tmp[i];
|
||||||
card.reset();
|
card.reset();
|
||||||
if(card.__lock){
|
if(card.__lock){
|
||||||
@ -98,7 +101,17 @@ var Field = (function(){
|
|||||||
self.side.off(event, card.getUidEvents(event));
|
self.side.off(event, card.getUidEvents(event));
|
||||||
}
|
}
|
||||||
this._cards[i] = null;
|
this._cards[i] = null;
|
||||||
|
}*/
|
||||||
|
tmp.forEach(function(card, i) {
|
||||||
|
card.reset();
|
||||||
|
if(card.__lock){
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
for(var event in card._uidEvents) {
|
||||||
|
this.side.off(event, card.getUidEvents(event));
|
||||||
|
}
|
||||||
|
this._cards[i] = null;
|
||||||
|
}, this)
|
||||||
|
|
||||||
this._cards = _.without(this._cards, null);
|
this._cards = _.without(this._cards, null);
|
||||||
|
|
||||||
@ -122,6 +135,10 @@ var Field = (function(){
|
|||||||
}
|
}
|
||||||
var self = this;
|
var self = this;
|
||||||
cards.forEach(function(card){
|
cards.forEach(function(card){
|
||||||
|
card.reset();
|
||||||
|
for(var event in card._uidEvents) {
|
||||||
|
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