mirror of
https://github.com/exane/not-gwent-online
synced 2024-11-23 19:36:53 +00:00
fix monster ability bug
This commit is contained in:
parent
2de34251b5
commit
3e5c660d6d
@ -263,18 +263,6 @@ let SideView = Backbone.View.extend({
|
|||||||
}*/
|
}*/
|
||||||
});
|
});
|
||||||
|
|
||||||
let calculateCardMargin = function($selector, totalWidth, cardWidth, n){
|
|
||||||
let w = totalWidth, c = cardWidth;
|
|
||||||
let res;
|
|
||||||
if(n < 6)
|
|
||||||
res = 0;
|
|
||||||
else {
|
|
||||||
res = -((w - c) / (n - 1) - c) + 1
|
|
||||||
}
|
|
||||||
|
|
||||||
$selector.css("margin-left", -res);
|
|
||||||
}
|
|
||||||
|
|
||||||
let BattleView = Backbone.View.extend({
|
let BattleView = Backbone.View.extend({
|
||||||
el: ".gwent-battle",
|
el: ".gwent-battle",
|
||||||
template: require("../templates/battle.handlebars"),
|
template: require("../templates/battle.handlebars"),
|
||||||
@ -706,7 +694,7 @@ let ChooseSideModal = Modal.extend({
|
|||||||
let User = Backbone.Model.extend({
|
let User = Backbone.Model.extend({
|
||||||
defaults: {
|
defaults: {
|
||||||
name: localStorage["userName"] || null,
|
name: localStorage["userName"] || null,
|
||||||
deck: localStorage["userDeck"] || null,
|
deck: localStorage["userDeck"] || "random",
|
||||||
serverOffline: true
|
serverOffline: true
|
||||||
},
|
},
|
||||||
initialize: function(){
|
initialize: function(){
|
||||||
@ -863,6 +851,7 @@ let Lobby = Backbone.View.extend({
|
|||||||
this.app.receive("update:playerOnline", this.renderStatus.bind(this));
|
this.app.receive("update:playerOnline", this.renderStatus.bind(this));
|
||||||
|
|
||||||
this.listenTo(this.app.user, "change:serverOffline", this.render);
|
this.listenTo(this.app.user, "change:serverOffline", this.render);
|
||||||
|
this.listenTo(this.app.user, "change:name", this.setName);
|
||||||
$(".gwent-battle").html(this.el);
|
$(".gwent-battle").html(this.el);
|
||||||
this.render();
|
this.render();
|
||||||
},
|
},
|
||||||
@ -893,6 +882,14 @@ let Lobby = Backbone.View.extend({
|
|||||||
this.app.trigger("setDeck", val);
|
this.app.trigger("setDeck", val);
|
||||||
this.$el.find("#deckChoice option[value='" + val + "']").attr("selected", "selected")
|
this.$el.find("#deckChoice option[value='" + val + "']").attr("selected", "selected")
|
||||||
},
|
},
|
||||||
|
setName: function(){
|
||||||
|
/*let val = $(e.target).val();
|
||||||
|
this.app.trigger("setDeck", val);
|
||||||
|
this.$el.find("#deckChoice option[value='" + val + "']").attr("selected", "selected")*/
|
||||||
|
localStorage["userName"] = this.app.user.get("name");
|
||||||
|
/*this.render();*/
|
||||||
|
this.$el.find(".name-input").val(this.app.user.get("name"));
|
||||||
|
},
|
||||||
changeName: function(e){
|
changeName: function(e){
|
||||||
let name = $(e.target).val();
|
let name = $(e.target).val();
|
||||||
this.app.trigger("setName", name);
|
this.app.trigger("setName", name);
|
||||||
|
@ -481,13 +481,15 @@ Battleside = (function(){
|
|||||||
if(pos < 0) return;
|
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");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
cards[pos].setBoost(cards[pos].getID() + "|left", 0);
|
cards[pos].setBoost(cards[pos].getID() + "|left", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pos < cards.length - 1 && cards[pos + 1].getName() === cards[pos].getName()){
|
if(pos < cards.length - 1 && cards[pos + 1].getName() === cards[pos].getName()){
|
||||||
cards[pos].setBoost(cards[pos].getID() + "|right", "tight_bond");
|
cards[pos].setBoost(cards[pos].getID() + "|right", "tight_bond");
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
cards[pos].setBoost(cards[pos].getID() + "|right", 0);
|
cards[pos].setBoost(cards[pos].getID() + "|right", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -740,10 +742,9 @@ Battleside = (function(){
|
|||||||
rndCard = this.getRandomCardOnField();
|
rndCard = this.getRandomCardOnField();
|
||||||
if(rndCard){
|
if(rndCard){
|
||||||
rndCard.__lock = true;
|
rndCard.__lock = true;
|
||||||
//console.log("Monsters faction ability triggered!");
|
|
||||||
|
|
||||||
this.sendNotification(this.getName() + ": Monsters faction ability triggered! " + rndCard.getName());
|
this.sendNotification(this.getName() + ": Monsters faction ability triggered! " + rndCard.getName());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
this.sendNotification(this.getName() + ": Monsters faction ability triggered! But no card found.");
|
this.sendNotification(this.getName() + ": Monsters faction ability triggered! But no card found.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -762,6 +763,10 @@ Battleside = (function(){
|
|||||||
cards = [cards];
|
cards = [cards];
|
||||||
}
|
}
|
||||||
cards.forEach(function(_card){
|
cards.forEach(function(_card){
|
||||||
|
if(_card.__lock){
|
||||||
|
delete _card.__lock;
|
||||||
|
return;
|
||||||
|
}
|
||||||
self._discard.push(_card);
|
self._discard.push(_card);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -837,7 +842,7 @@ Battleside = (function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
r.reDraw = function(n){
|
r.reDraw = function(n){
|
||||||
var hand = this.hand.getCards();
|
//var hand = this.hand.getCards();
|
||||||
var self = this;
|
var self = this;
|
||||||
var left = n;
|
var left = n;
|
||||||
var deferred = Promise.Deferred();
|
var deferred = Promise.Deferred();
|
||||||
|
@ -97,7 +97,7 @@ var Field = (function(){
|
|||||||
for(var i = 0; i < tmp.length; i++) {
|
for(var i = 0; i < tmp.length; i++) {
|
||||||
var card = tmp[i];
|
var card = tmp[i];
|
||||||
if(card.__lock){
|
if(card.__lock){
|
||||||
delete card.__lock;
|
//delete card.__lock;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
card.reset();
|
card.reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user