mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-21 09:52:16 -07:00
get thing to work
This commit is contained in:
parent
54f0bb1895
commit
77cdda62dc
2 changed files with 28 additions and 6 deletions
|
|
@ -1331,10 +1331,10 @@ void Player::actMoveTopCardsToExile()
|
||||||
|
|
||||||
void Player::actMoveTopCardsUntil()
|
void Player::actMoveTopCardsUntil()
|
||||||
{
|
{
|
||||||
moveTopCardTimer->stop();
|
stopMoveTopCardsUntil();
|
||||||
movingCardsUntil = false;
|
|
||||||
QString expr = previousMovingCardsUntilExpr;
|
QString expr = previousMovingCardsUntilExpr;
|
||||||
uint numberOfHits = 1;
|
int numberOfHits = previousMovingCardsUntilNumberOfHits;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
DlgMoveTopCardsUntil dlg(game, expr, numberOfHits);
|
DlgMoveTopCardsUntil dlg(game, expr, numberOfHits);
|
||||||
if (!dlg.exec()) {
|
if (!dlg.exec()) {
|
||||||
|
|
@ -1355,9 +1355,11 @@ void Player::actMoveTopCardsUntil()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
previousMovingCardsUntilExpr = expr;
|
previousMovingCardsUntilExpr = expr;
|
||||||
|
previousMovingCardsUntilNumberOfHits = numberOfHits;
|
||||||
if (zones.value("deck")->getCards().empty()) {
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
movingCardsUntil = false;
|
stopMoveTopCardsUntil();
|
||||||
} else {
|
} else {
|
||||||
|
movingCardsUntilCounter = numberOfHits;
|
||||||
movingCardsUntil = true;
|
movingCardsUntil = true;
|
||||||
actMoveTopCardToPlay();
|
actMoveTopCardToPlay();
|
||||||
}
|
}
|
||||||
|
|
@ -1366,13 +1368,30 @@ void Player::actMoveTopCardsUntil()
|
||||||
void Player::moveOneCardUntil(const CardInfoPtr card)
|
void Player::moveOneCardUntil(const CardInfoPtr card)
|
||||||
{
|
{
|
||||||
moveTopCardTimer->stop();
|
moveTopCardTimer->stop();
|
||||||
if (zones.value("deck")->getCards().empty() || card.isNull() || movingCardsUntilFilter.check(card)) {
|
if (zones.value("deck")->getCards().empty() || card.isNull()) {
|
||||||
movingCardsUntil = false;
|
stopMoveTopCardsUntil();
|
||||||
|
} else if (movingCardsUntilFilter.check(card)) {
|
||||||
|
--movingCardsUntilCounter;
|
||||||
|
if (movingCardsUntilCounter > 0) {
|
||||||
|
moveTopCardTimer->start();
|
||||||
|
} else {
|
||||||
|
stopMoveTopCardsUntil();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
moveTopCardTimer->start();
|
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()
|
void Player::actMoveTopCardToBottom()
|
||||||
{
|
{
|
||||||
if (zones.value("deck")->getCards().empty()) {
|
if (zones.value("deck")->getCards().empty()) {
|
||||||
|
|
|
||||||
|
|
@ -267,7 +267,10 @@ private:
|
||||||
bool movingCardsUntil;
|
bool movingCardsUntil;
|
||||||
QTimer *moveTopCardTimer;
|
QTimer *moveTopCardTimer;
|
||||||
QString previousMovingCardsUntilExpr = {};
|
QString previousMovingCardsUntilExpr = {};
|
||||||
|
int previousMovingCardsUntilNumberOfHits = 1;
|
||||||
FilterString movingCardsUntilFilter;
|
FilterString movingCardsUntilFilter;
|
||||||
|
int movingCardsUntilCounter = 0;
|
||||||
|
void stopMoveTopCardsUntil();
|
||||||
|
|
||||||
bool shortcutsActive;
|
bool shortcutsActive;
|
||||||
int defaultNumberTopCards = 1;
|
int defaultNumberTopCards = 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue