mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 09:04:53 -07:00
hide action now applies to all selected cards (#5233)
* hide action now applies to all selected cards * check card zone before applying action so that we don't nuke cards from existence when we select across multiple zones * small fixes * remove redundant loop * nullcheck view
This commit is contained in:
parent
e9b78c1c59
commit
628bdde939
1 changed files with 18 additions and 3 deletions
|
|
@ -3442,6 +3442,19 @@ void Player::actCardCounterTrigger()
|
||||||
sendGameCommand(prepareGameCommand(commandList));
|
sendGameCommand(prepareGameCommand(commandList));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief returns true if the zone is a unwritable reveal zone view (eg a card reveal window). Will return false if zone
|
||||||
|
* is nullptr.
|
||||||
|
*/
|
||||||
|
static bool isUnwritableRevealZone(CardZone *zone)
|
||||||
|
{
|
||||||
|
if (zone && zone->getIsView()) {
|
||||||
|
auto *view = static_cast<ZoneViewZone *>(zone);
|
||||||
|
return view && view->getRevealZone() && !view->getWriteableRevealZone();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void Player::actPlay()
|
void Player::actPlay()
|
||||||
{
|
{
|
||||||
auto *card = game->getActiveCard();
|
auto *card = game->getActiveCard();
|
||||||
|
|
@ -3453,9 +3466,11 @@ void Player::actPlay()
|
||||||
|
|
||||||
void Player::actHide()
|
void Player::actHide()
|
||||||
{
|
{
|
||||||
auto *card = game->getActiveCard();
|
for (const auto &item : scene()->selectedItems()) {
|
||||||
if (card) {
|
auto *card = static_cast<CardItem *>(item);
|
||||||
card->getZone()->removeCard(card);
|
if (card && isUnwritableRevealZone(card->getZone())) {
|
||||||
|
card->getZone()->removeCard(card);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue