1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

wisdom is now bonus-based

This commit is contained in:
Henning Koehler 2017-08-26 20:49:29 +12:00
parent 1fa6cbe514
commit 19e619f61e
6 changed files with 147 additions and 7 deletions

View File

@ -136,6 +136,140 @@
]
}
},
"diplomacy" : {
"basic" : {
"description" : "",
"effects" : [
{
"type" : "SURRENDER_DISCOUNT",
"val" : 20,
"valueType" : "BASE_NUMBER"
}
]
},
"advanced" : {
"description" : "",
"effects" : [
{
"type" : "SURRENDER_DISCOUNT",
"val" : 40,
"valueType" : "BASE_NUMBER"
}
]
},
"expert" : {
"description" : "",
"effects" : [
{
"type" : "SURRENDER_DISCOUNT",
"val" : 60,
"valueType" : "BASE_NUMBER"
}
]
}
},
"navigation" : {
"basic" : {
"description" : "",
"effects" : [
{
"subtype" : "skill.navigation",
"type" : "SECONDARY_SKILL_PREMY",
"val" : 50,
"valueType" : "BASE_NUMBER"
}
]
},
"advanced" : {
"description" : "",
"effects" : [
{
"subtype" : "skill.navigation",
"type" : "SECONDARY_SKILL_PREMY",
"val" : 100,
"valueType" : "BASE_NUMBER"
}
]
},
"expert" : {
"description" : "",
"effects" : [
{
"subtype" : "skill.navigation",
"type" : "SECONDARY_SKILL_PREMY",
"val" : 150,
"valueType" : "BASE_NUMBER"
}
]
}
},
"leadership" : {
"basic" : {
"description" : "",
"effects" : [
{
"type" : "MORALE",
"val" : 1,
"valueType" : "BASE_NUMBER"
}
]
},
"advanced" : {
"description" : "",
"effects" : [
{
"type" : "MORALE",
"val" : 2,
"valueType" : "BASE_NUMBER"
}
]
},
"expert" : {
"description" : "",
"effects" : [
{
"type" : "MORALE",
"val" : 3,
"valueType" : "BASE_NUMBER"
}
]
}
},
"wisdom" : {
"basic" : {
"description" : "",
"effects" : [
{
"subtype" : "skill.wisdom",
"type" : "SECONDARY_SKILL_PREMY",
"val" : 1,
"valueType" : "BASE_NUMBER"
}
]
},
"advanced" : {
"description" : "",
"effects" : [
{
"subtype" : "skill.wisdom",
"type" : "SECONDARY_SKILL_PREMY",
"val" : 2,
"valueType" : "BASE_NUMBER"
}
]
},
"expert" : {
"description" : "",
"effects" : [
{
"subtype" : "skill.wisdom",
"type" : "SECONDARY_SKILL_PREMY",
"val" : 3,
"valueType" : "BASE_NUMBER"
}
]
}
},
"estates" : {
"basic" : {
"description" : "",

View File

@ -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))
{

View File

@ -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);

View File

@ -146,6 +146,7 @@ public:
//////////////////////////////////////////////////////////////////////////
bool hasSpellbook() const;
int maxSpellLevel() const;
EAlignment::EAlignment getAlignment() const;
const std::string &getBiography() const;
bool needsLastStack()const override;

View File

@ -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);
}

View File

@ -1974,7 +1974,7 @@ void CGameHandler::giveSpells(const CGTownInstance *t, const CGHeroInstance *h)
if (t->hasBuilt(BuildingID::GRAIL, ETownType::CONFLUX) && t->hasBuilt(BuildingID::MAGES_GUILD_1))
{
// Aurora Borealis give spells of all levels even if only level 1 mages guild built
for (int i = 0; i < h->getSecSkillLevel(SecondarySkill::WISDOM)+2; i++)
for (int i = 0; i < h->maxSpellLevel(); i++)
{
std::vector<SpellID> spells;
getAllowedSpells(spells, i+1);
@ -1984,7 +1984,7 @@ void CGameHandler::giveSpells(const CGTownInstance *t, const CGHeroInstance *h)
}
else
{
for (int i = 0; i < std::min(t->mageGuildLevel(), h->getSecSkillLevel(SecondarySkill::WISDOM)+2); i++)
for (int i = 0; i < std::min(t->mageGuildLevel(), h->maxSpellLevel()); i++)
{
for (int j = 0; j < t->spellsAtLevel(i+1, true) && j < t->spells.at(i).size(); j++)
{
@ -2501,8 +2501,8 @@ void CGameHandler::useScholarSkill(ObjectInstanceID fromHero, ObjectInstanceID t
if (!ScholarLevel || !h1->hasSpellbook() || !h2->hasSpellbook())
return;//no scholar skill or no spellbook
int h1Lvl = std::min(ScholarLevel+1, h1->getSecSkillLevel(SecondarySkill::WISDOM)+2),
h2Lvl = std::min(ScholarLevel+1, h2->getSecSkillLevel(SecondarySkill::WISDOM)+2);//heroes can receive this levels
int h1Lvl = std::min(ScholarLevel+1, h1->maxSpellLevel()),
h2Lvl = std::min(ScholarLevel+1, h2->maxSpellLevel());//heroes can receive this levels
ChangeSpells cs1;
cs1.learn = true;