get thing to work

This commit is contained in:
RickyRister 2024-12-07 02:50:34 -08:00
parent 54f0bb1895
commit 77cdda62dc
2 changed files with 28 additions and 6 deletions

View file

@ -1331,10 +1331,10 @@ void Player::actMoveTopCardsToExile()
void Player::actMoveTopCardsUntil()
{
moveTopCardTimer->stop();
movingCardsUntil = false;
stopMoveTopCardsUntil();
QString expr = previousMovingCardsUntilExpr;
uint numberOfHits = 1;
int numberOfHits = previousMovingCardsUntilNumberOfHits;
for (;;) {
DlgMoveTopCardsUntil dlg(game, expr, numberOfHits);
if (!dlg.exec()) {
@ -1355,9 +1355,11 @@ void Player::actMoveTopCardsUntil()
}
}
previousMovingCardsUntilExpr = expr;
previousMovingCardsUntilNumberOfHits = numberOfHits;
if (zones.value("deck")->getCards().empty()) {
movingCardsUntil = false;
stopMoveTopCardsUntil();
} else {
movingCardsUntilCounter = numberOfHits;
movingCardsUntil = true;
actMoveTopCardToPlay();
}
@ -1366,13 +1368,30 @@ void Player::actMoveTopCardsUntil()
void Player::moveOneCardUntil(const CardInfoPtr card)
{
moveTopCardTimer->stop();
if (zones.value("deck")->getCards().empty() || card.isNull() || movingCardsUntilFilter.check(card)) {
movingCardsUntil = false;
if (zones.value("deck")->getCards().empty() || card.isNull()) {
stopMoveTopCardsUntil();
} else if (movingCardsUntilFilter.check(card)) {
--movingCardsUntilCounter;
if (movingCardsUntilCounter > 0) {
moveTopCardTimer->start();
} else {
stopMoveTopCardsUntil();
}
} else {
moveTopCardTimer->start();
}
}
/**
* @brief Immediately stops any ongoing `play top card to stack until...` process, resetting all variables involved.
*/
void Player::stopMoveTopCardsUntil()
{
moveTopCardTimer->stop();
movingCardsUntilCounter = 0;
movingCardsUntil = false;
}
void Player::actMoveTopCardToBottom()
{
if (zones.value("deck")->getCards().empty()) {

View file

@ -267,7 +267,10 @@ private:
bool movingCardsUntil;
QTimer *moveTopCardTimer;
QString previousMovingCardsUntilExpr = {};
int previousMovingCardsUntilNumberOfHits = 1;
FilterString movingCardsUntilFilter;
int movingCardsUntilCounter = 0;
void stopMoveTopCardsUntil();
bool shortcutsActive;
int defaultNumberTopCards = 1;