mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
Always look at top card (#4238)
* Add option to always look at top card of deck Similar to "always reveal", but reveals card only to the owner, not all players. * Add option to always look at top card of deck Similar to "always reveal", but reveals card only to the owner, not all players. * Update bug_report.md (#4246) * Update bug_report.md * reproduction steps * Update to address review comments * Clangify * set playerId on dumpEvent Co-authored-by: tooomm <tooomm@users.noreply.github.com> Co-authored-by: ebbit1q <ebbit1q@gmail.com> Co-authored-by: Zach H <zahalpern+github@gmail.com>
This commit is contained in:
parent
00ed5c370c
commit
073349fd05
12 changed files with 120 additions and 54 deletions
|
|
@ -211,6 +211,9 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
aAlwaysRevealTopCard = new QAction(this);
|
||||
aAlwaysRevealTopCard->setCheckable(true);
|
||||
connect(aAlwaysRevealTopCard, SIGNAL(triggered()), this, SLOT(actAlwaysRevealTopCard()));
|
||||
aAlwaysLookAtTopCard = new QAction(this);
|
||||
aAlwaysLookAtTopCard->setCheckable(true);
|
||||
connect(aAlwaysLookAtTopCard, SIGNAL(triggered()), this, SLOT(actAlwaysLookAtTopCard()));
|
||||
aOpenDeckInDeckEditor = new QAction(this);
|
||||
aOpenDeckInDeckEditor->setEnabled(false);
|
||||
connect(aOpenDeckInDeckEditor, SIGNAL(triggered()), this, SLOT(actOpenDeckInDeckEditor()));
|
||||
|
|
@ -287,6 +290,7 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, bool _judge, T
|
|||
playerLists.append(mRevealLibrary = libraryMenu->addMenu(QString()));
|
||||
playerLists.append(mRevealTopCard = libraryMenu->addMenu(QString()));
|
||||
libraryMenu->addAction(aAlwaysRevealTopCard);
|
||||
libraryMenu->addAction(aAlwaysLookAtTopCard);
|
||||
libraryMenu->addSeparator();
|
||||
libraryMenu->addAction(aMoveTopToPlay);
|
||||
libraryMenu->addAction(aMoveTopToPlayFaceDown);
|
||||
|
|
@ -697,6 +701,7 @@ void Player::retranslateUi()
|
|||
mRevealLibrary->setTitle(tr("Reveal &library to..."));
|
||||
mRevealTopCard->setTitle(tr("Reveal t&op cards to..."));
|
||||
aAlwaysRevealTopCard->setText(tr("&Always reveal top card"));
|
||||
aAlwaysLookAtTopCard->setText(tr("Al&ways look at top card"));
|
||||
aOpenDeckInDeckEditor->setText(tr("O&pen deck in deck editor"));
|
||||
aViewSideboard->setText(tr("&View sideboard"));
|
||||
aDrawCard->setText(tr("&Draw card"));
|
||||
|
|
@ -874,6 +879,7 @@ void Player::setShortcutsActive()
|
|||
aCreateToken->setShortcut(shortcuts.getSingleShortcut("Player/aCreateToken"));
|
||||
aCreateAnotherToken->setShortcut(shortcuts.getSingleShortcut("Player/aCreateAnotherToken"));
|
||||
aAlwaysRevealTopCard->setShortcut(shortcuts.getSingleShortcut("Player/aAlwaysRevealTopCard"));
|
||||
aAlwaysLookAtTopCard->setShortcut(shortcuts.getSingleShortcut("Player/aAlwaysLookAtTopCard"));
|
||||
aMoveTopToPlay->setShortcut(shortcuts.getSingleShortcut("Player/aMoveTopToPlay"));
|
||||
aMoveTopToPlayFaceDown->setShortcut(shortcuts.getSingleShortcut("Player/aMoveTopToPlayFaceDown"));
|
||||
aMoveTopCardToGraveyard->setShortcut(shortcuts.getSingleShortcut("Player/aMoveTopCardToGraveyard"));
|
||||
|
|
@ -905,6 +911,7 @@ void Player::setShortcutsInactive()
|
|||
aCreateToken->setShortcut(QKeySequence());
|
||||
aCreateAnotherToken->setShortcut(QKeySequence());
|
||||
aAlwaysRevealTopCard->setShortcut(QKeySequence());
|
||||
aAlwaysLookAtTopCard->setShortcut(QKeySequence());
|
||||
aMoveTopToPlay->setShortcut(QKeySequence());
|
||||
aMoveTopToPlayFaceDown->setShortcut(QKeySequence());
|
||||
aMoveTopCardToGraveyard->setShortcut(QKeySequence());
|
||||
|
|
@ -991,6 +998,15 @@ void Player::actAlwaysRevealTopCard()
|
|||
sendGameCommand(cmd);
|
||||
}
|
||||
|
||||
void Player::actAlwaysLookAtTopCard()
|
||||
{
|
||||
Command_ChangeZoneProperties cmd;
|
||||
cmd.set_zone_name("deck");
|
||||
cmd.set_always_look_at_top_card(aAlwaysLookAtTopCard->isChecked());
|
||||
|
||||
sendGameCommand(cmd);
|
||||
}
|
||||
|
||||
void Player::actOpenDeckInDeckEditor()
|
||||
{
|
||||
emit openDeckEditor(deck);
|
||||
|
|
@ -1976,6 +1992,10 @@ void Player::eventChangeZoneProperties(const Event_ChangeZoneProperties &event)
|
|||
zone->setAlwaysRevealTopCard(event.always_reveal_top_card());
|
||||
emit logAlwaysRevealTopCard(this, zone, event.always_reveal_top_card());
|
||||
}
|
||||
if (event.has_always_look_at_top_card()) {
|
||||
zone->setAlwaysRevealTopCard(event.always_look_at_top_card());
|
||||
emit logAlwaysLookAtTopCard(this, zone, event.always_look_at_top_card());
|
||||
}
|
||||
}
|
||||
|
||||
void Player::processGameEvent(GameEvent::GameEventType type, const GameEvent &event, const GameEventContext &context)
|
||||
|
|
@ -3271,6 +3291,7 @@ void Player::setGameStarted()
|
|||
{
|
||||
if (local) {
|
||||
aAlwaysRevealTopCard->setChecked(false);
|
||||
aAlwaysLookAtTopCard->setChecked(false);
|
||||
}
|
||||
setConceded(false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue