|
@@ -347,10 +347,10 @@ bool BattleFlowProcessor::tryMakeAutomaticAction(const CBattleInfoCallback & bat
|
|
int nextStackMorale = next->moraleVal();
|
|
int nextStackMorale = next->moraleVal();
|
|
if(!next->hadMorale && !next->waited() && nextStackMorale < 0)
|
|
if(!next->hadMorale && !next->waited() && nextStackMorale < 0)
|
|
{
|
|
{
|
|
- auto diceSize = gameHandler->getSettings().getVector(EGameSettings::COMBAT_BAD_MORALE_DICE);
|
|
|
|
- size_t diceIndex = std::min<size_t>(diceSize.size(), -nextStackMorale) - 1; // array index, so 0-indexed
|
|
|
|
|
|
+ auto diceVector = gameHandler->getSettings().getDiceVector(EGameSettings::COMBAT_BAD_MORALE_DICE);
|
|
|
|
+ size_t diceIndex = std::min<size_t>(diceVector.size(), -nextStackMorale) - 1; // array index, so 0-indexed
|
|
|
|
|
|
- if(diceSize.size() > 0 && gameHandler->getRandomGenerator().nextInt(1, diceSize[diceIndex]) == 1)
|
|
|
|
|
|
+ if(diceVector.size() > 0 && gameHandler->getRandomGenerator().nextInt(1, diceVector[diceIndex].second) <= diceVector[diceIndex].first)
|
|
{
|
|
{
|
|
//unit loses its turn - empty freeze action
|
|
//unit loses its turn - empty freeze action
|
|
BattleAction ba;
|
|
BattleAction ba;
|
|
@@ -526,10 +526,10 @@ bool BattleFlowProcessor::rollGoodMorale(const CBattleInfoCallback & battle, con
|
|
&& next->canMove()
|
|
&& next->canMove()
|
|
&& nextStackMorale > 0)
|
|
&& nextStackMorale > 0)
|
|
{
|
|
{
|
|
- auto diceSize = gameHandler->getSettings().getVector(EGameSettings::COMBAT_GOOD_MORALE_DICE);
|
|
|
|
- size_t diceIndex = std::min<size_t>(diceSize.size(), nextStackMorale) - 1; // array index, so 0-indexed
|
|
|
|
|
|
+ auto diceVector = gameHandler->getSettings().getDiceVector(EGameSettings::COMBAT_GOOD_MORALE_DICE);
|
|
|
|
+ size_t diceIndex = std::min<size_t>(diceVector.size(), nextStackMorale) - 1; // array index, so 0-indexed
|
|
|
|
|
|
- if(diceSize.size() > 0 && gameHandler->getRandomGenerator().nextInt(1, diceSize[diceIndex]) == 1)
|
|
|
|
|
|
+ if(diceVector.size() > 0 && gameHandler->getRandomGenerator().nextInt(1, diceVector[diceIndex].second) <= diceVector[diceIndex].first)
|
|
{
|
|
{
|
|
BattleTriggerEffect bte;
|
|
BattleTriggerEffect bte;
|
|
bte.battleID = battle.getBattle()->getBattleID();
|
|
bte.battleID = battle.getBattle()->getBattleID();
|