1
0
mirror of https://github.com/exane/not-gwent-online synced 2024-10-31 10:36:53 +00:00

fix monster ability bug

This commit is contained in:
exane 2015-07-02 19:21:24 +02:00
parent 2de34251b5
commit 3e5c660d6d
3 changed files with 40 additions and 38 deletions

View File

@ -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({
el: ".gwent-battle",
template: require("../templates/battle.handlebars"),
@ -706,7 +694,7 @@ let ChooseSideModal = Modal.extend({
let User = Backbone.Model.extend({
defaults: {
name: localStorage["userName"] || null,
deck: localStorage["userDeck"] || null,
deck: localStorage["userDeck"] || "random",
serverOffline: true
},
initialize: function(){
@ -863,6 +851,7 @@ let Lobby = Backbone.View.extend({
this.app.receive("update:playerOnline", this.renderStatus.bind(this));
this.listenTo(this.app.user, "change:serverOffline", this.render);
this.listenTo(this.app.user, "change:name", this.setName);
$(".gwent-battle").html(this.el);
this.render();
},
@ -893,6 +882,14 @@ let Lobby = Backbone.View.extend({
this.app.trigger("setDeck", val);
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){
let name = $(e.target).val();
this.app.trigger("setName", name);

View File

@ -481,13 +481,15 @@ Battleside = (function(){
if(pos < 0) return;
if(pos >= 1 && cards[pos - 1].getName() === cards[pos].getName()){
cards[pos].setBoost(cards[pos].getID() + "|left", "tight_bond");
} else {
}
else {
cards[pos].setBoost(cards[pos].getID() + "|left", 0);
}
if(pos < cards.length - 1 && cards[pos + 1].getName() === cards[pos].getName()){
cards[pos].setBoost(cards[pos].getID() + "|right", "tight_bond");
} else {
}
else {
cards[pos].setBoost(cards[pos].getID() + "|right", 0);
}
}
@ -740,10 +742,9 @@ Battleside = (function(){
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 {
}
else {
this.sendNotification(this.getName() + ": Monsters faction ability triggered! But no card found.");
}
}
@ -762,6 +763,10 @@ Battleside = (function(){
cards = [cards];
}
cards.forEach(function(_card){
if(_card.__lock){
delete _card.__lock;
return;
}
self._discard.push(_card);
});
}
@ -837,7 +842,7 @@ Battleside = (function(){
}
r.reDraw = function(n){
var hand = this.hand.getCards();
//var hand = this.hand.getCards();
var self = this;
var left = n;
var deferred = Promise.Deferred();

View File

@ -97,7 +97,7 @@ var Field = (function(){
for(var i = 0; i < tmp.length; i++) {
var card = tmp[i];
if(card.__lock){
delete card.__lock;
//delete card.__lock;
continue;
}
card.reset();