Skip to content
Snippets Groups Projects
Commit 02f134c4 authored by mcmlxxix's avatar mcmlxxix
Browse files

fixed a few bugs with scoring & kill counting

parent 63f94b59
No related branches found
No related tags found
No related merge requests found
...@@ -873,11 +873,13 @@ function Battle(attackFrom,attackTo,gameNumber) ...@@ -873,11 +873,13 @@ function Battle(attackFrom,attackTo,gameNumber)
g.EliminatePlayer(defender,killer); g.EliminatePlayer(defender,killer);
if(killer>=0) if(killer>=0)
{ {
GameLog("player scored a kill: " + system.username(killer));
scores[killer].kills++; scores[killer].kills++;
games.StoreRankings(); games.StoreRankings();
} }
if(killed>=0) if(killed>=0)
{ {
GameLog("player has been killed: " + system.username(killed));
var kname= (killer<0?g.players[attacker].AI.name:system.username(killer)); var kname= (killer<0?g.players[attacker].AI.name:system.username(killer));
DeliverKillMessage(kname,killed,gameNumber); DeliverKillMessage(kname,killed,gameNumber);
} }
......
...@@ -190,7 +190,7 @@ function Map(c,r,p,gn) ...@@ -190,7 +190,7 @@ function Map(c,r,p,gn)
} }
this.AssignPoints= function() //TODO: REWORK SCORING SYSTEM COMPLETELY this.AssignPoints= function() //TODO: REWORK SCORING SYSTEM COMPLETELY
{ {
scores=games.LoadRankings(); games.LoadRankings();
if(this.singlePlayer) if(this.singlePlayer)
{ {
scores[this.winner].wins+=1; scores[this.winner].wins+=1;
...@@ -199,7 +199,7 @@ function Map(c,r,p,gn) ...@@ -199,7 +199,7 @@ function Map(c,r,p,gn)
else else
{ {
var points=this.players.length<5?1:2; var points=this.players.length<5?1:2;
scores[this.winner].score+=points; scores[this.winner].score=parseInt(scores[this.winner].score) + points;
GameLog("giving " + points + " points to user " + this.winner); GameLog("giving " + points + " points to user " + this.winner);
} }
games.StoreRankings(); games.StoreRankings();
...@@ -212,7 +212,7 @@ function Map(c,r,p,gn) ...@@ -212,7 +212,7 @@ function Map(c,r,p,gn)
this.lastEliminator=eliminator; this.lastEliminator=eliminator;
if(dead.user>0) if(dead.user>0)
{ {
scores=games.LoadRankings(); games.LoadRankings();
if(this.singlePlayer) if(this.singlePlayer)
{ {
scores[dead.user].losses+=1; scores[dead.user].losses+=1;
...@@ -224,8 +224,8 @@ function Map(c,r,p,gn) ...@@ -224,8 +224,8 @@ function Map(c,r,p,gn)
var pointBuffer=7-this.maxPlayers; var pointBuffer=7-this.maxPlayers;
var offset=(this.players.length<5?2:1); var offset=(this.players.length<5?2:1);
pts=points[pointBuffer+(this.eliminated.length-offset)]; pts=points[pointBuffer+(this.eliminated.length-offset)];
scores[dead.user].score+=pts; scores[dead.user].score=parseInt(scores[dead.user].score) + pts;
if(scores[dead.user].score<minScore) scores[dead.user].score=minScore; if(scores[dead.user].score<minScore) scores[dead.user].score=parseInt(minScore);
GameLog("giving " + pts + " points to user " + system.username(dead.user)); GameLog("giving " + pts + " points to user " + system.username(dead.user));
} }
games.StoreRankings(); games.StoreRankings();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment