From c62ac4c91bc22b69f9e4033d538d090a2597a319 Mon Sep 17 00:00:00 2001 From: exane Date: Tue, 30 Jun 2015 10:46:31 +0200 Subject: [PATCH] small changes --- assets/data/cards.js | 1 + client/templates/lobby.handlebars | 2 +- server/Battle.js | 10 ++-------- server/Battleside.js | 13 +++++-------- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/assets/data/cards.js b/assets/data/cards.js index 1437386..c9f023d 100644 --- a/assets/data/cards.js +++ b/assets/data/cards.js @@ -470,6 +470,7 @@ module.exports = { name: "Havekar Smuggler", power: 5, ability: "muster", + musterType: "smuggler", img: "smuggler1", faction: "scoiatael", type: 0 diff --git a/client/templates/lobby.handlebars b/client/templates/lobby.handlebars index 2618301..a83c5cb 100644 --- a/client/templates/lobby.handlebars +++ b/client/templates/lobby.handlebars @@ -20,7 +20,7 @@ {{#if inMatchmakerQueue}} {{/if}} - + diff --git a/server/Battle.js b/server/Battle.js index 9a0cd16..41900b9 100644 --- a/server/Battle.js +++ b/server/Battle.js @@ -34,22 +34,16 @@ var Battle = (function(){ r.turn = 0; r.socket = null; - r.channel = null; r._id = null; r.events = null; r.init = function(){ - /*PubSub.subscribe("update", this.update.bind(this));*/ this.on("Update", this.update); - /* - this.on("AfterPlace", this.checkAbilityOnAfterPlace)*/ - - //this.channel = this.socket.subscribe(this._id); - this.p1 = Battleside(this._user1.getName(), 0, this, this._user1); - this.p2 = Battleside(this._user2.getName(), 1, this, this._user2); + this.p1 = Battleside(this._user1, 0, this); + this.p2 = Battleside(this._user2, 1, this); this.p1.foe = this.p2; this.p2.foe = this.p1; this.p1.setUpWeatherFieldWith(this.p2); diff --git a/server/Battleside.js b/server/Battleside.js index 3da52cc..3c8a69d 100644 --- a/server/Battleside.js +++ b/server/Battleside.js @@ -9,9 +9,9 @@ var Promise = require("jquery-deferred"); var Battleside; Battleside = (function(){ - var Battleside = function(name, n, battle, user){ + var Battleside = function(user, n, battle){ if(!(this instanceof Battleside)){ - return (new Battleside(name, n, battle, user)); + return (new Battleside(user, n, battle)); } /** * constructor here @@ -21,18 +21,15 @@ Battleside = (function(){ var self = this; this._isWaiting = true; this.socket = user.socket; + this.field = {}; this.field[Card.TYPE.LEADER] = Field(this); this.field[Card.TYPE.CLOSE_COMBAT] = Field(this, true); this.field[Card.TYPE.RANGED] = Field(this, true); this.field[Card.TYPE.SIEGE] = Field(this, true); - /*this.field[Card.TYPE.HORN] = { - close: Field(this), - range: Field(this), - siege: Field(this) - };*/ + this.n = n ? "p2" : "p1"; - this._name = name; + this._name = user.getName(); this.battle = battle; this.hand = Hand(); this.deck = Deck(DeckData[deck]);