Show whether you are alive or dead in the top right.

This commit is contained in:
UnknownShadow200 2016-03-27 21:51:55 +11:00
parent 496327853a
commit effafece44
3 changed files with 16 additions and 8 deletions

View File

@ -69,6 +69,7 @@ namespace MCGalaxy.Games {
CurLevel.ChatLevel(first.color + first.name + " %Sstarted the infection!"); CurLevel.ChatLevel(first.color + first.name + " %Sstarted the infection!");
first.infected = true; first.infected = true;
PlayerMoneyChanged(first);
UpdatePlayerColor(first, InfectCol); UpdatePlayerColor(first, InfectCol);
RoundInProgress = true; RoundInProgress = true;
@ -282,12 +283,14 @@ namespace MCGalaxy.Games {
if (!pl.level.name.CaselessEq(CurLevelName)) continue; if (!pl.level.name.CaselessEq(CurLevelName)) continue;
bool inBlock = pl.CheckIfInsideBlock(); bool inBlock = pl.CheckIfInsideBlock();
if (!inBlock && alive.Length == 0) { if (pl.CheckIfInsideBlock()) {
money = -1;
} else if (alive.Length == 0) {
money = rand.Next(1, 5 + pl.playersInfected); money = rand.Next(1, 5 + pl.playersInfected);
} else if (!inBlock && (alive.Length == 1 && !pl.infected)) { } else if (alive.Length == 1 && !pl.infected) {
money = rand.Next(5, 15); money = rand.Next(5, 15);
} else if (inBlock) { } else if (alive.Length > 1 && !pl.infected) {
money = -1; money = rand.Next(2, 6);
} }
Player.GlobalDespawn(pl, false); Player.GlobalDespawn(pl, false);

View File

@ -147,7 +147,7 @@ namespace MCGalaxy.Games {
if (CurLevel.Authors != "") if (CurLevel.Authors != "")
p.SendMessage("It was created by " + CurLevel.Authors); p.SendMessage("It was created by " + CurLevel.Authors);
p.SendCpeMessage(CpeMessageType.Status3, "%SYou have &a" + p.money + " %S" + Server.moneys); PlayerMoneyChanged(p);
UpdatePlayerStatus(p); UpdatePlayerStatus(p);
if (Server.votingforlevel) if (Server.votingforlevel)
@ -165,9 +165,10 @@ namespace MCGalaxy.Games {
} }
public override void PlayerMoneyChanged(Player p) { public override void PlayerMoneyChanged(Player p) {
if (Status == ZombieGameStatus.NotStarted if (Status == ZombieGameStatus.NotStarted || !p.level.name.CaselessEq(CurLevelName)) return;
|| !p.level.name.CaselessEq(CurLevelName)) return; string moneyMsg = "&a" + p.money + " %S" + Server.moneys;
p.SendCpeMessage(CpeMessageType.Status3, "%SYou have &a" + p.money + " %S" + Server.moneys); string stateMsg = " and you are " + (p.infected ? "&cdead" : "&aalive");
p.SendCpeMessage(CpeMessageType.Status3, moneyMsg + stateMsg);
} }
} }
} }

View File

@ -147,18 +147,22 @@ namespace MCGalaxy.Games {
if (!RoundInProgress || p == null) return; if (!RoundInProgress || p == null) return;
Infected.Add(p); Infected.Add(p);
Alive.Remove(p); Alive.Remove(p);
p.infected = true; p.infected = true;
UpdatePlayerColor(p, Colors.red); UpdatePlayerColor(p, Colors.red);
UpdateAllPlayerStatus(); UpdateAllPlayerStatus();
PlayerMoneyChanged(p);
} }
public void DisinfectPlayer(Player p) { public void DisinfectPlayer(Player p) {
if (!RoundInProgress || p == null) return; if (!RoundInProgress || p == null) return;
Infected.Remove(p); Infected.Remove(p);
Alive.Add(p); Alive.Add(p);
p.infected = false; p.infected = false;
UpdatePlayerColor(p, p.color); UpdatePlayerColor(p, p.color);
UpdateAllPlayerStatus(); UpdateAllPlayerStatus();
PlayerMoneyChanged(p);
} }
void ChangeLevel(string next) { void ChangeLevel(string next) {