diff --git a/cockatrice/src/client.cpp b/cockatrice/src/client.cpp
index 7b0136a0..1e05f3f7 100644
--- a/cockatrice/src/client.cpp
+++ b/cockatrice/src/client.cpp
@@ -340,9 +340,9 @@ PendingCommand *Client::delCounter(const QString &counter)
return cmd(QString("del_counter|%1").arg(counter));
}
-PendingCommand *Client::setActivePlayer(int player)
+PendingCommand *Client::nextTurn()
{
- return cmd(QString("set_active_player|%1").arg(player));
+ return cmd(QString("next_turn"));
}
PendingCommand *Client::setActivePhase(int phase)
diff --git a/cockatrice/src/client.h b/cockatrice/src/client.h
index 706aea58..8939fd38 100644
--- a/cockatrice/src/client.h
+++ b/cockatrice/src/client.h
@@ -89,6 +89,7 @@ public:
void connectToServer(const QString &hostname, unsigned int port, const QString &_playerName, const QString &_password);
void disconnectFromServer();
+public slots:
PendingCommand *listGames();
PendingCommand *listPlayers();
PendingCommand *createGame(const QString &description, const QString &password, unsigned int maxPlayers);
@@ -107,11 +108,10 @@ public:
PendingCommand *addCounter(const QString &counter, QColor color, int value);
PendingCommand *setCounter(const QString &counter, int value);
PendingCommand *delCounter(const QString &counter);
- PendingCommand *setActivePlayer(int player);
+ PendingCommand *nextTurn();
PendingCommand *setActivePhase(int phase);
PendingCommand *dumpZone(int player, const QString &zone, int numberCards);
PendingCommand *stopDumpZone(int player, const QString &zone);
-public slots:
void submitDeck(const QStringList &deck);
};
diff --git a/cockatrice/src/game.cpp b/cockatrice/src/game.cpp
index cd61eeb6..90fc9dcf 100644
--- a/cockatrice/src/game.cpp
+++ b/cockatrice/src/game.cpp
@@ -240,7 +240,7 @@ void Game::gameEvent(const ServerEventData &msg)
case eventSetActivePhase: {
QStringList data = msg.getEventData();
int phase = data[0].toInt();
- emit setActivePhase(p, phase);
+ emit setActivePhase(phase);
break;
}
diff --git a/cockatrice/src/game.h b/cockatrice/src/game.h
index ca58545f..99e7357d 100644
--- a/cockatrice/src/game.h
+++ b/cockatrice/src/game.h
@@ -79,7 +79,7 @@ signals:
void logDumpZone(Player *player, QString zoneName, QString zoneOwner, int numberCards);
void logStopDumpZone(Player *player, QString zoneName, QString zoneOwner);
void logSetActivePlayer(Player *player);
- void setActivePhase(Player *player, int phase);
+ void setActivePhase(int phase);
public:
Game(CardDatabase *_db, Client *_client, QGraphicsScene *_scene, QMenu *_actionsMenu, QMenu *_cardMenu, int playerId, const QString &playerName, QObject *parent = 0);
~Game();
diff --git a/cockatrice/src/messagelogwidget.cpp b/cockatrice/src/messagelogwidget.cpp
index b2d07898..6502d138 100644
--- a/cockatrice/src/messagelogwidget.cpp
+++ b/cockatrice/src/messagelogwidget.cpp
@@ -207,9 +207,23 @@ void MessageLogWidget::logSetActivePlayer(Player *player)
append("---");
}
-void MessageLogWidget::logSetActivePhase(Player *player, int phase)
+void MessageLogWidget::logSetActivePhase(int phase)
{
- append("" + tr("It is now the %1 phase.").arg(phase) + "");
+ QString phaseName;
+ switch (phase) {
+ case 0: phaseName = tr("untap step"); break;
+ case 1: phaseName = tr("upkeep step"); break;
+ case 2: phaseName = tr("draw step"); break;
+ case 3: phaseName = tr("first main phase"); break;
+ case 4: phaseName = tr("beginning of combat step"); break;
+ case 5: phaseName = tr("declare attackers step"); break;
+ case 6: phaseName = tr("declare blockers step"); break;
+ case 7: phaseName = tr("combat damage step"); break;
+ case 8: phaseName = tr("end of combat step"); break;
+ case 9: phaseName = tr("second main phase"); break;
+ case 10: phaseName = tr("end of turn step"); break;
+ }
+ append("" + tr("It is now the %1.").arg(phaseName) + "");
}
void MessageLogWidget::connectToGame(Game *game)
@@ -232,7 +246,7 @@ void MessageLogWidget::connectToGame(Game *game)
connect(game, SIGNAL(logDumpZone(Player *, QString, QString, int)), this, SLOT(logDumpZone(Player *, QString, QString, int)));
connect(game, SIGNAL(logStopDumpZone(Player *, QString, QString)), this, SLOT(logStopDumpZone(Player *, QString, QString)));
connect(game, SIGNAL(logSetActivePlayer(Player *)), this, SLOT(logSetActivePlayer(Player *)));
- connect(game, SIGNAL(setActivePhase(Player *, int)), this, SLOT(logSetActivePhase(Player *, int)));
+ connect(game, SIGNAL(setActivePhase(int)), this, SLOT(logSetActivePhase(int)));
}
MessageLogWidget::MessageLogWidget(QWidget *parent)
diff --git a/cockatrice/src/messagelogwidget.h b/cockatrice/src/messagelogwidget.h
index 5e42f9e0..027cb1b4 100644
--- a/cockatrice/src/messagelogwidget.h
+++ b/cockatrice/src/messagelogwidget.h
@@ -38,7 +38,7 @@ private slots:
void logDumpZone(Player *player, QString zoneName, QString zoneOwner, int numberCards);
void logStopDumpZone(Player *player, QString zoneName, QString zoneOwner);
void logSetActivePlayer(Player *player);
- void logSetActivePhase(Player *player, int phase);
+ void logSetActivePhase(int phase);
public:
void connectToGame(Game *game);
MessageLogWidget(QWidget *parent = 0);
diff --git a/cockatrice/src/phasestoolbar.cpp b/cockatrice/src/phasestoolbar.cpp
index 5bd1b785..53060474 100644
--- a/cockatrice/src/phasestoolbar.cpp
+++ b/cockatrice/src/phasestoolbar.cpp
@@ -1,12 +1,11 @@
#include "phasestoolbar.h"
#include
#include
-#include
#include
#include
PhaseButton::PhaseButton(QIcon icon)
- : QPushButton(icon, QString())
+ : QPushButton(icon, QString()), active(false)
{
}
@@ -19,27 +18,23 @@ void PhaseButton::update()
void PhaseButton::paintEvent(QPaintEvent *event)
{
QPushButton::paintEvent(event);
- if (isChecked()) {
+ if (active) {
QPainter painter(this);
int height = size().height();
int width = size().width();
QPen pen;
- pen.setWidth(3);
- pen.setColor(QColor::fromRgb(180, 0, 0));
+ pen.setColor(QColor::fromRgb(180, 0, 0, 200));
painter.setPen(pen);
-// painter.setPen(QColor(0, 0, 0, 0));
QRadialGradient grad(QPointF(0.5, 0.5), 0.5);
grad.setCoordinateMode(QGradient::ObjectBoundingMode);
grad.setColorAt(0, QColor(180, 0, 0, 0));
grad.setColorAt(0.8, QColor(180, 0, 0, 0));
- grad.setColorAt(1, QColor(180, 0, 0, 255));
+ grad.setColorAt(1, QColor(180, 0, 0, 200));
painter.setBrush(QBrush(grad));
-// painter.drawEllipse(QRect(0, 0, width, height));
painter.drawRect(3, 3, width - 7, height - 7);
-
}
}
@@ -69,38 +64,34 @@ PhasesToolbar::PhasesToolbar(QWidget *parent)
<< main2Button << cleanupButton;
for (int i = 0; i < buttonList.size(); ++i) {
- buttonList[i]->setCheckable(true);
- buttonList[i]->setIconSize(QSize(40, 40));
+ buttonList[i]->setIconSize(QSize(36, 36));
+ connect(buttonList[i], SIGNAL(clicked()), this, SLOT(phaseButtonClicked()));
}
QPushButton *nextTurnButton = new QPushButton(QIcon(":/resources/icon_nextturn.svg"), QString());
- nextTurnButton->setIconSize(QSize(40, 40));
+ nextTurnButton->setIconSize(QSize(36, 36));
+ connect(nextTurnButton, SIGNAL(clicked()), this, SIGNAL(signalNextTurn()));
QVBoxLayout *layout = new QVBoxLayout;
layout->setSpacing(0);
- QButtonGroup *bg = new QButtonGroup;
- for (int i = 0; i < buttonList.size(); ++i) {
- bg->addButton(buttonList[i]);
- }
-
layout->addStretch(1);
layout->addWidget(untapButton);
layout->addWidget(upkeepButton);
layout->addWidget(drawButton);
- layout->addSpacing(15);
+ layout->addSpacing(10);
layout->addWidget(main1Button);
- layout->addSpacing(15);
+ layout->addSpacing(10);
layout->addWidget(combatStartButton);
layout->addWidget(combatAttackersButton);
layout->addWidget(combatBlockersButton);
layout->addWidget(combatDamageButton);
layout->addWidget(combatEndButton);
- layout->addSpacing(15);
+ layout->addSpacing(10);
layout->addWidget(main2Button);
- layout->addSpacing(15);
+ layout->addSpacing(10);
layout->addWidget(cleanupButton);
- layout->addSpacing(25);
+ layout->addSpacing(20);
layout->addWidget(nextTurnButton);
layout->addStretch(1);
@@ -122,3 +113,18 @@ void PhasesToolbar::retranslateUi()
buttonList[9]->setPhaseText(tr("Second main phase"));
buttonList[10]->setPhaseText(tr("End of turn step"));
}
+
+void PhasesToolbar::setActivePhase(int phase)
+{
+ if (phase >= buttonList.size())
+ return;
+
+ for (int i = 0; i < buttonList.size(); ++i)
+ buttonList[i]->setActive(i == phase);
+}
+
+void PhasesToolbar::phaseButtonClicked()
+{
+ PhaseButton *button = qobject_cast(sender());
+ emit signalSetPhase(buttonList.indexOf(button));
+}
diff --git a/cockatrice/src/phasestoolbar.h b/cockatrice/src/phasestoolbar.h
index 60cd0a7d..b4ea6ff2 100644
--- a/cockatrice/src/phasestoolbar.h
+++ b/cockatrice/src/phasestoolbar.h
@@ -5,15 +5,19 @@
#include
#include
+class Player;
+
class PhaseButton : public QPushButton {
Q_OBJECT
private:
QString phaseText;
+ bool active;
public:
PhaseButton();
PhaseButton(QIcon);
void setPhaseText(const QString &_phaseText);
QString getPhaseText() const { return phaseText; }
+ void setActive(bool _active) { active = _active; update(); }
public slots:
void update();
protected:
@@ -22,11 +26,18 @@ protected:
class PhasesToolbar : public QFrame {
Q_OBJECT
+private:
+ QList buttonList;
public:
PhasesToolbar(QWidget *parent = 0);
void retranslateUi();
-private:
- QList buttonList;
+public slots:
+ void setActivePhase(int phase);
+private slots:
+ void phaseButtonClicked();
+signals:
+ void signalSetPhase(int phase);
+ void signalNextTurn();
};
#endif
diff --git a/cockatrice/src/window_main.cpp b/cockatrice/src/window_main.cpp
index b31adf25..8c5043c6 100644
--- a/cockatrice/src/window_main.cpp
+++ b/cockatrice/src/window_main.cpp
@@ -68,6 +68,7 @@ void MainWindow::statusChanged(ProtocolStatus _status)
aDisconnect->setEnabled(false);
aRestartGame->setEnabled(false);
aLeaveGame->setEnabled(false);
+ phasesToolbar->setEnabled(false);
emit logDisconnected();
break;
case StatusLoggingIn:
@@ -81,11 +82,13 @@ void MainWindow::statusChanged(ProtocolStatus _status)
}
aRestartGame->setEnabled(false);
aLeaveGame->setEnabled(false);
+ phasesToolbar->setEnabled(false);
GameSelector *gameSelector = new GameSelector(client);
viewLayout->insertWidget(0, gameSelector);
}
case StatusPlaying:
+ phasesToolbar->setEnabled(true);
break;
default:
break;
@@ -166,6 +169,7 @@ void MainWindow::playerIdReceived(int id, QString name)
connect(game, SIGNAL(hoverCard(QString)), this, SLOT(hoverCard(QString)));
connect(game, SIGNAL(playerAdded(Player *)), this, SLOT(playerAdded(Player *)));
connect(game, SIGNAL(playerRemoved(Player *)), this, SLOT(playerRemoved(Player *)));
+ connect(game, SIGNAL(setActivePhase(int)), phasesToolbar, SLOT(setActivePhase(int)));
playerAdded(game->getLocalPlayer());
messageLog->connectToGame(game);
@@ -289,7 +293,8 @@ MainWindow::MainWindow(QTranslator *_translator, QWidget *parent)
viewLayout = new QVBoxLayout;
viewLayout->addWidget(view);
- PhasesToolbar *phasesToolbar = new PhasesToolbar;
+ phasesToolbar = new PhasesToolbar;
+ phasesToolbar->setEnabled(false);
QHBoxLayout *mainLayout = new QHBoxLayout;
mainLayout->addWidget(phasesToolbar);
@@ -312,6 +317,8 @@ MainWindow::MainWindow(QTranslator *_translator, QWidget *parent)
connect(this, SIGNAL(logDisconnected()), messageLog, SLOT(logDisconnected()));
connect(client, SIGNAL(logSocketError(const QString &)), messageLog, SLOT(logSocketError(const QString &)));
connect(client, SIGNAL(serverError(ServerResponse)), messageLog, SLOT(logServerError(ServerResponse)));
+ connect(phasesToolbar, SIGNAL(signalSetPhase(int)), client, SLOT(setActivePhase(int)));
+ connect(phasesToolbar, SIGNAL(signalNextTurn()), client, SLOT(nextTurn()));
createActions();
createMenus();
diff --git a/cockatrice/src/window_main.h b/cockatrice/src/window_main.h
index 1ab9723c..460ca2bc 100644
--- a/cockatrice/src/window_main.h
+++ b/cockatrice/src/window_main.h
@@ -39,6 +39,7 @@ class QPushButton;
class ServerZoneCard;
class ZoneViewLayout;
class ZoneViewWidget;
+class PhasesToolbar;
class MainWindow : public QMainWindow {
Q_OBJECT
@@ -78,6 +79,7 @@ private:
MessageLogWidget *messageLog;
QLabel *sayLabel;
QLineEdit *sayEdit;
+ PhasesToolbar *phasesToolbar;
Client *client;
QGraphicsScene *scene;
diff --git a/cockatrice/translations/cockatrice_de.ts b/cockatrice/translations/cockatrice_de.ts
index c7ab7470..7a81997c 100644
--- a/cockatrice/translations/cockatrice_de.ts
+++ b/cockatrice/translations/cockatrice_de.ts
@@ -232,27 +232,27 @@
DlgSettings
-
+
Settings
Einstellungen
-
+
General
Allgemeines
-
+
Appearance
Erscheinungsbild
-
+
Messages
Nachrichten
-
+
&Close
S&chließen
@@ -446,48 +446,48 @@
F10
-
+
Set life
Setze Leben
-
+
New life total:
Neues Leben insgesammt:
-
+
Roll dice
Würfeln
-
+
Number of sides:
Anzahl der Seiten:
-
+
Draw cards
Karten ziehen
-
-
+
+
Number:
Anzahl:
-
+
Create token
Token erstellen
-
+
Name:
Name:
-
+
Set counters
Setze Zählmarke
@@ -566,46 +566,51 @@
GeneralSettingsPage
-
-
-
-
+
+
+
+
Choose path
Pfad auswählen
-
+
Personal settings
Persönliche Einstellungen
-
+
Language:
Sprache:
-
+
+ Download card pictures on the fly
+ Kartenbilder dynamisch herunterladen
+
+
+
Paths
Pfade
-
+
Decks directory:
Verzeichnis mit Decklisten:
-
+
Pictures directory:
Verzeichnis mit Bilddateien:
-
+
Path to card database:
Pfad zur Kartendatenbank:
-
-
+
+
English
Deutsch
@@ -613,92 +618,92 @@
MainWindow
-
+
Error
Fehler
-
+
Server timeout
Server Zeitüberschreitung
-
+
&Connect...
&Verbinden...
-
+
&Disconnect
Verbindung &trennen
-
+
&Restart game...
Spiel neu sta&rten...
-
+
F2
F2
-
+
&Leave game
Spiel ver&lassen
-
+
&Deck editor
&Deck-Editor
-
+
&Full screen
&Vollbild
-
+
Ctrl+F
Ctrl+F
-
+
&Settings...
&Einstellungen...
-
+
&Exit
&Beenden
-
+
Close most recent zone view
Letzte Zonenansicht schließen
-
+
Esc
Esc
-
+
&Game
Spi&el
-
+
&Actions
&Aktionen
-
+
&Card
&Karte
-
+
&Say:
&Sagen:
@@ -771,106 +776,176 @@
%1 zieht %2 Karten
-
+
+ a card
+ eine Karte
+
+
+
from table
vom Spielfeld
-
+
from graveyard
aus dem Friedhof
-
+
from exile
aus dem Exil
-
+
from hand
von der Hand
-
+
from the bottom of his library
von der Unterseite seiner Bibliothek
-
+
from the top of his library
oben von seiner Bibliothek
-
+
from library
von der Bibliothek
-
+
from sideboard
aus seinem Sideboard
-
+
%1 puts %2 into play %3
%1 bringt %2 %3 ins Spiel
-
+
%1 puts %2 %3 into graveyard
%1 legt %2 %3 in den Friedhof
-
+
%1 exiles %2 %3
%1 schickt %2 %3 ins Exil
-
+
%1 moves %2 %3 to hand
%1 nimmt %2 %3 auf die Hand
-
+
%1 puts %2 %3 into his library
%1 legt %2 %3 in seine Bibliothek
-
+
%1 puts %2 %3 on bottom of his library
%1 legt %2 %3 unter seine Bibliothek
-
+
%1 puts %2 %3 on top of his library
%1 legt %2 %3 auf die Bibliothek
-
+
%1 puts %2 %3 into his library at position %4
%1 legt %2 %3 in seine Bibliothek an Stelle %4
-
+
%1 moves %2 %3 to sideboard
%1 legt %2 %3 in sein Sideboard
-
+
%1 stops looking at %2's %3
%1 sieht sich %2s %3 nicht mehr an
+
+
+ It is now %1's turn.
+ %1 ist am Zug.
+
+
+
+ untap step
+ das Enttappsegment
+
+
+
+ upkeep step
+ das Versorgungssegment
+
+
+
+ draw step
+ das Ziehsegment
+
+
+
+ first main phase
+ die erste Hauptphase
+
+
+
+ beginning of combat step
+ das Anfangssegment der Kampfphase
+
+
+
+ declare attackers step
+ das Angreifer-Deklarieren-Segment
+
+
+
+ declare blockers step
+ das Blocker-Deklarieren-Segment
+
+
+
+ combat damage step
+ das Kampfschadenssegment
+
+
+
+ end of combat step
+ das Endsegment der Kampfphase
+
+
+
+ second main phase
+ die zweite Hauptphase
+
+
+
+ end of turn step
+ das Ende-des-Zuges-Segment
+
+
+
+ It is now the %1.
+ Es ist nun %1.
+
%1 moves %2 %3 to %4
%1 bewegt %2 %3 nach %4
-
+
taps
tappt
-
+
untaps
enttappt
@@ -883,52 +958,52 @@
%1 bewegt %2 von %3 nach %4
-
+
%1 creates token: %2
%1 erstellt Token: %2
-
+
%1 places %2 counters on %3 (now %4)
%1 legt %2 Zählmarken auf %3 (jetzt %4)
-
+
%1 removes %2 counters from %3 (now %4)
%1 entfernt %2 Zählmarken von %3 (jetzt %4)
-
+
his permanents
seine bleibenden Karten
-
+
%1 %2 %3
%1 %2 %3
-
+
%1 sets counter "%2" to %3 (%4%5)
%1 setzt Zähler "%2" auf %3 (%4%5)
-
+
%1 sets %2 to not untap normally.
%1 setzt %2 auf explizites Enttappen.
-
+
%1 sets %2 to untap normally.
%1 setzt %2 auf normales Enttappen.
-
+
%1 is looking at the top %2 cards of %3's %4
%1 sieht sich die obersten %2 Karten von %3s %4 an
-
+
%1 is looking at %2's %3
%1 sieht sich %2s %3 an
@@ -936,12 +1011,12 @@
MessagesSettingsPage
-
+
&Add
&Hinzufügen
-
+
&Remove
&Entfernen
@@ -954,16 +1029,74 @@
Entfernen
-
+
Add message
Nachricht hinzufügen
-
+
Message:
Nachricht:
+
+ PhasesToolbar
+
+
+ Untap step
+ Enttappsegment
+
+
+
+ Upkeep step
+ Versorgungssegment
+
+
+
+ Draw step
+ Ziehsegment
+
+
+
+ First main phase
+ erste Hauptphase
+
+
+
+ Beginning of combat step
+ Anfangssegment der Kampfphase
+
+
+
+ Declare attackers step
+ Angreifer-Deklarieren-Segment
+
+
+
+ Declare blockers step
+ Blocker-Deklarieren-Segment
+
+
+
+ Combat damage step
+ Kampfschadenssegment
+
+
+
+ End of combat step
+ Endsegment der Kampfphase
+
+
+
+ Second main phase
+ zweite Hauptphase
+
+
+
+ End of turn step
+ Ende-des-Zuges-Segment
+
+
Player
diff --git a/cockatrice/translations/cockatrice_en.ts b/cockatrice/translations/cockatrice_en.ts
index 537f6d21..bb499640 100644
--- a/cockatrice/translations/cockatrice_en.ts
+++ b/cockatrice/translations/cockatrice_en.ts
@@ -173,27 +173,27 @@
DlgSettings
-
+
Settings
-
+
General
-
+
Appearance
-
+
Messages
-
+
&Close
@@ -379,48 +379,48 @@
-
+
Set life
-
+
New life total:
-
+
Roll dice
-
+
Number of sides:
-
+
Draw cards
-
-
+
+
Number:
-
+
Create token
-
+
Name:
-
+
Set counters
@@ -499,46 +499,51 @@
GeneralSettingsPage
-
-
-
-
+
+
+
+
Choose path
-
+
Personal settings
-
+
Language:
-
+
+ Download card pictures on the fly
+
+
+
+
Paths
-
+
Decks directory:
-
+
Pictures directory:
-
+
Path to card database:
-
-
+
+
English
English
@@ -546,92 +551,92 @@
MainWindow
-
+
Error
-
+
Server timeout
-
+
&Connect...
-
+
&Disconnect
-
+
&Restart game...
-
+
F2
-
+
&Leave game
-
+
&Deck editor
-
+
&Full screen
-
+
Ctrl+F
-
+
&Settings...
-
+
&Exit
-
+
Close most recent zone view
-
+
Esc
-
+
&Game
-
+
&Actions
-
+
&Card
-
+
&Say:
@@ -704,152 +709,222 @@
-
+
+ a card
+
+
+
+
from table
-
+
from graveyard
-
+
from exile
-
+
from hand
-
+
from the bottom of his library
-
+
from the top of his library
-
+
from library
-
+
from sideboard
-
+
%1 puts %2 into play %3
-
+
%1 puts %2 %3 into graveyard
-
+
%1 exiles %2 %3
-
+
%1 moves %2 %3 to hand
-
+
%1 puts %2 %3 into his library
-
+
%1 puts %2 %3 on bottom of his library
-
+
%1 puts %2 %3 on top of his library
-
+
%1 puts %2 %3 into his library at position %4
-
+
%1 moves %2 %3 to sideboard
-
+
%1 stops looking at %2's %3
-
+
+ It is now %1's turn.
+
+
+
+
+ untap step
+
+
+
+
+ upkeep step
+
+
+
+
+ draw step
+
+
+
+
+ first main phase
+
+
+
+
+ beginning of combat step
+
+
+
+
+ declare attackers step
+
+
+
+
+ declare blockers step
+
+
+
+
+ combat damage step
+
+
+
+
+ end of combat step
+
+
+
+
+ second main phase
+
+
+
+
+ end of turn step
+
+
+
+
+ It is now the %1.
+
+
+
+
%1 creates token: %2
-
+
%1 places %2 counters on %3 (now %4)
-
+
%1 removes %2 counters from %3 (now %4)
-
+
%1 %2 %3
-
+
taps
-
+
untaps
-
+
%1 sets counter "%2" to %3 (%4%5)
-
+
%1 sets %2 to not untap normally.
-
+
%1 sets %2 to untap normally.
-
+
%1 is looking at the top %2 cards of %3's %4
-
+
%1 is looking at %2's %3
-
+
his permanents
@@ -857,26 +932,84 @@
MessagesSettingsPage
-
+
&Add
-
+
&Remove
-
+
Add message
-
+
Message:
+
+ PhasesToolbar
+
+
+ Untap step
+
+
+
+
+ Upkeep step
+
+
+
+
+ Draw step
+
+
+
+
+ First main phase
+
+
+
+
+ Beginning of combat step
+
+
+
+
+ Declare attackers step
+
+
+
+
+ Declare blockers step
+
+
+
+
+ Combat damage step
+
+
+
+
+ End of combat step
+
+
+
+
+ Second main phase
+
+
+
+
+ End of turn step
+
+
+
Player
diff --git a/servatrice/src/servergame.cpp b/servatrice/src/servergame.cpp
index 37c74d80..b57d8c32 100644
--- a/servatrice/src/servergame.cpp
+++ b/servatrice/src/servergame.cpp
@@ -108,10 +108,9 @@ void ServerGame::startGameIfReady()
for (int i = 0; i < players.size(); i++)
players.at(i)->setupZones();
- activePlayer = 0;
- activePhase = 0;
gameStarted = true;
broadcastEvent("game_start", NULL);
+ setActivePlayer(0);
}
void ServerGame::addPlayer(ServerSocket *player)
diff --git a/servatrice/src/serversocket.cpp b/servatrice/src/serversocket.cpp
index 307ab363..de101f95 100644
--- a/servatrice/src/serversocket.cpp
+++ b/servatrice/src/serversocket.cpp
@@ -212,7 +212,7 @@ const ServerSocket::CommandProperties ServerSocket::commandList[ServerSocket::nu
{"stop_dump_zone", true, true, true, QList() << QVariant::Int
<< QVariant::String, &ServerSocket::cmdStopDumpZone},
{"roll_dice", true, true, true, QList() << QVariant::Int, &ServerSocket::cmdRollDice},
- {"set_active_player", true, true, true, QList() << QVariant::Int, &ServerSocket::cmdSetActivePlayer},
+ {"next_turn", true, true, true, QList(), &ServerSocket::cmdNextTurn},
{"set_active_phase", true, true, true, QList() << QVariant::Int, &ServerSocket::cmdSetActivePhase}
};
@@ -603,13 +603,12 @@ ReturnMessage::ReturnCode ServerSocket::cmdRollDice(const QList ¶m
return ReturnMessage::ReturnOk;
}
-ReturnMessage::ReturnCode ServerSocket::cmdSetActivePlayer(const QList ¶ms)
+ReturnMessage::ReturnCode ServerSocket::cmdNextTurn(const QList ¶ms)
{
- int active_player = params[0].toInt();
- if (!game->getPlayer(active_player))
- return ReturnMessage::ReturnContextError;
- game->setActivePlayer(active_player);
- emit broadcastEvent(QString("set_active_player|%1").arg(active_player), this);
+ int activePlayer = game->getActivePlayer();
+ if (++activePlayer == game->getPlayerCount())
+ activePlayer = 0;
+ game->setActivePlayer(activePlayer);
return ReturnMessage::ReturnOk;
}
@@ -620,7 +619,6 @@ ReturnMessage::ReturnCode ServerSocket::cmdSetActivePhase(const QList
if (game->getActivePlayer() != playerId)
return ReturnMessage::ReturnContextError;
game->setActivePhase(active_phase);
- emit broadcastEvent(QString("set_active_phase|%1").arg(active_phase), this);
return ReturnMessage::ReturnOk;
}
diff --git a/servatrice/src/serversocket.h b/servatrice/src/serversocket.h
index 2330f064..1b7b1874 100644
--- a/servatrice/src/serversocket.h
+++ b/servatrice/src/serversocket.h
@@ -83,7 +83,7 @@ private:
ReturnMessage::ReturnCode cmdDumpZone(const QList ¶ms);
ReturnMessage::ReturnCode cmdStopDumpZone(const QList ¶ms);
ReturnMessage::ReturnCode cmdRollDice(const QList ¶ms);
- ReturnMessage::ReturnCode cmdSetActivePlayer(const QList ¶ms);
+ ReturnMessage::ReturnCode cmdNextTurn(const QList ¶ms);
ReturnMessage::ReturnCode cmdSetActivePhase(const QList ¶ms);
Server *server;