1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-17 00:07:41 +02:00

Implemented "changeCreatures" option for Stables

This commit is contained in:
Ivan Savenko
2023-01-24 16:18:59 +02:00
parent ecbcafefbc
commit c9dcb921ab
5 changed files with 46 additions and 3 deletions

View File

@ -337,6 +337,24 @@ void CRewardableObject::grantRewardAfterLevelup(const CRewardVisitInfo & info, c
cb->changeSpells(hero, true, spellsToGive);
}
if(!info.reward.creaturesChange.empty())
{
for (auto slot : hero->Slots())
{
const CStackInstance * heroStack = slot.second;
for (auto & change : info.reward.creaturesChange)
{
if (heroStack->type->getId() == change.first)
{
StackLocation location(hero, slot.first);
cb->changeStackType(location, change.second.toCreature());
break;
}
}
}
}
if(!info.reward.creatures.empty())
{
CCreatureSet creatures;