mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-21 01:42:15 -07:00
Have the server respect gameType info when setting up zones.
* ServerPlayer::setupZones is now passed the room->getGameTypes(); * ServerPlayer::setupZones now checks if the GameType String includes "Commander" and then sets the life total to 40 instead.
This commit is contained in:
parent
dde2f8b9ad
commit
fb06f1197a
3 changed files with 11 additions and 5 deletions
|
|
@ -323,7 +323,7 @@ void Server_Game::doStartGameIfReady()
|
||||||
}
|
}
|
||||||
for (Server_Player *player : players.values()) {
|
for (Server_Player *player : players.values()) {
|
||||||
if (!player->getSpectator())
|
if (!player->getSpectator())
|
||||||
player->setupZones();
|
player->setupZones(room->getGameTypes());
|
||||||
}
|
}
|
||||||
|
|
||||||
gameStarted = true;
|
gameStarted = true;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
#include "server_player.h"
|
#include "server_player.h"
|
||||||
|
|
||||||
|
#include "../servatrice/src/main.h"
|
||||||
|
#include "../servatrice/src/server_logger.h"
|
||||||
#include "color.h"
|
#include "color.h"
|
||||||
#include "decklist.h"
|
#include "decklist.h"
|
||||||
#include "get_pb_extension.h"
|
#include "get_pb_extension.h"
|
||||||
|
|
@ -162,7 +164,7 @@ int Server_Player::newArrowId() const
|
||||||
return id + 1;
|
return id + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server_Player::setupZones()
|
void Server_Player::setupZones(const QStringList &gameTypes)
|
||||||
{
|
{
|
||||||
// This may need to be customized according to the game rules.
|
// This may need to be customized according to the game rules.
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
@ -178,7 +180,11 @@ void Server_Player::setupZones()
|
||||||
addZone(new Server_CardZone(this, "grave", false, ServerInfo_Zone::PublicZone));
|
addZone(new Server_CardZone(this, "grave", false, ServerInfo_Zone::PublicZone));
|
||||||
addZone(new Server_CardZone(this, "rfg", false, ServerInfo_Zone::PublicZone));
|
addZone(new Server_CardZone(this, "rfg", false, ServerInfo_Zone::PublicZone));
|
||||||
|
|
||||||
addCounter(new Server_Counter(0, "life", makeColor(255, 255, 255), 25, 20));
|
if (gameTypes.contains(QString("Commander"))) {
|
||||||
|
addCounter(new Server_Counter(0, "life", makeColor(255, 255, 255), 25, 40));
|
||||||
|
} else {
|
||||||
|
addCounter(new Server_Counter(0, "life", makeColor(255, 255, 255), 25, 20));
|
||||||
|
}
|
||||||
addCounter(new Server_Counter(1, "w", makeColor(255, 255, 150), 20, 0));
|
addCounter(new Server_Counter(1, "w", makeColor(255, 255, 150), 20, 0));
|
||||||
addCounter(new Server_Counter(2, "u", makeColor(150, 150, 255), 20, 0));
|
addCounter(new Server_Counter(2, "u", makeColor(150, 150, 255), 20, 0));
|
||||||
addCounter(new Server_Counter(3, "b", makeColor(150, 150, 150), 20, 0));
|
addCounter(new Server_Counter(3, "b", makeColor(150, 150, 150), 20, 0));
|
||||||
|
|
@ -904,7 +910,7 @@ Server_Player::cmdUnconcede(const Command_Unconcede & /*cmd*/, ResponseContainer
|
||||||
ges.enqueueGameEvent(event, playerId);
|
ges.enqueueGameEvent(event, playerId);
|
||||||
ges.setGameEventContext(Context_Unconcede());
|
ges.setGameEventContext(Context_Unconcede());
|
||||||
|
|
||||||
setupZones();
|
setupZones(game->getRoom()->getGameTypes());
|
||||||
|
|
||||||
game->sendGameStateToPlayers();
|
game->sendGameStateToPlayers();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ public:
|
||||||
void addCounter(Server_Counter *counter);
|
void addCounter(Server_Counter *counter);
|
||||||
|
|
||||||
void clearZones();
|
void clearZones();
|
||||||
void setupZones();
|
void setupZones(const QStringList& gameTypes);
|
||||||
|
|
||||||
Response::ResponseCode drawCards(GameEventStorage &ges, int number);
|
Response::ResponseCode drawCards(GameEventStorage &ges, int number);
|
||||||
Response::ResponseCode moveCard(GameEventStorage &ges,
|
Response::ResponseCode moveCard(GameEventStorage &ges,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue