1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fixed remaining bugs with converted objects

This commit is contained in:
Ivan Savenko 2023-01-22 18:37:26 +02:00
parent 695a94c3c8
commit fcb455b7f4
2 changed files with 25 additions and 9 deletions

View File

@ -180,6 +180,8 @@
"value" : 2000,
"rarity" : 500
},
"blockedVisitable" : true,
"visitMode" : "unlimited",
"selectMode" : "selectFirst",
"rewards" : [
@ -220,6 +222,8 @@
"value" : 2000,
"rarity" : 100
},
"blockedVisitable" : true,
"visitMode" : "unlimited",
"selectMode" : "selectFirst",
"rewards" : [
@ -275,6 +279,8 @@
"value" : 1500,
"rarity" : 500
},
"blockedVisitable" : true,
"visitMode" : "unlimited",
"selectMode" : "selectFirst",
"rewards" : [
@ -285,7 +291,7 @@
},
{
"appearChance" : { "min" : 20, "max" : 30 },
"message" : 117, //FIXME: this text contains placeholder for artifact name
"message" : 117,
"removeObject" : true,
"artifacts" : [
{ "class" : "TREASURE" }
@ -323,30 +329,32 @@
"value" : 1500,
"rarity" : 50
},
"blockedVisitable" : true,
"visitMode" : "unlimited",
"selectMode" : "selectFirst",
"rewards" : [
{
"appearChance" : { "max" : 55 },
"message" : 125, //FIXME: this text contains placeholder for artifact name
"message" : 125,
"removeObject" : true,
"artifacts" : [ { "class" : "TREASURE" } ]
},
{
"appearChance" : { "min" : 55, "max" : 75 },
"message" : 125, //FIXME: this text contains placeholder for artifact name
"message" : 125,
"removeObject" : true,
"artifacts" : [ { "class" : "MINOR" } ]
},
{
"appearChance" : { "min" : 75, "max" : 95 },
"message" : 125, //FIXME: this text contains placeholder for artifact name
"message" : 125,
"removeObject" : true,
"artifacts" : [ { "class" : "MAJOR" } ]
},
{
"appearChance" : { "min" : 95 },
"message" : 125, //FIXME: this text contains placeholder for artifact name
"message" : 125,
"removeObject" : true,
"artifacts" : [ { "class" : "RELIC" } ]
}
@ -371,6 +379,8 @@
"value" : 1500,
"rarity" : 1000
},
"blockedVisitable" : true,
"onSelectMessage" : 146,
"visitMode" : "unlimited",
"selectMode" : "selectPlayer",
@ -406,9 +416,8 @@
"removeObject" : true,
},
{
//TREASURE.WAV
"appearChance" : { "min" : 95 },
"message" : 145, //FIXME: this text contains placeholder for artifact name
"message" : 145,
"removeObject" : true,
"artifacts" : [ { "class" : "TREASURE" } ]
}

View File

@ -57,7 +57,7 @@ void CRandomRewardObjectInfo::configureObject(CRewardableObject * object, CRando
si32 diceID = static_cast<si32>(chance["dice"].Float());
if (thrownDice.count(diceID) == 0)
thrownDice[diceID] = rng.getIntRange(1, 100)();
thrownDice[diceID] = rng.getIntRange(0, 99)();
if (!chance["min"].isNull())
{
@ -68,7 +68,7 @@ void CRandomRewardObjectInfo::configureObject(CRewardableObject * object, CRando
if (!chance["max"].isNull())
{
int max = static_cast<int>(chance["max"].Float());
if (max < thrownDice[diceID])
if (max <= thrownDice[diceID])
continue;
}
}
@ -114,10 +114,17 @@ void CRandomRewardObjectInfo::configureObject(CRewardableObject * object, CRando
info.message = loadMessage(reward["message"]);
info.selectChance = JsonRandom::loadValue(reward["selectChance"], rng);
for (const auto & artifact : info.reward.artifacts )
info.message.addReplacement(MetaString::ART_NAMES, artifact.getNum());
for (const auto & artifact : info.reward.spells )
info.message.addReplacement(MetaString::SPELL_NAME, artifact.getNum());
object->info.push_back(info);
}
object->blockVisit= parameters["blockedVisitable"].Bool();
object->onSelect = loadMessage(parameters["onSelectMessage"]);
object->onVisited = loadMessage(parameters["onVisitedMessage"]);
object->onEmpty = loadMessage(parameters["onEmptyMessage"]);