1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Fix generation of placeholders for banks

This commit is contained in:
Ivan Savenko
2024-09-11 10:42:44 +00:00
parent ca13fe04df
commit d20d9bd96b
5 changed files with 93 additions and 52 deletions

View File

@@ -57,6 +57,7 @@
"config/objects/magicWell.json",
"config/objects/moddables.json",
"config/objects/observatory.json",
"config/objects/pyramid.json",
"config/objects/rewardableBonusing.json",
"config/objects/rewardableOncePerHero.json",
"config/objects/rewardableOncePerWeek.json",

View File

@@ -973,48 +973,5 @@
]
}
}
},
"pyramid" : {
"index" :63,
"handler" : "configurable",
"base" : {
"sounds" : {
"visit" : ["MYSTERY"]
}
},
"types" : {
"pyramid" : {
"index" : 0,
"name" : "Pyramid",
"aiValue" : 8000,
"rmg" : {
"value" : 5000,
"rarity" : 20
},
"onGuardedMessage" : 105,
"visitMode" : "once",
"selectMode" : "selectFirst",
"onVisited" : [
{
"message" : 107,
"bonuses" : [ { "type" : "LUCK", "val" : -2, "duration" : "ONE_BATTLE", "description" : 70 } ]
}
],
"guardsLayout" : "default",
"rewards" : [
{
"message" : 106,
"guards" : [
{ "amount" : 40, "type" : "goldGolem" },
{ "amount" : 10, "type" : "diamondGolem" },
{ "amount" : 10, "type" : "diamondGolem" }
],
"spells" : [ { "level" : 5 } ]
}
]
}
}
}
}

View File

@@ -0,0 +1,76 @@
{
"pyramid" : {
"index" :63,
"handler" : "configurable",
"base" : {
"sounds" : {
"visit" : ["MYSTERY"]
}
},
"types" : {
"pyramid" : {
"index" : 0,
"name" : "Pyramid",
"aiValue" : 8000,
"rmg" : {
"value" : 5000,
"rarity" : 20
},
"variables" : {
"spell" : {
"gainedSpell" : {
"level": 5
}
}
},
"onGuardedMessage" : 105,
"visitMode" : "once",
"selectMode" : "selectFirst",
"onVisited" : [
{
"message" : 107,
"bonuses" : [ { "type" : "LUCK", "val" : -2, "duration" : "ONE_BATTLE", "description" : 70 } ]
}
],
"guardsLayout" : "default",
"rewards" : [
{
"limiter" : {
"canLearnSpells" : [
"@gainedSpell"
]
},
"spells" : [
"@gainedSpell"
],
"message" : [ 106, "%s." ] // Upon defeating monsters, you learn new spell
"guards" : [
{ "amount" : 40, "type" : "goldGolem" },
{ "amount" : 10, "type" : "diamondGolem" },
{ "amount" : 10, "type" : "diamondGolem" }
]
}
],
"onEmpty" : [
{
"limiter" : {
"artifacts" : [
{
"type" : "spellBook"
}
]
},
"message" : [ 106, "%s.", 108 ] // No Wisdom
},
{
"message" : [ 106, "%s.", 109 ] // No spellbook
}
]
}
}
}
}

View File

@@ -59,16 +59,16 @@ BattleLayout BattleLayout::createLayout(IGameCallback * cb, const std::string &
result.warMachines[BattleSide::DEFENDER][i] = loadHex(config["attackerWarMachines"][i]);
if (attacker->formation == EArmyFormation::LOOSE && !config["attackerUnitsLoose"].isNull())
result.units[BattleSide::ATTACKER] = loadUnits(config["attackerUnitsLoose"][attacker->stacksCount()]);
result.units[BattleSide::ATTACKER] = loadUnits(config["attackerUnitsLoose"][attacker->stacksCount() - 1]);
else if (attacker->formation == EArmyFormation::TIGHT && !config["attackerUnitsTight"].isNull())
result.units[BattleSide::ATTACKER] = loadUnits(config["attackerUnitsTight"][attacker->stacksCount()]);
result.units[BattleSide::ATTACKER] = loadUnits(config["attackerUnitsTight"][attacker->stacksCount() - 1]);
else
result.units[BattleSide::ATTACKER] = loadUnits(config["attackerUnits"]);
if (attacker->formation == EArmyFormation::LOOSE && !config["defenderUnitsLoose"].isNull())
result.units[BattleSide::DEFENDER] = loadUnits(config["defenderUnitsLoose"][attacker->stacksCount()]);
result.units[BattleSide::DEFENDER] = loadUnits(config["defenderUnitsLoose"][attacker->stacksCount() - 1]);
else if (attacker->formation == EArmyFormation::TIGHT && !config["defenderUnitsTight"].isNull())
result.units[BattleSide::DEFENDER] = loadUnits(config["defenderUnitsTight"][attacker->stacksCount()]);
result.units[BattleSide::DEFENDER] = loadUnits(config["defenderUnitsTight"][attacker->stacksCount() - 1]);
else
result.units[BattleSide::DEFENDER] = loadUnits(config["defenderUnits"]);

View File

@@ -268,6 +268,8 @@ void Rewardable::Info::replaceTextPlaceholders(MetaString & target, const Variab
{
if (!info.reward.guards.empty())
{
replaceTextPlaceholders(target, variables);
CreatureID strongest = info.reward.guards.at(0).getId();
for (const auto & guard : info.reward.guards )
@@ -297,15 +299,20 @@ void Rewardable::Info::replaceTextPlaceholders(MetaString & target, const Variab
for (const auto & spell : info.reward.spells )
{
target.replaceName(spell);
loot.appendRawString("%s");
loot.replaceName(spell);
}
for (const auto & secondary : info.reward.secondary )
target.replaceName(secondary.first);
{
loot.appendRawString("%s");
loot.replaceName(secondary.first);
}
target.replaceRawString(loot.buildList());
}
else
{
for (const auto & artifact : info.reward.artifacts )
target.replaceName(artifact);
@@ -314,9 +321,9 @@ void Rewardable::Info::replaceTextPlaceholders(MetaString & target, const Variab
for (const auto & secondary : info.reward.secondary )
target.replaceName(secondary.first);
}
replaceTextPlaceholders(target, variables);
replaceTextPlaceholders(target, variables);
}
}
void Rewardable::Info::configureRewards(