From 44ba5363a2789fb6db3d25dffab94048ad855bb4 Mon Sep 17 00:00:00 2001 From: exane Date: Sat, 4 Jul 2015 20:52:20 +0200 Subject: [PATCH] fix --- client/scss/main.scss | 2 +- server/Battle.js | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/client/scss/main.scss b/client/scss/main.scss index 1fab88d..19cef21 100644 --- a/client/scss/main.scss +++ b/client/scss/main.scss @@ -126,7 +126,7 @@ $game-height: 800px; height: 100px; //width: 64px; background-position: 7px 20px; - opacity: 0.8; + opacity: 0.5; } diff --git a/server/Battle.js b/server/Battle.js index 5c824e5..9f235aa 100644 --- a/server/Battle.js +++ b/server/Battle.js @@ -141,12 +141,17 @@ var Battle = (function(){ //console.log("current Turn: ", side.getName()); } + r.getWinner = function() { + return this.p1.getRubies() ? this.p1 : this.p2; + } + r.startNextRound = function(){ var lastRound = this.checkRubies(); var loser = lastRound.loser; var winner = loser.foe; if(this.checkIfIsOver()){ //console.log("its over!"); + var winner = this.getWinner(); this.gameOver(winner); this.update(); return; @@ -356,6 +361,21 @@ var Battle = (function(){ this.p1.removeRuby(); this.p2.removeRuby(); + + /*if(!this.p1.getRubies() && !this.p2.getRubies()) { + return { + loser: Math.random() > 0.5 ? this.p1 : this.p2, + isTie: false + } + } + + if(!this.p1.getRubies()) { + return { + loser: this.p2, + isTie: false + } + } +*/ return { loser: Math.random() > 0.5 ? this.p1 : this.p2, isTie: true