|
|
@@ -65,7 +65,7 @@ void CGPandoraBox::giveContentsUpToExp(const CGHeroInstance *h) const
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
std::vector<std::pair<SecondarySkill, ui8>> unpossessedAbilities; //ability + ability level
|
|
|
int abilitiesRequiringSlot = 0;
|
|
|
|
|
|
@@ -90,17 +90,17 @@ void CGPandoraBox::giveContentsUpToExp(const CGHeroInstance *h) const
|
|
|
//getText(iw,afterBattle,175,h); //wtf?
|
|
|
iw.text.addTxt(MetaString::ADVOB_TXT, 175); //%s learns something
|
|
|
iw.text.addReplacement(h->name);
|
|
|
-
|
|
|
+
|
|
|
if(expVal)
|
|
|
iw.components.push_back(Component(Component::EXPERIENCE,0,expVal,0));
|
|
|
-
|
|
|
+
|
|
|
for(int i=0; i<primskills.size(); i++)
|
|
|
if(primskills[i])
|
|
|
iw.components.push_back(Component(Component::PRIM_SKILL,i,primskills[i],0));
|
|
|
|
|
|
for(auto abilityData : unpossessedAbilities)
|
|
|
iw.components.push_back(Component(Component::SEC_SKILL, abilityData.first, abilityData.second, 0));
|
|
|
-
|
|
|
+
|
|
|
cb->showInfoDialog(&iw);
|
|
|
|
|
|
//give sec skills
|
|
|
@@ -138,9 +138,8 @@ void CGPandoraBox::giveContentsAfterExp(const CGHeroInstance *h) const
|
|
|
//TODO: reuse this code for Scholar skill
|
|
|
if(spells.size())
|
|
|
{
|
|
|
- std::set<SpellID> spellsToGive;
|
|
|
+ std::set<SpellID> spellsToGive;
|
|
|
|
|
|
- std::vector<ConstTransitivePtr<CSpell> > * sp = &VLC->spellh->objects;
|
|
|
auto i = spells.cbegin();
|
|
|
while (i != spells.cend())
|
|
|
{
|
|
|
@@ -150,12 +149,13 @@ void CGPandoraBox::giveContentsAfterExp(const CGHeroInstance *h) const
|
|
|
|
|
|
for (; i != spells.cend(); i++)
|
|
|
{
|
|
|
- if ((*sp)[*i]->level <= h->getSecSkillLevel(SecondarySkill::WISDOM) + 2) //enough wisdom
|
|
|
+ const CSpell * sp = (*i).toSpell();
|
|
|
+ if(h->canLearnSpell(sp))
|
|
|
{
|
|
|
iw.components.push_back(Component(Component::SPELL, *i, 0, 0));
|
|
|
spellsToGive.insert(*i);
|
|
|
}
|
|
|
- if (spellsToGive.size() == 8) //display up to 8 spells at once
|
|
|
+ if(spellsToGive.size() == 8) //display up to 8 spells at once
|
|
|
{
|
|
|
break;
|
|
|
}
|