本文整理汇总了C++中Dice::RollDice方法的典型用法代码示例。如果您正苦于以下问题:C++ Dice::RollDice方法的具体用法?C++ Dice::RollDice怎么用?C++ Dice::RollDice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dice
的用法示例。
在下文中一共展示了Dice::RollDice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RollDiceBeforeThrowingDoublet
bool Game::RollDiceBeforeThrowingDoublet(Player* activePlayer, Dice& firstDice, Dice& secondDice, ButtonText& button, bool ShownCard)
{
int firstRollDice = firstDice.RollDice();
int secondRollDice = secondDice.RollDice();
if (!activePlayer->IsBlocked())
{
if (activePlayer->GetPawn().move(firstRollDice + secondRollDice))
activePlayer->AddMoney(200);
activePlayer->SetActiveField(true);
ShownCard = false;
if (firstRollDice == secondRollDice)
{
activePlayer->SetDoublet(true);
button.GetText().setString(L"Wyrzuciłeś dublet!\nRzuć kostkami jeszcze raz!");
}
else
activePlayer->SetActiveMovement(false);
}
else
{
if (firstRollDice == secondRollDice)
{
activePlayer->SetDoublet(true);
button.GetText().setString(L"Wyrzuciłeś dublet!\nRzuć kostkami jeszcze raz!");
}
else
{
button.GetText().setString(L"Nie udało się wyrzucić dubletu!\nOddaj ruch kolejnemu graczowi!");
activePlayer->SetActiveMovement(false);
}
--(*activePlayer);
}
return ShownCard;
}
示例2: RollDiceAfterThrowingDoublet
bool Game::RollDiceAfterThrowingDoublet(Player* activePlayer, Dice& firstDice, Dice& secondDice, ButtonText& button, bool ShownCard)
{
int firstRollDice = firstDice.RollDice();
int secondRollDice = secondDice.RollDice();
if (!activePlayer->IsBlocked())
{
if (firstRollDice != secondRollDice)
{
textButtons[1].GetText().setString(L"Brak...");
if (activePlayer->GetPawn().move(firstRollDice + secondRollDice))
activePlayer->AddMoney(200);
activePlayer->SetActiveField(true);
ShownCard = false;
}
else
{
activePlayer->SetBlock(2, true);
textButtons[1].GetText().setString(L"Wyrzuciłeś drugi dublet!\nTrafiasz do więzienia!");
}
}
else
{
if (firstRollDice == secondRollDice)
{
textButtons[1].GetText().setString(L"Wyrzuciłeś drugi dublet!\nWychodzisz z więzienia!");
activePlayer->GetPawn().SetArea(10);
if (activePlayer->GetPawn().move(firstRollDice + secondRollDice))
activePlayer->AddMoney(200);
activePlayer->SetBlock(0);
activePlayer->SetActiveField(true);
ShownCard = false;
}
}
activePlayer->SetDoublet(false);
activePlayer->SetActiveMovement(false);
return ShownCard;
}