1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Allow learning banned spell from Scholars (H3 logic)

This commit is contained in:
Ivan Savenko
2023-10-18 17:38:40 +03:00
parent ce480c8c84
commit 8f33fdcd83
3 changed files with 4 additions and 4 deletions

View File

@ -770,7 +770,7 @@ bool CGHeroInstance::canCastThisSpell(const spells::Spell * spell) const
}
}
bool CGHeroInstance::canLearnSpell(const spells::Spell * spell) const
bool CGHeroInstance::canLearnSpell(const spells::Spell * spell, bool allowBanned) const
{
if(!hasSpellbook())
return false;
@ -793,7 +793,7 @@ bool CGHeroInstance::canLearnSpell(const spells::Spell * spell) const
return false;//creature abilities can not be learned
}
if(!IObjectInterface::cb->isAllowed(0, spell->getIndex()))
if(!allowBanned && !IObjectInterface::cb->isAllowed(0, spell->getIndex()))
{
logGlobal->warn("Hero %s try to learn banned spell %s", nodeName(), spell->getNameTranslated());
return false;//banned spells should not be learned