mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
wisdom is now bonus-based
This commit is contained in:
@@ -266,7 +266,7 @@ void CBank::doVisit(const CGHeroInstance * hero) const
|
||||
{
|
||||
const CSpell * spell = spellId.toSpell();
|
||||
iw.text.addTxt (MetaString::SPELL_NAME, spellId);
|
||||
if(spell->level <= hero->getSecSkillLevel(SecondarySkill::WISDOM) + 2)
|
||||
if(spell->level <= hero->maxSpellLevel())
|
||||
{
|
||||
if(hero->canLearnSpell(spell))
|
||||
{
|
||||
|
||||
@@ -957,7 +957,7 @@ bool CGHeroInstance::canLearnSpell(const CSpell * spell) const
|
||||
if(!hasSpellbook())
|
||||
return false;
|
||||
|
||||
if(spell->level > getSecSkillLevel(SecondarySkill::WISDOM) + 2) //not enough wisdom
|
||||
if(spell->level > maxSpellLevel()) //not enough wisdom
|
||||
return false;
|
||||
|
||||
if(vstd::contains(spells, spell->id))//already known
|
||||
@@ -1175,6 +1175,11 @@ bool CGHeroInstance::hasSpellbook() const
|
||||
return getArt(ArtifactPosition::SPELLBOOK);
|
||||
}
|
||||
|
||||
int CGHeroInstance::maxSpellLevel() const
|
||||
{
|
||||
return std::min(GameConstants::SPELL_LEVELS, 2 + valOfBonuses(Selector::typeSubtype(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::WISDOM)));
|
||||
}
|
||||
|
||||
void CGHeroInstance::deserializationFix()
|
||||
{
|
||||
artDeserializationFix(this);
|
||||
|
||||
@@ -146,6 +146,7 @@ public:
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool hasSpellbook() const;
|
||||
int maxSpellLevel() const;
|
||||
EAlignment::EAlignment getAlignment() const;
|
||||
const std::string &getBiography() const;
|
||||
bool needsLastStack()const override;
|
||||
|
||||
@@ -1601,7 +1601,7 @@ void CGShrine::onHeroVisit( const CGHeroInstance * h ) const
|
||||
{
|
||||
iw.text.addTxt(MetaString::ADVOB_TXT,174);
|
||||
}
|
||||
else if(ID == Obj::SHRINE_OF_MAGIC_THOUGHT && !h->getSecSkillLevel(SecondarySkill::WISDOM)) //it's third level spell and hero doesn't have wisdom
|
||||
else if(ID == Obj::SHRINE_OF_MAGIC_THOUGHT && h->maxSpellLevel() < 3) //it's third level spell and hero doesn't have wisdom
|
||||
{
|
||||
iw.text.addTxt(MetaString::ADVOB_TXT,130);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user