mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fixes #1096 - do not propose banned skills on levelup
Remove possibility to get banned skill on levelup as "obligatory skill" if all other such skills have been learned before. May happen under some conditions, e.g. if hero quickly learns other magic schools - in witch hut/university, leading to case where banned skill is the only obligatory skill that can be offered on levelup
This commit is contained in:
@@ -1117,7 +1117,9 @@ std::vector<SecondarySkill> CGHeroInstance::getLevelUpProposedSecondarySkills()
|
|||||||
std::vector<SecondarySkill> obligatorySkills; //hero is offered magic school or wisdom if possible
|
std::vector<SecondarySkill> obligatorySkills; //hero is offered magic school or wisdom if possible
|
||||||
if (!skillsInfo.wisdomCounter)
|
if (!skillsInfo.wisdomCounter)
|
||||||
{
|
{
|
||||||
if (cb->isAllowed(2, SecondarySkill::WISDOM) && !getSecSkillLevel(SecondarySkill::WISDOM))
|
if (cb->isAllowed(2, SecondarySkill::WISDOM) &&
|
||||||
|
!getSecSkillLevel(SecondarySkill::WISDOM) &&
|
||||||
|
type->heroClass->secSkillProbability[SecondarySkill::WISDOM] > 0)
|
||||||
obligatorySkills.push_back(SecondarySkill::WISDOM);
|
obligatorySkills.push_back(SecondarySkill::WISDOM);
|
||||||
}
|
}
|
||||||
if (!skillsInfo.magicSchoolCounter)
|
if (!skillsInfo.magicSchoolCounter)
|
||||||
@@ -1131,7 +1133,7 @@ std::vector<SecondarySkill> CGHeroInstance::getLevelUpProposedSecondarySkills()
|
|||||||
|
|
||||||
for (auto skill : ss)
|
for (auto skill : ss)
|
||||||
{
|
{
|
||||||
if (cb->isAllowed(2, skill) && !getSecSkillLevel(skill)) //only schools hero doesn't know yet
|
if (cb->isAllowed(2, skill) && !getSecSkillLevel(skill) && type->heroClass->secSkillProbability[skill] > 0) //only schools hero doesn't know yet
|
||||||
{
|
{
|
||||||
obligatorySkills.push_back(skill);
|
obligatorySkills.push_back(skill);
|
||||||
break; //only one
|
break; //only one
|
||||||
@@ -1143,7 +1145,7 @@ std::vector<SecondarySkill> CGHeroInstance::getLevelUpProposedSecondarySkills()
|
|||||||
//picking sec. skills for choice
|
//picking sec. skills for choice
|
||||||
std::set<SecondarySkill> basicAndAdv, expert, none;
|
std::set<SecondarySkill> basicAndAdv, expert, none;
|
||||||
for(int i = 0; i < VLC->skillh->size(); i++)
|
for(int i = 0; i < VLC->skillh->size(); i++)
|
||||||
if (cb->isAllowed(2,i))
|
if (cb->isAllowed(2,i) && type->heroClass->secSkillProbability[i] > 0)
|
||||||
none.insert(SecondarySkill(i));
|
none.insert(SecondarySkill(i));
|
||||||
|
|
||||||
for(auto & elem : secSkills)
|
for(auto & elem : secSkills)
|
||||||
|
Reference in New Issue
Block a user