1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Extend rewards & limiters functionality

This commit is contained in:
Ivan Savenko
2025-05-06 16:00:21 +03:00
parent 0212b6e37d
commit f1d9d8479f
10 changed files with 117 additions and 31 deletions

View File

@@ -194,9 +194,16 @@ void Rewardable::Interface::grantRewardAfterLevelup(const Rewardable::VisitInfo
// TODO: handle locked slots?
}
for(const SpellID & spell : info.reward.scrolls)
for(const SpellID & spell : info.reward.grantedScrolls)
cb->giveHeroNewScroll(hero, spell, ArtifactPosition::FIRST_AVAILABLE);
for(const SpellID & spell : info.reward.takenScrolls)
{
if(hero->hasScroll(spell, false))
cb->removeArtifact(ArtifactLocation(hero->id, hero->getScrollPos(spell, false)));
}
if(!info.reward.spells.empty())
{
std::set<SpellID> spellsToGive;
@@ -209,6 +216,11 @@ void Rewardable::Interface::grantRewardAfterLevelup(const Rewardable::VisitInfo
cb->changeSpells(hero, true, spellsToGive);
}
if (!info.reward.takenCreatures.empty())
{
cb->takeCreatures(hero->id, info.reward.takenCreatures);
}
if(!info.reward.creaturesChange.empty())
{
for(const auto & slot : hero->Slots())