mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Allow learning banned spell from Scholars (H3 logic)
This commit is contained in:
parent
ce480c8c84
commit
8f33fdcd83
@ -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
|
||||
|
@ -172,7 +172,7 @@ public:
|
||||
int getCurrentLuck(int stack=-1, bool town=false) const;
|
||||
int32_t getSpellCost(const spells::Spell * sp) const; //do not use during battles -> bonuses from army would be ignored
|
||||
|
||||
bool canLearnSpell(const spells::Spell * spell) const;
|
||||
bool canLearnSpell(const spells::Spell * spell, bool allowBanned = false) const;
|
||||
bool canCastThisSpell(const spells::Spell * spell) const; //determines if this hero can cast given spell; takes into account existing spell in spellbook, existing spellbook and artifact bonuses
|
||||
|
||||
/// convert given position between map position (CGObjectInstance::pos) and visitable position used for hero interactions
|
||||
|
@ -127,7 +127,7 @@ bool Rewardable::Limiter::heroAllowed(const CGHeroInstance * hero) const
|
||||
|
||||
for(const auto & spell : canLearnSpells)
|
||||
{
|
||||
if (!hero->canLearnSpell(spell.toSpell(VLC->spells())))
|
||||
if (!hero->canLearnSpell(spell.toSpell(VLC->spells()), true))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user