1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fixed Scholar handling

This commit is contained in:
Ivan Savenko
2023-10-18 17:14:22 +03:00
parent 48eba6c362
commit ce480c8c84
5 changed files with 87 additions and 29 deletions

View File

@@ -268,7 +268,12 @@ void Rewardable::Info::configureRewards(
if (!diceValue.has_value())
{
object.initVariable("dice", diceID, rng.getIntRange(0, 99)());
const JsonNode & preset = object.getPresetVariable("dice", diceID);
if (preset.isNull())
object.initVariable("dice", diceID, rng.getIntRange(0, 99)());
else
object.initVariable("dice", diceID, preset.Integer());
diceValue = object.getVariable("dice", diceID);
}
assert(diceValue.has_value());