mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-10 12:03:25 -08:00
[Refactor] Retype PlayerActions onto CardState
This commit is contained in:
parent
e2cbbecefe
commit
e0d2f158e9
14 changed files with 137 additions and 126 deletions
|
|
@ -6,6 +6,7 @@
|
|||
#include "../../interface/deck_loader/loaded_deck.h"
|
||||
#include "../abstract_game.h"
|
||||
#include "../board/arrow_data.h"
|
||||
#include "../board/card_state.h"
|
||||
#include "../board/counter_state.h"
|
||||
#include "../game_event_handler.h"
|
||||
#include "../zones/card_zone_logic.h"
|
||||
|
|
@ -91,7 +92,7 @@ PlayerActions::PlayerActions(PlayerLogic *_player)
|
|||
connect(moveTopCardTimer, &QTimer::timeout, [this]() { actMoveTopCardToPlay(); });
|
||||
}
|
||||
|
||||
void PlayerActions::playCard(CardItem *card, bool faceDown)
|
||||
void PlayerActions::playCard(CardState *card, bool faceDown)
|
||||
{
|
||||
if (card == nullptr) {
|
||||
return;
|
||||
|
|
@ -144,7 +145,7 @@ void PlayerActions::playCard(CardItem *card, bool faceDown)
|
|||
* Like {@link PlayerActions::playCard}, but forces the card to be played to the table zone.
|
||||
* Cards with tablerow 3 (the stack) will be played to tablerow 1 (the noncreatures row).
|
||||
*/
|
||||
void PlayerActions::playCardToTable(const CardItem *card, bool faceDown)
|
||||
void PlayerActions::playCardToTable(const CardState *card, bool faceDown)
|
||||
{
|
||||
if (card == nullptr) {
|
||||
return;
|
||||
|
|
@ -177,7 +178,7 @@ void PlayerActions::playCardToTable(const CardItem *card, bool faceDown)
|
|||
sendGameCommand(cmd);
|
||||
}
|
||||
|
||||
void PlayerActions::attachCards(CardItem *startCard, const CardItem *targetCard)
|
||||
void PlayerActions::attachCards(CardState *startCard, const CardState *targetCard)
|
||||
{
|
||||
if (targetCard->getAttachedTo() || targetCard->getZone()->getName() != ZoneNames::TABLE) {
|
||||
return;
|
||||
|
|
@ -197,7 +198,7 @@ void PlayerActions::attachCards(CardItem *startCard, const CardItem *targetCard)
|
|||
sendGameCommand(cmd);
|
||||
}
|
||||
|
||||
void PlayerActions::createArrow(CardItem *startCard, const ArrowData &arrow, int deleteInPhase)
|
||||
void PlayerActions::createArrow(CardState *startCard, const ArrowData &arrow, int deleteInPhase)
|
||||
{
|
||||
Command_CreateArrow cmd;
|
||||
cmd.mutable_arrow_color()->CopyFrom(convertQColorToColor(arrow.color));
|
||||
|
|
@ -603,7 +604,7 @@ void PlayerActions::moveTopCardsUntil(const QString &expr, MoveTopCardsUntilOpti
|
|||
}
|
||||
}
|
||||
|
||||
void PlayerActions::moveOneCardUntil(CardItem *card)
|
||||
void PlayerActions::moveOneCardUntil(CardState *card)
|
||||
{
|
||||
moveTopCardTimer->stop();
|
||||
|
||||
|
|
@ -1000,7 +1001,7 @@ void PlayerActions::actCreatePredefinedToken()
|
|||
actCreateAnotherToken();
|
||||
}
|
||||
|
||||
void PlayerActions::actCreateRelatedCard(const CardItem *sourceCard, int index)
|
||||
void PlayerActions::actCreateRelatedCard(const CardState *sourceCard, int index)
|
||||
{
|
||||
if (!sourceCard) {
|
||||
return;
|
||||
|
|
@ -1012,7 +1013,7 @@ void PlayerActions::actCreateRelatedCard(const CardItem *sourceCard, int index)
|
|||
actRequestCreateRelatedFromRelationDialog(sourceCard, cardRelation);
|
||||
}
|
||||
|
||||
void PlayerActions::actCreateAllRelatedCards(const CardItem *sourceCard)
|
||||
void PlayerActions::actCreateAllRelatedCards(const CardState *sourceCard)
|
||||
{
|
||||
if (!sourceCard) {
|
||||
return;
|
||||
|
|
@ -1099,13 +1100,13 @@ void PlayerActions::actCreateAllRelatedCards(const CardItem *sourceCard)
|
|||
}
|
||||
}
|
||||
|
||||
void PlayerActions::actRequestCreateRelatedFromRelationDialog(const CardItem *sourceCard,
|
||||
void PlayerActions::actRequestCreateRelatedFromRelationDialog(const CardState *sourceCard,
|
||||
const CardRelation *cardRelation)
|
||||
{
|
||||
emit requestCreateRelatedFromRelationDialog(sourceCard, cardRelation);
|
||||
}
|
||||
|
||||
bool PlayerActions::createRelatedFromRelation(const CardItem *sourceCard,
|
||||
bool PlayerActions::createRelatedFromRelation(const CardState *sourceCard,
|
||||
const CardRelation *cardRelation,
|
||||
int variableCount)
|
||||
{
|
||||
|
|
@ -1157,7 +1158,7 @@ bool PlayerActions::createRelatedFromRelation(const CardItem *sourceCard,
|
|||
return true;
|
||||
}
|
||||
|
||||
void PlayerActions::onRelatedCardCreated(const CardItem *sourceCard, const CardRelation *cardRelation)
|
||||
void PlayerActions::onRelatedCardCreated(const CardState *sourceCard, const CardRelation *cardRelation)
|
||||
{
|
||||
if (sourceCard == nullptr || cardRelation == nullptr) {
|
||||
return;
|
||||
|
|
@ -1177,7 +1178,7 @@ void PlayerActions::onRelatedCardCreated(const CardItem *sourceCard, const CardR
|
|||
setLastToken(relatedCard.getCardPtr());
|
||||
}
|
||||
|
||||
void PlayerActions::createCard(const CardItem *sourceCard,
|
||||
void PlayerActions::createCard(const CardState *sourceCard,
|
||||
const QString &dbCardName,
|
||||
CardRelationType attachType,
|
||||
bool persistent,
|
||||
|
|
@ -1263,7 +1264,7 @@ void PlayerActions::actRequestMoveCardXCardsFromTopDialog()
|
|||
emit requestMoveCardXCardsFromTopDialog(defaultNumberTopCardsToPlaceBelow, deckSize);
|
||||
}
|
||||
|
||||
void PlayerActions::actMoveCardXCardsFromTop(QList<CardItem *> selectedCards, int number)
|
||||
void PlayerActions::actMoveCardXCardsFromTop(QList<CardState *> selectedCards, int number)
|
||||
{
|
||||
defaultNumberTopCardsToPlaceBelow = number;
|
||||
|
||||
|
|
@ -1297,7 +1298,7 @@ void PlayerActions::actMoveCardXCardsFromTop(QList<CardItem *> selectedCards, in
|
|||
}
|
||||
}
|
||||
|
||||
void PlayerActions::actIncPT(QList<CardItem *> selectedCards, int deltaP, int deltaT)
|
||||
void PlayerActions::actIncPT(QList<CardState *> selectedCards, int deltaP, int deltaT)
|
||||
{
|
||||
int playerid = player->getPlayerInfo()->getId();
|
||||
|
||||
|
|
@ -1330,7 +1331,7 @@ void PlayerActions::actIncPT(QList<CardItem *> selectedCards, int deltaP, int de
|
|||
player->getGame()->getGameEventHandler()->sendGameCommand(prepareGameCommand(commandList), playerid);
|
||||
}
|
||||
|
||||
void PlayerActions::actResetPT(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actResetPT(QList<CardState *> selectedCards)
|
||||
{
|
||||
int playerid = player->getPlayerInfo()->getId();
|
||||
QList<const ::google::protobuf::Message *> commandList;
|
||||
|
|
@ -1363,7 +1364,7 @@ void PlayerActions::actResetPT(QList<CardItem *> selectedCards)
|
|||
}
|
||||
}
|
||||
|
||||
void PlayerActions::actRequestSetPTDialog(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actRequestSetPTDialog(QList<CardState *> selectedCards)
|
||||
{
|
||||
QString oldPT;
|
||||
|
||||
|
|
@ -1376,7 +1377,7 @@ void PlayerActions::actRequestSetPTDialog(QList<CardItem *> selectedCards)
|
|||
emit requestSetPTDialog(oldPT);
|
||||
}
|
||||
|
||||
void PlayerActions::actSetPT(QList<CardItem *> selectedCards, const QString &pt)
|
||||
void PlayerActions::actSetPT(QList<CardState *> selectedCards, const QString &pt)
|
||||
{
|
||||
int playerid = player->getPlayerInfo()->getId();
|
||||
|
||||
|
|
@ -1416,42 +1417,42 @@ void PlayerActions::actSetPT(QList<CardItem *> selectedCards, const QString &pt)
|
|||
player->getGame()->getGameEventHandler()->sendGameCommand(prepareGameCommand(commandList), playerid);
|
||||
}
|
||||
|
||||
void PlayerActions::actIncP(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actIncP(QList<CardState *> selectedCards)
|
||||
{
|
||||
actIncPT(selectedCards, 1, 0);
|
||||
}
|
||||
|
||||
void PlayerActions::actDecP(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actDecP(QList<CardState *> selectedCards)
|
||||
{
|
||||
actIncPT(selectedCards, -1, 0);
|
||||
}
|
||||
|
||||
void PlayerActions::actIncT(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actIncT(QList<CardState *> selectedCards)
|
||||
{
|
||||
actIncPT(selectedCards, 0, 1);
|
||||
}
|
||||
|
||||
void PlayerActions::actDecT(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actDecT(QList<CardState *> selectedCards)
|
||||
{
|
||||
actIncPT(selectedCards, 0, -1);
|
||||
}
|
||||
|
||||
void PlayerActions::actIncPT(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actIncPT(QList<CardState *> selectedCards)
|
||||
{
|
||||
actIncPT(selectedCards, 1, 1);
|
||||
}
|
||||
|
||||
void PlayerActions::actDecPT(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actDecPT(QList<CardState *> selectedCards)
|
||||
{
|
||||
actIncPT(selectedCards, -1, -1);
|
||||
}
|
||||
|
||||
void PlayerActions::actFlowP(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actFlowP(QList<CardState *> selectedCards)
|
||||
{
|
||||
actIncPT(selectedCards, 1, -1);
|
||||
}
|
||||
|
||||
void PlayerActions::actFlowT(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actFlowT(QList<CardState *> selectedCards)
|
||||
{
|
||||
actIncPT(selectedCards, -1, 1);
|
||||
}
|
||||
|
|
@ -1474,7 +1475,7 @@ void PlayerActions::actSetCounter(int counterId, int value)
|
|||
sendGameCommand(cmd);
|
||||
}
|
||||
|
||||
void PlayerActions::actReduceLifeByPower(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actReduceLifeByPower(QList<CardState *> selectedCards)
|
||||
{
|
||||
// find life counter
|
||||
auto lifeCounter = player->getLifeCounter();
|
||||
|
|
@ -1499,7 +1500,7 @@ void PlayerActions::actReduceLifeByPower(QList<CardItem *> selectedCards)
|
|||
sendGameCommand(prepareGameCommand(cmd));
|
||||
}
|
||||
|
||||
void PlayerActions::actRequestSetAnnotationDialog(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actRequestSetAnnotationDialog(QList<CardState *> selectedCards)
|
||||
{
|
||||
QString oldAnnotation;
|
||||
for (auto card : selectedCards) {
|
||||
|
|
@ -1511,7 +1512,7 @@ void PlayerActions::actRequestSetAnnotationDialog(QList<CardItem *> selectedCard
|
|||
emit requestSetAnnotationDialog(oldAnnotation);
|
||||
}
|
||||
|
||||
void PlayerActions::actSetAnnotation(QList<CardItem *> selectedCards, const QString &annotation)
|
||||
void PlayerActions::actSetAnnotation(QList<CardState *> selectedCards, const QString &annotation)
|
||||
{
|
||||
QList<const ::google::protobuf::Message *> commandList;
|
||||
for (auto card : selectedCards) {
|
||||
|
|
@ -1525,7 +1526,7 @@ void PlayerActions::actSetAnnotation(QList<CardItem *> selectedCards, const QStr
|
|||
sendGameCommand(prepareGameCommand(commandList));
|
||||
}
|
||||
|
||||
void PlayerActions::actUnattach(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actUnattach(QList<CardState *> selectedCards)
|
||||
{
|
||||
QList<const ::google::protobuf::Message *> commandList;
|
||||
for (auto card : selectedCards) {
|
||||
|
|
@ -1541,17 +1542,17 @@ void PlayerActions::actUnattach(QList<CardItem *> selectedCards)
|
|||
sendGameCommand(prepareGameCommand(commandList));
|
||||
}
|
||||
|
||||
void PlayerActions::actAddCardCounter(QList<CardItem *> selectedCards, int counterId)
|
||||
void PlayerActions::actAddCardCounter(QList<CardState *> selectedCards, int counterId)
|
||||
{
|
||||
offsetCardCounter(selectedCards, counterId, 1);
|
||||
}
|
||||
|
||||
void PlayerActions::actRemoveCardCounter(QList<CardItem *> selectedCards, int counterId)
|
||||
void PlayerActions::actRemoveCardCounter(QList<CardState *> selectedCards, int counterId)
|
||||
{
|
||||
offsetCardCounter(selectedCards, counterId, -1);
|
||||
}
|
||||
|
||||
void PlayerActions::offsetCardCounter(QList<CardItem *> selectedCards, int counterId, int offset)
|
||||
void PlayerActions::offsetCardCounter(QList<CardState *> selectedCards, int counterId, int offset)
|
||||
{
|
||||
QList<const ::google::protobuf::Message *> commandList;
|
||||
for (auto card : selectedCards) {
|
||||
|
|
@ -1577,7 +1578,7 @@ void PlayerActions::offsetCardCounter(QList<CardItem *> selectedCards, int count
|
|||
sendGameCommand(prepareGameCommand(commandList));
|
||||
}
|
||||
|
||||
void PlayerActions::actRequestSetCardCounterDialog(QList<CardItem *> selectedCards, int counterId)
|
||||
void PlayerActions::actRequestSetCardCounterDialog(QList<CardState *> selectedCards, int counterId)
|
||||
{
|
||||
// If a single card is selected, we show the old value in the dialog. Otherwise, we show "x"
|
||||
QString oldValueForDlg = "x";
|
||||
|
|
@ -1589,7 +1590,7 @@ void PlayerActions::actRequestSetCardCounterDialog(QList<CardItem *> selectedCar
|
|||
emit requestSetCardCounterDialog(counterId, oldValueForDlg);
|
||||
}
|
||||
|
||||
void PlayerActions::actSetCardCounter(QList<CardItem *> selectedCards, int counterId, const QString &counterValue)
|
||||
void PlayerActions::actSetCardCounter(QList<CardState *> selectedCards, int counterId, const QString &counterValue)
|
||||
{
|
||||
QList<const ::google::protobuf::Message *> commandList;
|
||||
for (auto card : selectedCards) {
|
||||
|
|
@ -1610,12 +1611,12 @@ void PlayerActions::actSetCardCounter(QList<CardItem *> selectedCards, int count
|
|||
sendGameCommand(prepareGameCommand(commandList));
|
||||
}
|
||||
|
||||
void PlayerActions::actIncrementAllCardCounters(QList<CardItem *> cardsToUpdate)
|
||||
void PlayerActions::actIncrementAllCardCounters(QList<CardState *> cardsToUpdate)
|
||||
{
|
||||
if (cardsToUpdate.isEmpty()) {
|
||||
// If no cards selected, update all cards on table
|
||||
for (auto *state : player->getTableZone()->getCards()) {
|
||||
cardsToUpdate.append(qobject_cast<CardItem *>(state->parent()));
|
||||
cardsToUpdate.append(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1659,7 +1660,7 @@ static bool isUnwritableRevealZone(CardZoneLogic *zone)
|
|||
return false;
|
||||
}
|
||||
|
||||
void PlayerActions::playSelectedCards(QList<CardItem *> selectedCards, const bool faceDown)
|
||||
void PlayerActions::playSelectedCards(QList<CardState *> selectedCards, const bool faceDown)
|
||||
{
|
||||
// CardIds will get shuffled downwards when cards leave the deck.
|
||||
// We need to iterate through the cards in reverse order so cardIds don't get changed out from under us as we play
|
||||
|
|
@ -1674,27 +1675,26 @@ void PlayerActions::playSelectedCards(QList<CardItem *> selectedCards, const boo
|
|||
}
|
||||
}
|
||||
|
||||
void PlayerActions::actPlay(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actPlay(QList<CardState *> selectedCards)
|
||||
{
|
||||
playSelectedCards(selectedCards, false);
|
||||
}
|
||||
|
||||
void PlayerActions::actPlayFacedown(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actPlayFacedown(QList<CardState *> selectedCards)
|
||||
{
|
||||
playSelectedCards(selectedCards, true);
|
||||
}
|
||||
|
||||
void PlayerActions::actHide(QList<CardItem *> selectedCards)
|
||||
void PlayerActions::actHide(QList<CardState *> selectedCards)
|
||||
{
|
||||
for (const auto &item : selectedCards) {
|
||||
auto *card = static_cast<CardItem *>(item);
|
||||
if (card && isUnwritableRevealZone(card->getZone())) {
|
||||
card->getZone()->removeCard(card->getState());
|
||||
for (const auto &card : selectedCards) {
|
||||
if (isUnwritableRevealZone(card->getZone())) {
|
||||
card->getZone()->removeCard(card);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PlayerActions::actReveal(QList<CardItem *> selectedCards, QAction *action)
|
||||
void PlayerActions::actReveal(QList<CardState *> selectedCards, QAction *action)
|
||||
{
|
||||
const int otherPlayerId = action->data().toInt();
|
||||
|
||||
|
|
@ -1785,9 +1785,9 @@ void PlayerActions::actRevealRandomGraveyardCard(int revealToPlayerId)
|
|||
sendGameCommand(cmd);
|
||||
}
|
||||
|
||||
void PlayerActions::cardMenuAction(QList<CardItem *> selectedCards, CardMenuActionType type)
|
||||
void PlayerActions::cardMenuAction(QList<CardState *> selectedCards, CardMenuActionType type)
|
||||
{
|
||||
QList<CardItem *> cardList = selectedCards;
|
||||
QList<CardState *> cardList = selectedCards;
|
||||
|
||||
QList<const ::google::protobuf::Message *> commandList;
|
||||
if (type <= cmClone) {
|
||||
|
|
@ -2079,10 +2079,10 @@ PendingCommand *PlayerActions::prepareZoneDump(CardZoneLogic *zone, int numberCa
|
|||
return prepareGameCommand(cmd);
|
||||
}
|
||||
|
||||
void PlayerActions::actToggleTapped(const QString &zoneName, const QList<CardItem *> &cards, bool tapped)
|
||||
void PlayerActions::actToggleTapped(const QString &zoneName, const QList<CardState *> &cards, bool tapped)
|
||||
{
|
||||
QList<const ::google::protobuf::Message *> cmdList;
|
||||
for (CardItem *card : cards) {
|
||||
for (CardState *card : cards) {
|
||||
if (card->getTapped() != tapped) {
|
||||
auto *cmd = new Command_SetCardAttr;
|
||||
cmd->set_zone(zoneName.toStdString());
|
||||
|
|
|
|||
|
|
@ -8,8 +8,6 @@
|
|||
#ifndef COCKATRICE_PLAYER_ACTIONS_H
|
||||
#define COCKATRICE_PLAYER_ACTIONS_H
|
||||
|
||||
#include "../../game_graphics/board/card_item.h" // IWYU pragma: keep - moc instantiates the metatype for QList<CardItem *>, which Qt 6.4 needs complete
|
||||
#include "../board/card_list.h"
|
||||
#include "card_menu_action_type.h"
|
||||
#include "card_move_request.h"
|
||||
#include "libcockatrice/card/card_info.h"
|
||||
|
|
@ -37,6 +35,7 @@ class Message;
|
|||
}
|
||||
} // namespace google
|
||||
|
||||
class CardState;
|
||||
class CardZoneLogic;
|
||||
class Command_MoveCard;
|
||||
class PendingCommand;
|
||||
|
|
@ -84,14 +83,14 @@ public:
|
|||
* @param cards Cards the view wants toggled.
|
||||
* @param tapped Desired tapped state.
|
||||
*/
|
||||
void actToggleTapped(const QString &zoneName, const QList<CardItem *> &cards, bool tapped);
|
||||
void actToggleTapped(const QString &zoneName, const QList<CardState *> &cards, bool tapped);
|
||||
|
||||
/**
|
||||
* @brief Attaches one card to another on the table on behalf of a view.
|
||||
* @param startCard Card being attached.
|
||||
* @param targetCard Card being attached to.
|
||||
*/
|
||||
void attachCards(CardItem *startCard, const CardItem *targetCard);
|
||||
void attachCards(CardState *startCard, const CardState *targetCard);
|
||||
|
||||
/**
|
||||
* @brief Draws an arrow from a card to another card or a player on behalf of a view.
|
||||
|
|
@ -103,9 +102,9 @@ public:
|
|||
* @param arrow Arrow endpoints and color, as resolved by the view.
|
||||
* @param deleteInPhase Phase the arrow expires in, 0 to keep it until removed.
|
||||
*/
|
||||
void createArrow(CardItem *startCard, const ArrowData &arrow, int deleteInPhase);
|
||||
void createArrow(CardState *startCard, const ArrowData &arrow, int deleteInPhase);
|
||||
|
||||
void moveOneCardUntil(CardItem *card);
|
||||
void moveOneCardUntil(CardState *card);
|
||||
void stopMoveTopCardsUntil();
|
||||
|
||||
[[nodiscard]] bool isMovingCardsUntil() const
|
||||
|
|
@ -134,7 +133,7 @@ signals:
|
|||
void requestDrawBottomCardsDialog(int defaultNumberBottomCards, int maxCards);
|
||||
void requestRollDieDialog();
|
||||
void requestCreateTokenDialog(const QStringList &predefinedTokens);
|
||||
void requestCreateRelatedFromRelationDialog(const CardItem *sourceCard, const CardRelation *cardRelation);
|
||||
void requestCreateRelatedFromRelationDialog(const CardState *sourceCard, const CardRelation *cardRelation);
|
||||
void requestMoveCardXCardsFromTopDialog(int defaultNumberTopCardsToPlaceBelow, int deckSize);
|
||||
void requestSetPTDialog(const QString &oldPT);
|
||||
void requestSetAnnotationDialog(const QString &oldAnnotation);
|
||||
|
|
@ -147,8 +146,8 @@ signals:
|
|||
public slots:
|
||||
void setLastToken(CardInfoPtr cardInfo);
|
||||
void setLastTokenInfo(CardInfoPtr cardInfo);
|
||||
void playCard(CardItem *c, bool faceDown);
|
||||
void playCardToTable(const CardItem *c, bool faceDown);
|
||||
void playCard(CardState *c, bool faceDown);
|
||||
void playCardToTable(const CardState *c, bool faceDown);
|
||||
|
||||
void actUntapAll();
|
||||
void actRequestRollDieDialog();
|
||||
|
|
@ -157,9 +156,9 @@ public slots:
|
|||
void actRequestCreateTokenDialog(const QStringList &predefinedTokens);
|
||||
void actCreateToken(TokenInfo tokenToCreate);
|
||||
void actCreateAnotherToken();
|
||||
void actRequestCreateRelatedFromRelationDialog(const CardItem *sourceCard, const CardRelation *cardRelation);
|
||||
bool createRelatedFromRelation(const CardItem *sourceCard, const CardRelation *cardRelation, int variableCount);
|
||||
void onRelatedCardCreated(const CardItem *sourceCard, const CardRelation *cardRelation);
|
||||
void actRequestCreateRelatedFromRelationDialog(const CardState *sourceCard, const CardRelation *cardRelation);
|
||||
bool createRelatedFromRelation(const CardState *sourceCard, const CardRelation *cardRelation, int variableCount);
|
||||
void onRelatedCardCreated(const CardState *sourceCard, const CardRelation *cardRelation);
|
||||
void setLastRelatedCreationSucceeded(bool succeeded)
|
||||
{
|
||||
lastRelatedCreationSucceeded = succeeded;
|
||||
|
|
@ -179,9 +178,9 @@ public slots:
|
|||
void actMulliganMinusOne();
|
||||
void doMulligan(int number);
|
||||
|
||||
void actPlay(QList<CardItem *> selectedCards);
|
||||
void actPlayFacedown(QList<CardItem *> selectedCards);
|
||||
void actHide(QList<CardItem *> selectedCards);
|
||||
void actPlay(QList<CardState *> selectedCards);
|
||||
void actPlayFacedown(QList<CardState *> selectedCards);
|
||||
void actHide(QList<CardState *> selectedCards);
|
||||
|
||||
void actMoveTopCardToPlay();
|
||||
void actMoveTopCardToPlayFaceDown();
|
||||
|
|
@ -230,29 +229,29 @@ public slots:
|
|||
|
||||
void actOpenDeckInDeckEditor();
|
||||
void actCreatePredefinedToken();
|
||||
void actCreateRelatedCard(const CardItem *sourceCard, int index);
|
||||
void actCreateAllRelatedCards(const CardItem *sourceCard);
|
||||
void actCreateRelatedCard(const CardState *sourceCard, int index);
|
||||
void actCreateAllRelatedCards(const CardState *sourceCard);
|
||||
|
||||
void actRequestMoveCardXCardsFromTopDialog();
|
||||
void actMoveCardXCardsFromTop(QList<CardItem *> selectedCards, int number);
|
||||
void actRemoveCardCounter(QList<CardItem *> selectedCards, int counterId);
|
||||
void actAddCardCounter(QList<CardItem *> selectedCards, int counterId);
|
||||
void actRequestSetCardCounterDialog(QList<CardItem *> selectedCards, int counterId);
|
||||
void actSetCardCounter(QList<CardItem *> selectedCards, int counterId, const QString &counterValue);
|
||||
void actIncrementAllCardCounters(QList<CardItem *> cardsToUpdate);
|
||||
void actUnattach(QList<CardItem *> selectedCards);
|
||||
void actIncPT(QList<CardItem *> selectedCards, int deltaP, int deltaT);
|
||||
void actResetPT(QList<CardItem *> selectedCards);
|
||||
void actRequestSetPTDialog(QList<CardItem *> selectedCards);
|
||||
void actSetPT(QList<CardItem *> selectedCards, const QString &pt);
|
||||
void actIncP(QList<CardItem *> selectedCards);
|
||||
void actDecP(QList<CardItem *> selectedCards);
|
||||
void actIncT(QList<CardItem *> selectedCards);
|
||||
void actDecT(QList<CardItem *> selectedCards);
|
||||
void actIncPT(QList<CardItem *> selectedCards);
|
||||
void actDecPT(QList<CardItem *> selectedCards);
|
||||
void actFlowP(QList<CardItem *> selectedCards);
|
||||
void actFlowT(QList<CardItem *> selectedCards);
|
||||
void actMoveCardXCardsFromTop(QList<CardState *> selectedCards, int number);
|
||||
void actRemoveCardCounter(QList<CardState *> selectedCards, int counterId);
|
||||
void actAddCardCounter(QList<CardState *> selectedCards, int counterId);
|
||||
void actRequestSetCardCounterDialog(QList<CardState *> selectedCards, int counterId);
|
||||
void actSetCardCounter(QList<CardState *> selectedCards, int counterId, const QString &counterValue);
|
||||
void actIncrementAllCardCounters(QList<CardState *> cardsToUpdate);
|
||||
void actUnattach(QList<CardState *> selectedCards);
|
||||
void actIncPT(QList<CardState *> selectedCards, int deltaP, int deltaT);
|
||||
void actResetPT(QList<CardState *> selectedCards);
|
||||
void actRequestSetPTDialog(QList<CardState *> selectedCards);
|
||||
void actSetPT(QList<CardState *> selectedCards, const QString &pt);
|
||||
void actIncP(QList<CardState *> selectedCards);
|
||||
void actDecP(QList<CardState *> selectedCards);
|
||||
void actIncT(QList<CardState *> selectedCards);
|
||||
void actDecT(QList<CardState *> selectedCards);
|
||||
void actIncPT(QList<CardState *> selectedCards);
|
||||
void actDecPT(QList<CardState *> selectedCards);
|
||||
void actFlowP(QList<CardState *> selectedCards);
|
||||
void actFlowT(QList<CardState *> selectedCards);
|
||||
|
||||
/** @brief Adjusts a player counter by a signed delta. */
|
||||
void actIncrementCounter(int counterId, int delta);
|
||||
|
|
@ -260,18 +259,18 @@ public slots:
|
|||
/** @brief Sets a player counter to an absolute value. */
|
||||
void actSetCounter(int counterId, int value);
|
||||
|
||||
void actReduceLifeByPower(QList<CardItem *> selectedCards);
|
||||
void actReduceLifeByPower(QList<CardState *> selectedCards);
|
||||
|
||||
void actRequestSetAnnotationDialog(QList<CardItem *> selectedCards);
|
||||
void actSetAnnotation(QList<CardItem *> selectedCards, const QString &annotation);
|
||||
void actReveal(QList<CardItem *> selectedCards, QAction *action);
|
||||
void actRequestSetAnnotationDialog(QList<CardState *> selectedCards);
|
||||
void actSetAnnotation(QList<CardState *> selectedCards, const QString &annotation);
|
||||
void actReveal(QList<CardState *> selectedCards, QAction *action);
|
||||
void actRevealHand(int revealToPlayerId);
|
||||
void actRevealRandomHandCard(int revealToPlayerId);
|
||||
void actRevealLibrary(int revealToPlayerId);
|
||||
|
||||
void actSortHand();
|
||||
|
||||
void cardMenuAction(QList<CardItem *> selectedCards, CardMenuActionType type);
|
||||
void cardMenuAction(QList<CardState *> selectedCards, CardMenuActionType type);
|
||||
|
||||
private:
|
||||
PlayerLogic *player;
|
||||
|
|
@ -292,18 +291,18 @@ private:
|
|||
|
||||
bool lastRelatedCreationSucceeded = false;
|
||||
|
||||
void createCard(const CardItem *sourceCard,
|
||||
void createCard(const CardState *sourceCard,
|
||||
const QString &dbCardName,
|
||||
CardRelationType attach = CardRelationType::DoesNotAttach,
|
||||
bool persistent = false,
|
||||
bool faceDown = false);
|
||||
|
||||
void playSelectedCards(QList<CardItem *> selectedCards, bool faceDown = false);
|
||||
void playSelectedCards(QList<CardState *> selectedCards, bool faceDown = false);
|
||||
|
||||
void cmdSetTopCard(Command_MoveCard &cmd);
|
||||
void cmdSetBottomCard(Command_MoveCard &cmd);
|
||||
|
||||
void offsetCardCounter(QList<CardItem *> selectedCards, int counterId, int offset);
|
||||
void offsetCardCounter(QList<CardState *> selectedCards, int counterId, int offset);
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_PLAYER_ACTIONS_H
|
||||
|
|
|
|||
|
|
@ -396,7 +396,7 @@ void PlayerEventHandler::eventMoveCard(const Event_MoveCard &event, const GameEv
|
|||
|
||||
if (player->getPlayerActions()->isMovingCardsUntil() && startZoneString == ZoneNames::DECK &&
|
||||
targetZone->getName() == ZoneNames::STACK) {
|
||||
player->getPlayerActions()->moveOneCardUntil(toCardItem(card));
|
||||
player->getPlayerActions()->moveOneCardUntil(card);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue