mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-21 01:42:15 -07:00
check card zone before applying action
so that we don't nuke cards from existence when we select across multiple zones
This commit is contained in:
parent
2779ee2f60
commit
fb0fd14e29
1 changed files with 13 additions and 1 deletions
|
|
@ -3433,6 +3433,18 @@ void Player::actCardCounterTrigger()
|
|||
sendGameCommand(prepareGameCommand(commandList));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief returns true if the zone is a unwritable reveal zone view (eg a card reveal window)
|
||||
*/
|
||||
static bool isUnwritableRevealZone(CardZone *zone)
|
||||
{
|
||||
if (zone && zone->getIsView()) {
|
||||
auto *view = dynamic_cast<ZoneViewZone *>(zone);
|
||||
return view->getRevealZone() && !view->getWriteableRevealZone();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Player::actPlay()
|
||||
{
|
||||
auto *card = game->getActiveCard();
|
||||
|
|
@ -3451,7 +3463,7 @@ void Player::actHide()
|
|||
}
|
||||
|
||||
for (auto &card : selectedCards) {
|
||||
if (card) {
|
||||
if (card && isUnwritableRevealZone(card->getZone())) {
|
||||
card->getZone()->removeCard(card);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue