mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 03:28:49 -07:00
improved cipt handling, initial p/t for cards
This commit is contained in:
parent
d05603f83b
commit
ce80d29f50
24 changed files with 226 additions and 118 deletions
|
|
@ -28,7 +28,7 @@ void ProtocolItem::initializeHash()
|
|||
registerSerializableItem("player_ping", ServerInfo_PlayerPing::newItem);
|
||||
registerSerializableItem("file", DeckList_File::newItem);
|
||||
registerSerializableItem("directory", DeckList_Directory::newItem);
|
||||
registerSerializableItem("card_id", CardId::newItem);
|
||||
registerSerializableItem("card_to_move", CardToMove::newItem);
|
||||
registerSerializableItem("game_type_id", GameTypeId::newItem);
|
||||
|
||||
registerSerializableItem("containercmd", CommandContainer::newItem);
|
||||
|
|
@ -224,7 +224,7 @@ QList<MoveCardToZone *> Command_SetSideboardPlan::getMoveList() const
|
|||
return typecastItemList<MoveCardToZone *>();
|
||||
}
|
||||
|
||||
Command_MoveCard::Command_MoveCard(int _gameId, const QString &_startZone, const QList<CardId *> &_cardIds, int _targetPlayerId, const QString &_targetZone, int _x, int _y, bool _faceDown, bool _tapped)
|
||||
Command_MoveCard::Command_MoveCard(int _gameId, const QString &_startZone, const QList<CardToMove *> &_cards, int _targetPlayerId, const QString &_targetZone, int _x, int _y, bool _faceDown)
|
||||
: GameCommand("move_card", _gameId)
|
||||
{
|
||||
insertItem(new SerializableItem_String("start_zone", _startZone));
|
||||
|
|
@ -233,10 +233,9 @@ Command_MoveCard::Command_MoveCard(int _gameId, const QString &_startZone, const
|
|||
insertItem(new SerializableItem_Int("x", _x));
|
||||
insertItem(new SerializableItem_Int("y", _y));
|
||||
insertItem(new SerializableItem_Bool("face_down", _faceDown));
|
||||
insertItem(new SerializableItem_Bool("tapped", _tapped));
|
||||
|
||||
for (int i = 0; i < _cardIds.size(); ++i)
|
||||
itemList.append(_cardIds[i]);
|
||||
for (int i = 0; i < _cards.size(); ++i)
|
||||
itemList.append(_cards[i]);
|
||||
}
|
||||
|
||||
QHash<QString, ResponseCode> ProtocolResponse::responseHash;
|
||||
|
|
|
|||
|
|
@ -116,6 +116,7 @@ private:
|
|||
// XXX Move these out. They are only for processing inside the server.
|
||||
ProtocolResponse *resp;
|
||||
QList<ProtocolItem *> itemQueue;
|
||||
GameEventContext *gameEventContext;
|
||||
GameEventContainer *gameEventQueuePublic;
|
||||
GameEventContainer *gameEventQueueOmniscient;
|
||||
GameEventContainer *gameEventQueuePrivate;
|
||||
|
|
@ -222,15 +223,14 @@ public:
|
|||
class Command_MoveCard : public GameCommand {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Command_MoveCard(int _gameId = -1, const QString &_startZone = QString(), const QList<CardId *> &_cardIds = QList<CardId *>(), int _targetPlayerId = -1, const QString &_targetZone = QString(), int _x = -1, int _y = -1, bool _faceDown = false, bool _tapped = false);
|
||||
Command_MoveCard(int _gameId = -1, const QString &_startZone = QString(), const QList<CardToMove *> &_cards = QList<CardToMove *>(), int _targetPlayerId = -1, const QString &_targetZone = QString(), int _x = -1, int _y = -1, bool _faceDown = false);
|
||||
QString getStartZone() const { return static_cast<SerializableItem_String *>(itemMap.value("start_zone"))->getData(); }
|
||||
QList<CardId *> getCardIds() const { return typecastItemList<CardId *>(); }
|
||||
QList<CardToMove *> getCards() const { return typecastItemList<CardToMove *>(); }
|
||||
int getTargetPlayerId() const { return static_cast<SerializableItem_Int *>(itemMap.value("target_player_id"))->getData(); }
|
||||
QString getTargetZone() const { return static_cast<SerializableItem_String *>(itemMap.value("target_zone"))->getData(); }
|
||||
int getX() const { return static_cast<SerializableItem_Int *>(itemMap.value("x"))->getData(); }
|
||||
int getY() const { return static_cast<SerializableItem_Int *>(itemMap.value("y"))->getData(); }
|
||||
bool getFaceDown() const { return static_cast<SerializableItem_Bool *>(itemMap.value("face_down"))->getData(); }
|
||||
bool getTapped() const { return static_cast<SerializableItem_Bool *>(itemMap.value("tapped"))->getData(); }
|
||||
static SerializableItem *newItem() { return new Command_MoveCard; }
|
||||
int getItemId() const { return ItemId_Command_MoveCard; }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,14 @@
|
|||
#include <QXmlStreamReader>
|
||||
#include <QXmlStreamWriter>
|
||||
|
||||
CardToMove::CardToMove(int _cardId, const QString &_pt, bool _tapped)
|
||||
: SerializableItem_Map("card_to_move")
|
||||
{
|
||||
insertItem(new SerializableItem_Int("card_id", _cardId));
|
||||
insertItem(new SerializableItem_String("pt", _pt));
|
||||
insertItem(new SerializableItem_Bool("tapped", _tapped));
|
||||
}
|
||||
|
||||
ServerInfo_User::ServerInfo_User(const QString &_name, int _userLevel, const QString &_realName, const QString &_country, const QByteArray &_avatarBmp)
|
||||
: SerializableItem_Map("user")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -20,11 +20,15 @@ enum ResponseCode { RespNothing, RespOk, RespInvalidCommand, RespInvalidData, Re
|
|||
// list index, whereas cards in any other zone are referenced by their ids.
|
||||
enum ZoneType { PrivateZone, PublicZone, HiddenZone };
|
||||
|
||||
class CardId : public SerializableItem_Int {
|
||||
class CardToMove : public SerializableItem_Map {
|
||||
public:
|
||||
CardId(int _cardId = -1) : SerializableItem_Int("card_id", _cardId) { }
|
||||
static SerializableItem *newItem() { return new CardId; }
|
||||
CardToMove(int _cardId = -1, const QString &_pt = QString(), bool _tapped = false);
|
||||
static SerializableItem *newItem() { return new CardToMove; }
|
||||
int getCardId() const { return static_cast<SerializableItem_Int *>(itemMap.value("card_id"))->getData(); }
|
||||
QString getPT() const { return static_cast<SerializableItem_String *>(itemMap.value("pt"))->getData(); }
|
||||
bool getTapped() const { return static_cast<SerializableItem_Bool *>(itemMap.value("tapped"))->getData(); }
|
||||
};
|
||||
|
||||
class GameTypeId : public SerializableItem_Int {
|
||||
public:
|
||||
GameTypeId(int _gameTypeId = -1) : SerializableItem_Int("game_type_id", _gameTypeId) { }
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ ItemId_Context_ReadyStart = 1067,
|
|||
ItemId_Context_Concede = 1068,
|
||||
ItemId_Context_DeckSelect = 1069,
|
||||
ItemId_Context_UndoDraw = 1070,
|
||||
ItemId_Command_UpdateServerMessage = 1071,
|
||||
ItemId_Other = 1072
|
||||
ItemId_Context_MoveCard = 1071,
|
||||
ItemId_Command_UpdateServerMessage = 1072,
|
||||
ItemId_Other = 1073
|
||||
};
|
||||
|
|
|
|||
|
|
@ -422,6 +422,10 @@ Context_UndoDraw::Context_UndoDraw()
|
|||
: GameEventContext("undo_draw")
|
||||
{
|
||||
}
|
||||
Context_MoveCard::Context_MoveCard()
|
||||
: GameEventContext("move_card")
|
||||
{
|
||||
}
|
||||
Command_UpdateServerMessage::Command_UpdateServerMessage()
|
||||
: AdminCommand("update_server_message")
|
||||
{
|
||||
|
|
@ -498,5 +502,6 @@ void ProtocolItem::initializeHashAuto()
|
|||
itemNameHash.insert("game_event_contextconcede", Context_Concede::newItem);
|
||||
itemNameHash.insert("game_event_contextdeck_select", Context_DeckSelect::newItem);
|
||||
itemNameHash.insert("game_event_contextundo_draw", Context_UndoDraw::newItem);
|
||||
itemNameHash.insert("game_event_contextmove_card", Context_MoveCard::newItem);
|
||||
itemNameHash.insert("cmdupdate_server_message", Command_UpdateServerMessage::newItem);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,4 +68,5 @@
|
|||
6:concede
|
||||
6:deck_select:i,deck_id
|
||||
6:undo_draw
|
||||
6:move_card
|
||||
7:update_server_message
|
||||
|
|
|
|||
|
|
@ -634,6 +634,13 @@ public:
|
|||
static SerializableItem *newItem() { return new Context_UndoDraw; }
|
||||
int getItemId() const { return ItemId_Context_UndoDraw; }
|
||||
};
|
||||
class Context_MoveCard : public GameEventContext {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Context_MoveCard();
|
||||
static SerializableItem *newItem() { return new Context_MoveCard; }
|
||||
int getItemId() const { return ItemId_Context_MoveCard; }
|
||||
};
|
||||
class Command_UpdateServerMessage : public AdminCommand {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -155,7 +155,11 @@ bool Server_CardZone::isColumnEmpty(int x, int y) const
|
|||
void Server_CardZone::moveCard(CommandContainer *cont, QMap<int, Server_Card *> &coordMap, Server_Card *card, int x, int y)
|
||||
{
|
||||
coordMap.remove(card->getY() * 10000 + card->getX());
|
||||
player->moveCard(cont, this, QList<int>() << card->getId(), this, x, y, card->getFaceDown(), false, false);
|
||||
|
||||
CardToMove *cardToMove = new CardToMove(card->getId());
|
||||
player->moveCard(cont, this, QList<CardToMove *>() << cardToMove, this, x, y, card->getFaceDown(), false);
|
||||
delete cardToMove;
|
||||
|
||||
coordMap.insert(y * 10000 + x, card);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -231,10 +231,14 @@ ResponseCode Server_Player::undoDraw(CommandContainer *cont)
|
|||
if (lastDrawList.isEmpty())
|
||||
return RespContextError;
|
||||
|
||||
return moveCard(cont, zones.value("hand"), QList<int>() << lastDrawList.takeLast(), zones.value("deck"), 0, 0, false, false, false, true);
|
||||
ResponseCode retVal;
|
||||
CardToMove *cardToMove = new CardToMove(lastDrawList.takeLast());
|
||||
retVal = moveCard(cont, zones.value("hand"), QList<CardToMove *>() << cardToMove, zones.value("deck"), 0, 0, false, false, true);
|
||||
delete cardToMove;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
ResponseCode Server_Player::moveCard(CommandContainer *cont, const QString &_startZone, const QList<int> &_cardIds, int targetPlayerId, const QString &_targetZone, int x, int y, bool faceDown, bool tapped)
|
||||
ResponseCode Server_Player::moveCard(CommandContainer *cont, const QString &_startZone, const QList<CardToMove *> &_cards, int targetPlayerId, const QString &_targetZone, int x, int y, bool faceDown)
|
||||
{
|
||||
Server_CardZone *startzone = getZones().value(_startZone);
|
||||
Server_Player *targetPlayer = game->getPlayers().value(targetPlayerId);
|
||||
|
|
@ -244,7 +248,7 @@ ResponseCode Server_Player::moveCard(CommandContainer *cont, const QString &_sta
|
|||
if ((!startzone) || (!targetzone))
|
||||
return RespNameNotFound;
|
||||
|
||||
return moveCard(cont, startzone, _cardIds, targetzone, x, y, faceDown, tapped);
|
||||
return moveCard(cont, startzone, _cards, targetzone, x, y, faceDown);
|
||||
}
|
||||
|
||||
class Server_Player::MoveCardCompareFunctor {
|
||||
|
|
@ -268,7 +272,7 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
ResponseCode Server_Player::moveCard(CommandContainer *cont, Server_CardZone *startzone, const QList<int> &_cardIds, Server_CardZone *targetzone, int x, int y, bool faceDown, bool tapped, bool fixFreeSpaces, bool undoingDraw)
|
||||
ResponseCode Server_Player::moveCard(CommandContainer *cont, Server_CardZone *startzone, const QList<CardToMove *> &_cards, Server_CardZone *targetzone, int x, int y, bool faceDown, bool fixFreeSpaces, bool undoingDraw)
|
||||
{
|
||||
// Disallow controller change to other zones than the table.
|
||||
if (((targetzone->getType() != PublicZone) || !targetzone->hasCoords()) && (startzone->getPlayer() != targetzone->getPlayer()))
|
||||
|
|
@ -278,14 +282,16 @@ ResponseCode Server_Player::moveCard(CommandContainer *cont, Server_CardZone *st
|
|||
x = targetzone->cards.size();
|
||||
|
||||
QList<QPair<Server_Card *, int> > cardsToMove;
|
||||
for (int i = 0; i < _cardIds.size(); ++i) {
|
||||
QMap<Server_Card *, CardToMove *> cardProperties;
|
||||
for (int i = 0; i < _cards.size(); ++i) {
|
||||
int position;
|
||||
Server_Card *card = startzone->getCard(_cardIds[i], false, &position);
|
||||
Server_Card *card = startzone->getCard(_cards[i]->getCardId(), false, &position);
|
||||
if (!card)
|
||||
return RespNameNotFound;
|
||||
if (!card->getAttachedCards().isEmpty() && !targetzone->isColumnEmpty(x, y))
|
||||
return RespContextError;
|
||||
cardsToMove.append(QPair<Server_Card *, int>(card, position));
|
||||
cardProperties.insert(card, _cards[i]);
|
||||
}
|
||||
|
||||
MoveCardCompareFunctor cmp(startzone == targetzone ? -1 : x);
|
||||
|
|
@ -295,6 +301,7 @@ ResponseCode Server_Player::moveCard(CommandContainer *cont, Server_CardZone *st
|
|||
int xIndex = -1;
|
||||
for (int cardIndex = 0; cardIndex < cardsToMove.size(); ++cardIndex) {
|
||||
Server_Card *card = cardsToMove[cardIndex].first;
|
||||
CardToMove *thisCardProperties = cardProperties.value(card);
|
||||
int originalPosition = cardsToMove[cardIndex].second;
|
||||
int position = startzone->removeCard(card);
|
||||
if (startzone->getName() == "hand") {
|
||||
|
|
@ -345,8 +352,8 @@ ResponseCode Server_Player::moveCard(CommandContainer *cont, Server_CardZone *st
|
|||
}
|
||||
|
||||
if (card->getDestroyOnZoneChange() && (startzone->getName() != targetzone->getName())) {
|
||||
cont->enqueueGameEventPrivate(new Event_DestroyCard(getPlayerId(), startzone->getName(), card->getId()), game->getGameId());
|
||||
cont->enqueueGameEventPublic(new Event_DestroyCard(getPlayerId(), startzone->getName(), card->getId()), game->getGameId());
|
||||
cont->enqueueGameEventPrivate(new Event_DestroyCard(getPlayerId(), startzone->getName(), card->getId()), game->getGameId(), -1, new Context_MoveCard);
|
||||
cont->enqueueGameEventPublic(new Event_DestroyCard(getPlayerId(), startzone->getName(), card->getId()), game->getGameId(), new Context_MoveCard);
|
||||
card->deleteLater();
|
||||
} else {
|
||||
if (!targetzone->hasCoords()) {
|
||||
|
|
@ -388,8 +395,8 @@ ResponseCode Server_Player::moveCard(CommandContainer *cont, Server_CardZone *st
|
|||
int privatePosition = -1;
|
||||
if (startzone->getType() == HiddenZone)
|
||||
privatePosition = position;
|
||||
cont->enqueueGameEventPrivate(new Event_MoveCard(getPlayerId(), privateOldCardId, privateCardName, startzone->getName(), privatePosition, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, privateNewCardId, faceDown), game->getGameId(), -1, undoingDraw ? new Context_UndoDraw : 0);
|
||||
cont->enqueueGameEventOmniscient(new Event_MoveCard(getPlayerId(), privateOldCardId, privateCardName, startzone->getName(), privatePosition, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, privateNewCardId, faceDown), game->getGameId(), undoingDraw ? new Context_UndoDraw : 0);
|
||||
cont->enqueueGameEventPrivate(new Event_MoveCard(getPlayerId(), privateOldCardId, privateCardName, startzone->getName(), privatePosition, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, privateNewCardId, faceDown), game->getGameId(), -1, undoingDraw ? static_cast<GameEventContext *>(new Context_UndoDraw) : static_cast<GameEventContext *>(new Context_MoveCard));
|
||||
cont->enqueueGameEventOmniscient(new Event_MoveCard(getPlayerId(), privateOldCardId, privateCardName, startzone->getName(), privatePosition, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, privateNewCardId, faceDown), game->getGameId(), undoingDraw ? static_cast<GameEventContext *>(new Context_UndoDraw) : static_cast<GameEventContext *>(new Context_MoveCard));
|
||||
|
||||
// Other players do not get to see the start and/or target position of the card if the respective
|
||||
// part of the zone is being looked at. The information is not needed anyway because in hidden zones,
|
||||
|
|
@ -403,12 +410,14 @@ ResponseCode Server_Player::moveCard(CommandContainer *cont, Server_CardZone *st
|
|||
newX = -1;
|
||||
|
||||
if ((startzone->getType() == PublicZone) || (targetzone->getType() == PublicZone))
|
||||
cont->enqueueGameEventPublic(new Event_MoveCard(getPlayerId(), oldCardId, publicCardName, startzone->getName(), position, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, card->getId(), faceDown), game->getGameId(), undoingDraw ? new Context_UndoDraw : 0);
|
||||
cont->enqueueGameEventPublic(new Event_MoveCard(getPlayerId(), oldCardId, publicCardName, startzone->getName(), position, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, card->getId(), faceDown), game->getGameId(), undoingDraw ? static_cast<GameEventContext *>(new Context_UndoDraw) : static_cast<GameEventContext *>(new Context_MoveCard));
|
||||
else
|
||||
cont->enqueueGameEventPublic(new Event_MoveCard(getPlayerId(), -1, QString(), startzone->getName(), position, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, -1, false), game->getGameId(), undoingDraw ? new Context_UndoDraw : 0);
|
||||
cont->enqueueGameEventPublic(new Event_MoveCard(getPlayerId(), -1, QString(), startzone->getName(), position, targetzone->getPlayer()->getPlayerId(), targetzone->getName(), newX, y, -1, false), game->getGameId(), undoingDraw ? static_cast<GameEventContext *>(new Context_UndoDraw) : static_cast<GameEventContext *>(new Context_MoveCard));
|
||||
|
||||
if (tapped)
|
||||
if (thisCardProperties->getTapped())
|
||||
setCardAttrHelper(cont, targetzone->getName(), card->getId(), "tapped", "1");
|
||||
if (!thisCardProperties->getPT().isEmpty())
|
||||
setCardAttrHelper(cont, targetzone->getName(), card->getId(), "pt", thisCardProperties->getPT());
|
||||
}
|
||||
}
|
||||
if (startzone->hasCoords() && fixFreeSpaces)
|
||||
|
|
@ -425,7 +434,9 @@ void Server_Player::unattachCard(CommandContainer *cont, Server_Card *card)
|
|||
cont->enqueueGameEventPrivate(new Event_AttachCard(getPlayerId(), zone->getName(), card->getId(), -1, QString(), -1), game->getGameId());
|
||||
cont->enqueueGameEventPublic(new Event_AttachCard(getPlayerId(), zone->getName(), card->getId(), -1, QString(), -1), game->getGameId());
|
||||
|
||||
moveCard(cont, zone, QList<int>() << card->getId(), zone, -1, card->getY(), card->getFaceDown(), false);
|
||||
CardToMove *cardToMove = new CardToMove(card->getId());
|
||||
moveCard(cont, zone, QList<CardToMove *>() << cardToMove, zone, -1, card->getY(), card->getFaceDown());
|
||||
delete cardToMove;
|
||||
}
|
||||
|
||||
ResponseCode Server_Player::setCardAttrHelper(CommandContainer *cont, const QString &zoneName, int cardId, const QString &attrName, const QString &attrValue)
|
||||
|
|
|
|||
|
|
@ -78,8 +78,8 @@ public:
|
|||
|
||||
ResponseCode drawCards(CommandContainer *cont, int number);
|
||||
ResponseCode undoDraw(CommandContainer *cont);
|
||||
ResponseCode moveCard(CommandContainer *cont, const QString &_startZone, const QList<int> &_cardId, int _targetPlayer, const QString &_targetZone, int _x, int _y, bool _faceDown, bool _tapped);
|
||||
ResponseCode moveCard(CommandContainer *cont, Server_CardZone *startzone, const QList<int> &_cardId, Server_CardZone *targetzone, int x, int y, bool faceDown, bool tapped, bool fixFreeSpaces = true, bool undoingDraw = false);
|
||||
ResponseCode moveCard(CommandContainer *cont, const QString &_startZone, const QList<CardToMove *> &_cards, int _targetPlayer, const QString &_targetZone, int _x, int _y, bool _faceDown);
|
||||
ResponseCode moveCard(CommandContainer *cont, Server_CardZone *startzone, const QList<CardToMove *> &_cards, Server_CardZone *targetzone, int x, int y, bool faceDown, bool fixFreeSpaces = true, bool undoingDraw = false);
|
||||
void unattachCard(CommandContainer *cont, Server_Card *card);
|
||||
ResponseCode setCardAttrHelper(CommandContainer *cont, const QString &zone, int cardId, const QString &attrName, const QString &attrValue);
|
||||
|
||||
|
|
|
|||
|
|
@ -510,8 +510,11 @@ ResponseCode Server_ProtocolHandler::cmdMulligan(Command_Mulligan * /*cmd*/, Com
|
|||
int number = (hand->cards.size() <= 1) ? player->getInitialCards() : hand->cards.size() - 1;
|
||||
|
||||
Server_CardZone *deck = player->getZones().value("deck");
|
||||
while (!hand->cards.isEmpty())
|
||||
player->moveCard(cont, hand, QList<int>() << hand->cards.first()->getId(), deck, 0, 0, false, false);
|
||||
while (!hand->cards.isEmpty()) {
|
||||
CardToMove *cardToMove = new CardToMove(hand->cards.first()->getId());
|
||||
player->moveCard(cont, hand, QList<CardToMove *>() << cardToMove, deck, 0, 0, false);
|
||||
delete cardToMove;
|
||||
}
|
||||
|
||||
deck->shuffle();
|
||||
cont->enqueueGameEventPrivate(new Event_Shuffle(player->getPlayerId()), game->getGameId());
|
||||
|
|
@ -569,12 +572,7 @@ ResponseCode Server_ProtocolHandler::cmdMoveCard(Command_MoveCard *cmd, CommandC
|
|||
if (player->getConceded())
|
||||
return RespContextError;
|
||||
|
||||
QList<int> cardIds;
|
||||
const QList<CardId *> &temp = cmd->getCardIds();
|
||||
for (int i = 0; i < temp.size(); ++i)
|
||||
cardIds.append(temp[i]->getData());
|
||||
|
||||
return player->moveCard(cont, cmd->getStartZone(), cardIds, cmd->getTargetPlayerId(), cmd->getTargetZone(), cmd->getX(), cmd->getY(), cmd->getFaceDown(), cmd->getTapped());
|
||||
return player->moveCard(cont, cmd->getStartZone(), cmd->getCards(), cmd->getTargetPlayerId(), cmd->getTargetZone(), cmd->getX(), cmd->getY(), cmd->getFaceDown());
|
||||
}
|
||||
|
||||
ResponseCode Server_ProtocolHandler::cmdFlipCard(Command_FlipCard *cmd, CommandContainer *cont, Server_Game *game, Server_Player *player)
|
||||
|
|
@ -678,8 +676,11 @@ ResponseCode Server_ProtocolHandler::cmdAttachCard(Command_AttachCard *cmd, Comm
|
|||
for (int i = 0; i < attachedList.size(); ++i)
|
||||
player->unattachCard(cont, attachedList[i]);
|
||||
|
||||
if (targetzone->isColumnStacked(targetCard->getX(), targetCard->getY()))
|
||||
targetPlayer->moveCard(cont, targetzone, QList<int>() << targetCard->getId(), targetzone, targetzone->getFreeGridColumn(-2, targetCard->getY(), targetCard->getName()), targetCard->getY(), targetCard->getFaceDown(), false);
|
||||
if (targetzone->isColumnStacked(targetCard->getX(), targetCard->getY())) {
|
||||
CardToMove *cardToMove = new CardToMove(targetCard->getId());
|
||||
targetPlayer->moveCard(cont, targetzone, QList<CardToMove *>() << cardToMove, targetzone, targetzone->getFreeGridColumn(-2, targetCard->getY(), targetCard->getName()), targetCard->getY(), targetCard->getFaceDown());
|
||||
delete cardToMove;
|
||||
}
|
||||
|
||||
card->setParentCard(targetCard);
|
||||
card->setCoords(-1, card->getY());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue