本文整理汇总了C++中Quest::setIsPartiallyCompleted方法的典型用法代码示例。如果您正苦于以下问题:C++ Quest::setIsPartiallyCompleted方法的具体用法?C++ Quest::setIsPartiallyCompleted怎么用?C++ Quest::setIsPartiallyCompleted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quest
的用法示例。
在下文中一共展示了Quest::setIsPartiallyCompleted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doQuest
/**
* @brief GameMaster::wykonajQuest Wykonuje zadanie o podanym id.
* Działanie jest uzależnione od stopnia wykonania zadania.
* Metoda zakłada, że zadanie o podany
* @param gracz dane gracza, wykonującego zadanie
* @param id id zadania
*/
void GameMaster::doQuest(int questId)
{
currentPlayer_->setHasFoughtRecently(false);
int questIndex = 0;
while (currentPlayer_->quest(questIndex)->id() != questId)
++questIndex;
Quest *quest = currentPlayer_->quest(questIndex);
switch (quest->type()) {
case przynies:
if (quest->isPartiallyCompleted()) {
grantPrize(currentPlayer_, quest->prize(), false);
currentPlayer_->removeQuest(questId);
determinePossibleActions();
actionPanel_->displayActions(possibleActions_);
} else {
quest->setIsPartiallyCompleted(true);
quest->setTargetField(quest->employerField());
gameCycle_->endTurn();
}
break;
case odnajdz: {
if (quest->isPartiallyCompleted()) {
grantPrize(currentPlayer_, quest->prize(), false);
currentPlayer_->removeQuest(questId);
determinePossibleActions();
actionPanel_->displayActions(possibleActions_);
break;
}
int chance = BAZOWA_SZANSA_NA_ODNALEZIENIE + currentPlayer_->perception() * BONUS_Z_PERCEPCJI;
bool success = qrand() % 100 < chance;
QMessageBox::information(
gameCycle_->mainWindow(),
quest->title(),
success ?
QString::fromUtf8("Udało Ci się wykonać zadanie.") :
QString::fromUtf8("Niestety, nie udało Ci się wykonać zadania.")
);
if (success) {
if (quest->isReturnRequired()) {
quest->setIsPartiallyCompleted(true);
quest->setTargetField(quest->employerField());
} else {
grantPrize(currentPlayer_, quest->prize(), true);
currentPlayer_->removeQuest(questId);
}
}
gameCycle_->endTurn();
break;
}
case pokonaj:
if (quest->isPartiallyCompleted()) {
grantPrize(currentPlayer_, quest->prize(), false);
currentPlayer_->removeQuest(questId);
determinePossibleActions();
actionPanel_->displayActions(possibleActions_);
} else {
currentQuest_ = quest;
startFight(QuestEnemy);
}
break;
}
}