mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 00:54:53 -07:00
arrows can target players; card attachment works
This commit is contained in:
parent
61b82bd6f9
commit
614f106304
32 changed files with 885 additions and 402 deletions
|
|
@ -316,7 +316,8 @@ void TabGame::startGame()
|
|||
void TabGame::stopGame()
|
||||
{
|
||||
currentPhase = -1;
|
||||
|
||||
activePlayer = -1;
|
||||
|
||||
playerListWidget->setActivePlayer(-1);
|
||||
playerListWidget->setGameStarted(false);
|
||||
started = false;
|
||||
|
|
@ -365,6 +366,16 @@ void TabGame::eventGameStateChanged(Event_GameStateChanged *event, GameEventCont
|
|||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < plList.size(); ++i) {
|
||||
ServerInfo_Player *pl = plList[i];
|
||||
ServerInfo_PlayerProperties *prop = pl->getProperties();
|
||||
if (!prop->getSpectator()) {
|
||||
Player *player = players.value(prop->getPlayerId(), 0);
|
||||
if (!player)
|
||||
continue;
|
||||
player->processCardAttachment(pl);
|
||||
}
|
||||
}
|
||||
if (event->getGameStarted() && !started) {
|
||||
startGame();
|
||||
if (!resuming)
|
||||
|
|
@ -444,6 +455,7 @@ Player *TabGame::setActivePlayer(int id)
|
|||
Player *player = players.value(id, 0);
|
||||
if (!player)
|
||||
return 0;
|
||||
activePlayer = id;
|
||||
playerListWidget->setActivePlayer(id);
|
||||
QMapIterator<int, Player *> i(players);
|
||||
while (i.hasNext()) {
|
||||
|
|
@ -547,3 +559,33 @@ void TabGame::sideboardPlanChanged()
|
|||
QList<MoveCardToZone *> newPlan = deckView->getSideboardPlan();
|
||||
client->sendCommand(new Command_SetSideboardPlan(gameId, newPlan));
|
||||
}
|
||||
|
||||
CardItem *TabGame::getCard(int playerId, const QString &zoneName, int cardId) const
|
||||
{
|
||||
Player *player = players.value(playerId, 0);
|
||||
if (!player)
|
||||
return 0;
|
||||
|
||||
CardZone *zone = player->getZones().value(zoneName, 0);
|
||||
if (!zone)
|
||||
return 0;
|
||||
|
||||
return zone->getCard(cardId, QString());
|
||||
}
|
||||
|
||||
Player *TabGame::getActiveLocalPlayer() const
|
||||
{
|
||||
Player *active = players.value(activePlayer, 0);
|
||||
if (active)
|
||||
if (active->getLocal())
|
||||
return active;
|
||||
|
||||
QMapIterator<int, Player *> playerIterator(players);
|
||||
while (playerIterator.hasNext()) {
|
||||
Player *temp = playerIterator.next().value();
|
||||
if (temp->getLocal())
|
||||
return temp;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue