|
@@ -2762,21 +2762,21 @@ void CGameHandler::useScholarSkill(ObjectInstanceID fromHero, ObjectInstanceID t
|
|
|
{
|
|
{
|
|
|
const CGHeroInstance * h1 = getHero(fromHero);
|
|
const CGHeroInstance * h1 = getHero(fromHero);
|
|
|
const CGHeroInstance * h2 = getHero(toHero);
|
|
const CGHeroInstance * h2 = getHero(toHero);
|
|
|
- int h1_scholarLevel = h1->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::SCHOLAR);
|
|
|
|
|
- int h2_scholarLevel = h2->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::SCHOLAR);
|
|
|
|
|
|
|
+ int h1_scholarSpellLevel = h1->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::SCHOLAR);
|
|
|
|
|
+ int h2_scholarSpellLevel = h2->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::SCHOLAR);
|
|
|
|
|
|
|
|
- if (h1_scholarLevel < h2_scholarLevel)
|
|
|
|
|
|
|
+ if (h1_scholarSpellLevel < h2_scholarSpellLevel)
|
|
|
{
|
|
{
|
|
|
std::swap (h1,h2);//1st hero need to have higher scholar level for correct message
|
|
std::swap (h1,h2);//1st hero need to have higher scholar level for correct message
|
|
|
std::swap(fromHero, toHero);
|
|
std::swap(fromHero, toHero);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- int ScholarLevel = std::max(h1_scholarLevel, h2_scholarLevel);//heroes can trade up to this level
|
|
|
|
|
- if (!ScholarLevel || !h1->hasSpellbook() || !h2->hasSpellbook())
|
|
|
|
|
|
|
+ int ScholarSpellLevel = std::max(h1_scholarSpellLevel, h2_scholarSpellLevel);//heroes can trade up to this level
|
|
|
|
|
+ if (!ScholarSpellLevel || !h1->hasSpellbook() || !h2->hasSpellbook())
|
|
|
return;//no scholar skill or no spellbook
|
|
return;//no scholar skill or no spellbook
|
|
|
|
|
|
|
|
- int h1Lvl = std::min(ScholarLevel, h1->maxSpellLevel()),
|
|
|
|
|
- h2Lvl = std::min(ScholarLevel, h2->maxSpellLevel());//heroes can receive this levels
|
|
|
|
|
|
|
+ int h1Lvl = std::min(ScholarSpellLevel, h1->maxSpellLevel()),
|
|
|
|
|
+ h2Lvl = std::min(ScholarSpellLevel, h2->maxSpellLevel());//heroes can receive this levels
|
|
|
|
|
|
|
|
ChangeSpells cs1;
|
|
ChangeSpells cs1;
|
|
|
cs1.learn = true;
|
|
cs1.learn = true;
|
|
@@ -2795,9 +2795,11 @@ void CGameHandler::useScholarSkill(ObjectInstanceID fromHero, ObjectInstanceID t
|
|
|
|
|
|
|
|
if (!cs1.spells.empty() || !cs2.spells.empty())//create a message
|
|
if (!cs1.spells.empty() || !cs2.spells.empty())//create a message
|
|
|
{
|
|
{
|
|
|
|
|
+ int ScholarSkillLevel = std::max(h1->getSecSkillLevel(SecondarySkill::SCHOLAR),
|
|
|
|
|
+ h2->getSecSkillLevel(SecondarySkill::SCHOLAR));
|
|
|
InfoWindow iw;
|
|
InfoWindow iw;
|
|
|
iw.player = h1->tempOwner;
|
|
iw.player = h1->tempOwner;
|
|
|
- iw.components.push_back(Component(Component::SEC_SKILL, 18, ScholarLevel, 0));
|
|
|
|
|
|
|
+ iw.components.push_back(Component(Component::SEC_SKILL, 18, ScholarSkillLevel, 0));
|
|
|
|
|
|
|
|
iw.text.addTxt(MetaString::GENERAL_TXT, 139);//"%s, who has studied magic extensively,
|
|
iw.text.addTxt(MetaString::GENERAL_TXT, 139);//"%s, who has studied magic extensively,
|
|
|
iw.text.addReplacement(h1->name);
|
|
iw.text.addReplacement(h1->name);
|