* add reset power and toughness function on cards Add actResetPT to set the power and toughness in the same way as actSetPT but instead of prompting the user it will fetch the original pt from the card info for each card. Add the new command to the card rmb list, keybinds and settings. * changed style to .clang-format Please change the contributing guidelines to use this style instead.
This commit is contained in:
parent
bc2cb59c50
commit
75203cf385
4 changed files with 51 additions and 8 deletions
|
@ -390,6 +390,8 @@ Player::Player(const ServerInfo_User &info, int _id, bool _local, TabGame *_pare
|
||||||
connect(aDecPT, SIGNAL(triggered()), this, SLOT(actDecPT()));
|
connect(aDecPT, SIGNAL(triggered()), this, SLOT(actDecPT()));
|
||||||
aSetPT = new QAction(this);
|
aSetPT = new QAction(this);
|
||||||
connect(aSetPT, SIGNAL(triggered()), this, SLOT(actSetPT()));
|
connect(aSetPT, SIGNAL(triggered()), this, SLOT(actSetPT()));
|
||||||
|
aResetPT = new QAction(this);
|
||||||
|
connect(aResetPT, SIGNAL(triggered()), this, SLOT(actResetPT()));
|
||||||
aSetAnnotation = new QAction(this);
|
aSetAnnotation = new QAction(this);
|
||||||
connect(aSetAnnotation, SIGNAL(triggered()), this, SLOT(actSetAnnotation()));
|
connect(aSetAnnotation, SIGNAL(triggered()), this, SLOT(actSetAnnotation()));
|
||||||
aFlip = new QAction(this);
|
aFlip = new QAction(this);
|
||||||
|
@ -702,6 +704,7 @@ void Player::retranslateUi()
|
||||||
aIncPT->setText(tr("In&crease power and toughness"));
|
aIncPT->setText(tr("In&crease power and toughness"));
|
||||||
aDecPT->setText(tr("Dec&rease power and toughness"));
|
aDecPT->setText(tr("Dec&rease power and toughness"));
|
||||||
aSetPT->setText(tr("Set &power and toughness..."));
|
aSetPT->setText(tr("Set &power and toughness..."));
|
||||||
|
aResetPT->setText(tr("Reset p&ower and toughness"));
|
||||||
aSetAnnotation->setText(tr("&Set annotation..."));
|
aSetAnnotation->setText(tr("&Set annotation..."));
|
||||||
|
|
||||||
QStringList counterColors;
|
QStringList counterColors;
|
||||||
|
@ -751,6 +754,7 @@ void Player::setShortcutsActive()
|
||||||
aIncPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aIncPT"));
|
aIncPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aIncPT"));
|
||||||
aDecPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDecPT"));
|
aDecPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aDecPT"));
|
||||||
aSetPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aSetPT"));
|
aSetPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aSetPT"));
|
||||||
|
aResetPT->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aResetPT"));
|
||||||
aSetAnnotation->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aSetAnnotation"));
|
aSetAnnotation->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aSetAnnotation"));
|
||||||
aMoveToTopLibrary->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aMoveToTopLibrary"));
|
aMoveToTopLibrary->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aMoveToTopLibrary"));
|
||||||
aMoveToBottomLibrary->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aMoveToBottomLibrary"));
|
aMoveToBottomLibrary->setShortcuts(settingsCache->shortcuts().getShortcut("Player/aMoveToBottomLibrary"));
|
||||||
|
@ -2347,6 +2351,31 @@ void Player::actIncPT(int deltaP, int deltaT)
|
||||||
game->sendGameCommand(prepareGameCommand(commandList), playerid);
|
game->sendGameCommand(prepareGameCommand(commandList), playerid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Player::actResetPT()
|
||||||
|
{
|
||||||
|
int playerid = id;
|
||||||
|
QList<const ::google::protobuf::Message *> commandList;
|
||||||
|
QListIterator<QGraphicsItem *> selected(scene()->selectedItems());
|
||||||
|
while (selected.hasNext()) {
|
||||||
|
CardItem *card = static_cast<CardItem *>(selected.next());
|
||||||
|
CardInfoPtr info = card->getInfo();
|
||||||
|
Command_SetCardAttr *cmd = new Command_SetCardAttr;
|
||||||
|
QString zoneName = card->getZone()->getName();
|
||||||
|
cmd->set_zone(zoneName.toStdString());
|
||||||
|
cmd->set_card_id(card->getId());
|
||||||
|
cmd->set_attribute(AttrPT);
|
||||||
|
QString ptString = info->getPowTough();
|
||||||
|
cmd->set_attr_value(ptString.toStdString());
|
||||||
|
commandList.append(cmd);
|
||||||
|
|
||||||
|
if (local) {
|
||||||
|
playerid = card->getZone()->getPlayer()->getId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
game->sendGameCommand(prepareGameCommand(commandList), playerid);
|
||||||
|
}
|
||||||
|
|
||||||
void Player::actSetPT()
|
void Player::actSetPT()
|
||||||
{
|
{
|
||||||
QString oldPT;
|
QString oldPT;
|
||||||
|
@ -2636,6 +2665,7 @@ void Player::updateCardMenu(const CardItem *card)
|
||||||
ptMenu->addAction(aDecPT);
|
ptMenu->addAction(aDecPT);
|
||||||
ptMenu->addSeparator();
|
ptMenu->addSeparator();
|
||||||
ptMenu->addAction(aSetPT);
|
ptMenu->addAction(aSetPT);
|
||||||
|
ptMenu->addAction(aResetPT);
|
||||||
}
|
}
|
||||||
|
|
||||||
cardMenu->addAction(aTap);
|
cardMenu->addAction(aTap);
|
||||||
|
|
|
@ -177,6 +177,7 @@ private slots:
|
||||||
void actUnattach();
|
void actUnattach();
|
||||||
void actDrawArrow();
|
void actDrawArrow();
|
||||||
void actIncPT(int deltaP, int deltaT);
|
void actIncPT(int deltaP, int deltaT);
|
||||||
|
void actResetPT();
|
||||||
void actSetPT();
|
void actSetPT();
|
||||||
void actIncP();
|
void actIncP();
|
||||||
void actDecP();
|
void actDecP();
|
||||||
|
@ -206,8 +207,8 @@ private:
|
||||||
*aCardMenu, *aMoveBottomCardToGrave;
|
*aCardMenu, *aMoveBottomCardToGrave;
|
||||||
|
|
||||||
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
QList<QAction *> aAddCounter, aSetCounter, aRemoveCounter;
|
||||||
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aIncP,
|
QAction *aPlay, *aPlayFacedown, *aHide, *aTap, *aDoesntUntap, *aAttach, *aUnattach, *aDrawArrow, *aSetPT, *aResetPT,
|
||||||
*aDecP, *aIncT, *aDecT, *aIncPT, *aDecPT, *aSetAnnotation, *aFlip, *aPeek, *aClone, *aMoveToTopLibrary,
|
*aIncP, *aDecP, *aIncT, *aDecT, *aIncPT, *aDecPT, *aSetAnnotation, *aFlip, *aPeek, *aClone, *aMoveToTopLibrary,
|
||||||
*aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToExile, *aMoveToXfromTopOfLibrary;
|
*aMoveToBottomLibrary, *aMoveToHand, *aMoveToGraveyard, *aMoveToExile, *aMoveToXfromTopOfLibrary;
|
||||||
|
|
||||||
bool shortcutsActive;
|
bool shortcutsActive;
|
||||||
|
|
|
@ -205,6 +205,8 @@ public:
|
||||||
QLabel *lbl_Player_aDecPT;
|
QLabel *lbl_Player_aDecPT;
|
||||||
SequenceEdit *Player_aSetPT;
|
SequenceEdit *Player_aSetPT;
|
||||||
QLabel *lbl_Player_aSetPT;
|
QLabel *lbl_Player_aSetPT;
|
||||||
|
SequenceEdit *Player_aResetPT;
|
||||||
|
QLabel *lbl_Player_aResetPT;
|
||||||
QGroupBox *groupBox_11;
|
QGroupBox *groupBox_11;
|
||||||
QGridLayout *gridLayout_11;
|
QGridLayout *gridLayout_11;
|
||||||
QLabel *lbl_Player_aDecT;
|
QLabel *lbl_Player_aDecT;
|
||||||
|
@ -1030,22 +1032,22 @@ public:
|
||||||
Player_aDecPT = new SequenceEdit("Player/aDecPT", groupBox_12);
|
Player_aDecPT = new SequenceEdit("Player/aDecPT", groupBox_12);
|
||||||
Player_aDecPT->setObjectName("Player_aDecPT");
|
Player_aDecPT->setObjectName("Player_aDecPT");
|
||||||
|
|
||||||
gridLayout_12->addWidget(Player_aDecPT, 2, 1, 1, 1);
|
gridLayout_12->addWidget(Player_aDecPT, 3, 1, 1, 1);
|
||||||
|
|
||||||
Player_aIncPT = new SequenceEdit("Player/aIncPT", groupBox_12);
|
Player_aIncPT = new SequenceEdit("Player/aIncPT", groupBox_12);
|
||||||
Player_aIncPT->setObjectName("Player_aIncPT");
|
Player_aIncPT->setObjectName("Player_aIncPT");
|
||||||
|
|
||||||
gridLayout_12->addWidget(Player_aIncPT, 1, 1, 1, 1);
|
gridLayout_12->addWidget(Player_aIncPT, 2, 1, 1, 1);
|
||||||
|
|
||||||
lbl_Player_aIncPT = new QLabel(groupBox_12);
|
lbl_Player_aIncPT = new QLabel(groupBox_12);
|
||||||
lbl_Player_aIncPT->setObjectName("lbl_Player_aIncPT");
|
lbl_Player_aIncPT->setObjectName("lbl_Player_aIncPT");
|
||||||
|
|
||||||
gridLayout_12->addWidget(lbl_Player_aIncPT, 1, 0, 1, 1);
|
gridLayout_12->addWidget(lbl_Player_aIncPT, 2, 0, 1, 1);
|
||||||
|
|
||||||
lbl_Player_aDecPT = new QLabel(groupBox_12);
|
lbl_Player_aDecPT = new QLabel(groupBox_12);
|
||||||
lbl_Player_aDecPT->setObjectName("lbl_Player_aDecPT");
|
lbl_Player_aDecPT->setObjectName("lbl_Player_aDecPT");
|
||||||
|
|
||||||
gridLayout_12->addWidget(lbl_Player_aDecPT, 2, 0, 1, 1);
|
gridLayout_12->addWidget(lbl_Player_aDecPT, 3, 0, 1, 1);
|
||||||
|
|
||||||
Player_aSetPT = new SequenceEdit("Player/aSetPT", groupBox_12);
|
Player_aSetPT = new SequenceEdit("Player/aSetPT", groupBox_12);
|
||||||
Player_aSetPT->setObjectName("Player_aSetPT");
|
Player_aSetPT->setObjectName("Player_aSetPT");
|
||||||
|
@ -1057,6 +1059,16 @@ public:
|
||||||
|
|
||||||
gridLayout_12->addWidget(lbl_Player_aSetPT, 0, 0, 1, 1);
|
gridLayout_12->addWidget(lbl_Player_aSetPT, 0, 0, 1, 1);
|
||||||
|
|
||||||
|
Player_aResetPT = new SequenceEdit("Player/aResetPT", groupBox_12);
|
||||||
|
Player_aResetPT->setObjectName("Player_aResetPT");
|
||||||
|
|
||||||
|
gridLayout_12->addWidget(Player_aResetPT, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
lbl_Player_aResetPT = new QLabel(groupBox_12);
|
||||||
|
lbl_Player_aResetPT->setObjectName("lbl_Player_aResetPT");
|
||||||
|
|
||||||
|
gridLayout_12->addWidget(lbl_Player_aResetPT, 1, 0, 1, 1);
|
||||||
|
|
||||||
verticalLayout->addWidget(groupBox_12);
|
verticalLayout->addWidget(groupBox_12);
|
||||||
|
|
||||||
groupBox_11 = new QGroupBox(groupBox_9);
|
groupBox_11 = new QGroupBox(groupBox_9);
|
||||||
|
@ -1458,8 +1470,6 @@ public:
|
||||||
|
|
||||||
gridLayout_15->addWidget(Player_aMoveTopToPlayFaceDown, 5, 1, 1, 1);
|
gridLayout_15->addWidget(Player_aMoveTopToPlayFaceDown, 5, 1, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gridLayout_20->addWidget(groupBox_15, 0, 1, 1, 1);
|
gridLayout_20->addWidget(groupBox_15, 0, 1, 1, 1);
|
||||||
|
|
||||||
groupBox_16 = new QGroupBox(tab_3);
|
groupBox_16 = new QGroupBox(tab_3);
|
||||||
|
@ -1844,6 +1854,7 @@ public:
|
||||||
groupBox_12->setTitle(QApplication::translate("shortcutsTab", "Power and Toughness", 0));
|
groupBox_12->setTitle(QApplication::translate("shortcutsTab", "Power and Toughness", 0));
|
||||||
lbl_Player_aIncPT->setText(QApplication::translate("shortcutsTab", "Add (+1/+1)", 0));
|
lbl_Player_aIncPT->setText(QApplication::translate("shortcutsTab", "Add (+1/+1)", 0));
|
||||||
lbl_Player_aDecPT->setText(QApplication::translate("shortcutsTab", "Remove (-1/-1)", 0));
|
lbl_Player_aDecPT->setText(QApplication::translate("shortcutsTab", "Remove (-1/-1)", 0));
|
||||||
|
lbl_Player_aResetPT->setText(QApplication::translate("shortcutsTab", "Reset", 0));
|
||||||
lbl_Player_aSetPT->setText(QApplication::translate("shortcutsTab", "Set", 0));
|
lbl_Player_aSetPT->setText(QApplication::translate("shortcutsTab", "Set", 0));
|
||||||
groupBox_11->setTitle(QApplication::translate("shortcutsTab", "Toughness", 0));
|
groupBox_11->setTitle(QApplication::translate("shortcutsTab", "Toughness", 0));
|
||||||
lbl_Player_aDecT->setText(QApplication::translate("shortcutsTab", "Remove (-0/-1)", 0));
|
lbl_Player_aDecT->setText(QApplication::translate("shortcutsTab", "Remove (-0/-1)", 0));
|
||||||
|
|
|
@ -265,6 +265,7 @@ void ShortcutsSettings::fillDefaultShorcuts()
|
||||||
defaultShortCuts["Player/aSCYellow"] = parseSequenceString("");
|
defaultShortCuts["Player/aSCYellow"] = parseSequenceString("");
|
||||||
defaultShortCuts["Player/aSetAnnotation"] = parseSequenceString("");
|
defaultShortCuts["Player/aSetAnnotation"] = parseSequenceString("");
|
||||||
defaultShortCuts["Player/aSetPT"] = parseSequenceString("Ctrl+P");
|
defaultShortCuts["Player/aSetPT"] = parseSequenceString("Ctrl+P");
|
||||||
|
defaultShortCuts["Player/aResetPT"] = parseSequenceString("Ctrl+Alt+0");
|
||||||
defaultShortCuts["Player/aShuffle"] = parseSequenceString("Ctrl+S");
|
defaultShortCuts["Player/aShuffle"] = parseSequenceString("Ctrl+S");
|
||||||
defaultShortCuts["Player/aTap"] = parseSequenceString("");
|
defaultShortCuts["Player/aTap"] = parseSequenceString("");
|
||||||
defaultShortCuts["Player/aUnattach"] = parseSequenceString("");
|
defaultShortCuts["Player/aUnattach"] = parseSequenceString("");
|
||||||
|
|
Loading…
Reference in a new issue