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

Spell scrolls as a reward

This commit is contained in:
Ivan Savenko
2025-05-01 17:59:32 +03:00
parent 62e774c91e
commit 5dec3efa2f
5 changed files with 39 additions and 23 deletions

View File

@@ -114,6 +114,9 @@ void Rewardable::Reward::loadComponents(std::vector<Component> & comps, const CG
for(const auto & entry : grantedArtifacts)
comps.emplace_back(ComponentType::ARTIFACT, entry);
for(const SpellID & spell : scrolls)
comps.emplace_back(ComponentType::SPELL, spell);
for(const auto & entry : spells)
{
bool learnable = !h || h->canLearnSpell(entry.toEntity(LIBRARY), true);
@@ -142,6 +145,7 @@ void Rewardable::Reward::serializeJson(JsonSerializeFormat & handler)
handler.serializeInt("manaOverflowFactor", manaOverflowFactor);
handler.serializeInt("movePoints", movePoints);
handler.serializeIdArray("artifacts", grantedArtifacts);
handler.serializeIdArray("scrolls", scrolls);
handler.serializeIdArray("spells", spells);
handler.enterArray("creatures").serializeStruct(creatures);
handler.enterArray("primary").serializeArray(primary);