From 89b1396c50b03003e9647531558b9f001766f802 Mon Sep 17 00:00:00 2001
From: exane <raco0n@gmx.de>
Date: Wed, 1 Jul 2015 20:18:09 +0200
Subject: [PATCH] stuff

---
 assets/data/abilities.js                 |  8 ++++----
 client/templates/modal.winner.handlebars |  1 +
 server/Battle.js                         | 22 ++++++++++++----------
 server/Battleside.js                     | 12 +++++++-----
 server/Matchmaker.js                     |  2 +-
 server/Room.js                           |  2 +-
 6 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/assets/data/abilities.js b/assets/data/abilities.js
index fb31cb3..2c6f4b7 100644
--- a/assets/data/abilities.js
+++ b/assets/data/abilities.js
@@ -287,8 +287,8 @@ module.exports = {
     }
   },
   "francesca_leader2": {
-    name: "",
-    description: "",
+    name: "Francesca Findabair the Beautiful",
+    description: "Doubles the strength of all your Ranged Combat units (unless a Commander's Horn is also present on that row).",
     onActivate: function(){
       this.setHorn("commanders_horn", 1);
     }
@@ -325,8 +325,8 @@ module.exports = {
     }
   },
   "eredin_leader4": {
-    name: "",
-    description: "",
+    name: "Eredin King of the Wild Hunt",
+    description: "Double the strength of all your Close Combat units (unless a Commander's Horn is also present on that row).",
     onActivate: function(){
       this.setHorn("commanders_horn", 0);
     }
diff --git a/client/templates/modal.winner.handlebars b/client/templates/modal.winner.handlebars
index 50d9db3..8876c0f 100644
--- a/client/templates/modal.winner.handlebars
+++ b/client/templates/modal.winner.handlebars
@@ -5,6 +5,7 @@
   <h1>{{winner}} wins the match!</h1>
   <p>If you want to give feedback, or want to contribute, please feel free to visit <a href="https://github.com/exane/gwent-online" target="_blank">Github Gwent-Online</a>.</p>
   <p>For another match reload the page und enqueue again!</p>
+  <p><button onclick="location.reload()">Reload</button></p>
   <p><b>Thanks for playing the game!</b></p>
 </div>
 <div class="bbm-modal__bottombar">
diff --git a/server/Battle.js b/server/Battle.js
index 673d868..0e960d7 100644
--- a/server/Battle.js
+++ b/server/Battle.js
@@ -111,7 +111,7 @@ var Battle = (function(){
     Promise.when(this.p1.reDraw(2), this.p2.reDraw(2))
     .then(function(){
       this.on("NextTurn", this.switchTurn);
-      this.switchTurn(Math.random() > .5 ? this.p1 : this.p2);
+      this.switchTurn(Math.random() > 0.5 ? this.p1 : this.p2);
     }.bind(this));
 
   }
@@ -136,7 +136,7 @@ var Battle = (function(){
 
     this.runEvent("Turn" + side.getID());
 
-    console.log("current Turn: ", side.getName());
+    //console.log("current Turn: ", side.getName());
   }
 
   r.startNextRound = function(){
@@ -144,7 +144,7 @@ var Battle = (function(){
     var loser = lastRound.loser;
     var winner = loser.foe;
     if(this.checkIfIsOver()){
-      console.log("its over!");
+      //console.log("its over!");
       this.gameOver(winner);
       this.update();
       return;
@@ -153,13 +153,13 @@ var Battle = (function(){
     this.p1.resetNewRound();
     this.p2.resetNewRound();
 
-    console.log("start new round!");
+    //console.log("start new round!");
     this.sendNotification("Start new round!");
 
 
     if(winner.deck.getFaction() === Deck.FACTION.NORTHERN_REALM && !lastRound.isTie){
       winner.draw(1);
-      console.log(winner.getName() + " draws 1 extra card! (Northern ability)");
+      //console.log(winner.getName() + " draws 1 extra card! (Northern ability)");
       this.sendNotification(winner.getName() + " draws 1 extra card! (Northern ability)");
     }
 
@@ -182,10 +182,12 @@ var Battle = (function(){
 
   r.waitForScoiatael = function(side){
     var self = this;
-    self.sendNotification(side.getName() + " decides whos starts first");
+    side.turn();
+    side.foe.wait();
+    self.sendNotification(side.getName() + " decides who starts first");
     side.send("request:chooseWhichSideBegins", null, true);
     side.socket.once("response:chooseWhichSideBegins", function(data){
-      console.log("which side? ", data.side);
+      //console.log("which side? ", data.side);
 
       if(data.side !== "p1" && data.side !== "p2")
         throw new Error("Unknown side property! - ", data.side);
@@ -202,7 +204,7 @@ var Battle = (function(){
   }
 
   r.update = function(){
-    console.log("update called");
+    //console.("update called");
     this._update(this.p1);
     this._update(this.p2);
   }
@@ -333,7 +335,7 @@ var Battle = (function(){
     //check if is nilfgaardian faction ability
     if(this.p1.deck.getFaction() === Deck.FACTION.NILFGAARDIAN_EMPIRE && this.p1.deck.getFaction() !== this.p2.deck.getFaction()){
       this.p2.removeRuby();
-      console.log(this.p1.getName() + " wins the tie! (nilfgaardian ability)");
+      //console.log(this.p1.getName() + " wins the tie! (nilfgaardian ability)");
       this.sendNotification(this.p1.getName() + " wins the tie! (nilfgaardian ability)");
       return {
         loser: this.p2,
@@ -342,7 +344,7 @@ var Battle = (function(){
     }
     if(this.p2.deck.getFaction() === Deck.FACTION.NILFGAARDIAN_EMPIRE && this.p1.deck.getFaction() !== this.p2.deck.getFaction()){
       this.p1.removeRuby();
-      console.log(this.p2.getName() + " wins the tie! (nilfgaardian ability)");
+      //console.log(this.p2.getName() + " wins the tie! (nilfgaardian ability)");
       this.sendNotification(this.p2.getName() + " wins the tie! (nilfgaardian ability)");
       return {
         loser: this.p1,
diff --git a/server/Battleside.js b/server/Battleside.js
index b22ee36..aacabc1 100644
--- a/server/Battleside.js
+++ b/server/Battleside.js
@@ -50,7 +50,7 @@ Battleside = (function(){
       var leaderCard = self.getLeader();
       if(leaderCard.isDisabled()) return;
 
-      console.log("leader activated");
+      //console.log("leader activated");
 
       var ability = leaderCard.getAbility();
 
@@ -740,7 +740,8 @@ Battleside = (function(){
       rndCard = this.getRandomCardOnField();
       if(rndCard) {
         rndCard.__lock = true;
-        console.log("Monsters faction ability triggered!");
+        //console.log("Monsters faction ability triggered!");
+
         this.sendNotification(this.getName() + ": Monsters faction ability triggered! " + rndCard.getName());
       } else {
         this.sendNotification(this.getName() + ": Monsters faction ability triggered! But no card found.");
@@ -848,13 +849,13 @@ Battleside = (function(){
       if(!left) return;
       left--;
       var card = self.hand.remove(id)[0];
-      console.log("hand -> deck: ", card.getName());
+      //console.log("hand -> deck: ", card.getName());
       self.deck.add(card);
       self.deck.shuffle();
       self.draw(1);
       if(!left){
         self.send("redraw:close", null, true);
-        console.log("redraw finished");
+        //console.log("redraw finished");
         deferred.resolve("done");
         //self.socket.off("redraw:reDrawCard", h1);
       }
@@ -863,7 +864,8 @@ Battleside = (function(){
     })
 
     this.receive("redraw:close_client", function(){
-      console.log("redraw finished!");
+      //console.log("redraw finished!");
+      self.wait();
       deferred.resolve("done");
       //self.socket.off("redraw:close_client", h2);
     })
diff --git a/server/Matchmaker.js b/server/Matchmaker.js
index 9bc6d79..8eb9cee 100644
--- a/server/Matchmaker.js
+++ b/server/Matchmaker.js
@@ -52,7 +52,7 @@ var Matchmaker = (function(){
   }
 
   r._getInQueue = function(user){
-    console.log(user.getName() + " joined in queue");
+    //console.log(user.getName() + " joined in queue");
     this._queue.push(user);
     user._inQueue = true;
   }
diff --git a/server/Room.js b/server/Room.js
index 2ddc908..5eb4b2f 100644
--- a/server/Room.js
+++ b/server/Room.js
@@ -17,7 +17,7 @@ var Room = (function(){
     //this.socket = scServer.global;
 
 
-    console.log("room created: " + this.getID());
+    //console.log("room created: " + this.getID());
   };
   var r = Room.prototype;
   /**