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

made scholar skill bonus-based

This commit is contained in:
Henning Koehler 2017-08-27 20:10:25 +12:00
parent 0153d0fc78
commit 8bdb8f01ca
3 changed files with 43 additions and 4 deletions

View File

@ -631,5 +631,40 @@
} }
] ]
} }
},
"scholar" : {
"basic" : {
"description" : "",
"effects" : [
{
"subtype" : "skill.scholar",
"type" : "SECONDARY_SKILL_PREMY",
"val" : 2,
"valueType" : "BASE_NUMBER"
}
]
},
"advanced" : {
"description" : "",
"effects" : [
{
"subtype" : "skill.scholar",
"type" : "SECONDARY_SKILL_PREMY",
"val" : 3,
"valueType" : "BASE_NUMBER"
}
]
},
"expert" : {
"description" : "",
"effects" : [
{
"subtype" : "skill.scholar",
"type" : "SECONDARY_SKILL_PREMY",
"val" : 4,
"valueType" : "BASE_NUMBER"
}
]
}
} }
} }

View File

@ -252,6 +252,8 @@ std::vector<std::shared_ptr<Bonus>> CSkillHandler::defaultBonus(SecondarySkill s
case SecondarySkill::WATER_MAGIC: case SecondarySkill::WATER_MAGIC:
case SecondarySkill::EARTH_MAGIC: case SecondarySkill::EARTH_MAGIC:
addBonus(level); break; addBonus(level); break;
case SecondarySkill::SCHOLAR:
addBonus(1 + level); break;
case SecondarySkill::TACTICS: case SecondarySkill::TACTICS:
addBonus(1 + 2 * level); break; addBonus(1 + 2 * level); break;
case SecondarySkill::LEARNING: case SecondarySkill::LEARNING:

View File

@ -2489,19 +2489,21 @@ void CGameHandler::useScholarSkill(ObjectInstanceID fromHero, ObjectInstanceID t
{ {
const CGHeroInstance * h1 = getHero(fromHero); const CGHeroInstance * h1 = getHero(fromHero);
const CGHeroInstance * h2 = getHero(toHero); const CGHeroInstance * h2 = getHero(toHero);
int h1_scholarLevel = h1->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::SCHOLAR);
int h2_scholarLevel = h1->valOfBonuses(Bonus::SECONDARY_SKILL_PREMY, SecondarySkill::SCHOLAR);
if (h1->getSecSkillLevel(SecondarySkill::SCHOLAR) < h2->getSecSkillLevel(SecondarySkill::SCHOLAR)) if (h1_scholarLevel < h2_scholarLevel)
{ {
std::swap (h1,h2);//1st hero need to have higher scholar level for correct message std::swap (h1,h2);//1st hero need to have higher scholar level for correct message
std::swap(fromHero, toHero); std::swap(fromHero, toHero);
} }
int ScholarLevel = h1->getSecSkillLevel(SecondarySkill::SCHOLAR);//heroes can trade up to this level int ScholarLevel = std::max(h1_scholarLevel, h2_scholarLevel);//heroes can trade up to this level
if (!ScholarLevel || !h1->hasSpellbook() || !h2->hasSpellbook()) if (!ScholarLevel || !h1->hasSpellbook() || !h2->hasSpellbook())
return;//no scholar skill or no spellbook return;//no scholar skill or no spellbook
int h1Lvl = std::min(ScholarLevel+1, h1->maxSpellLevel()), int h1Lvl = std::min(ScholarLevel, h1->maxSpellLevel()),
h2Lvl = std::min(ScholarLevel+1, h2->maxSpellLevel());//heroes can receive this levels h2Lvl = std::min(ScholarLevel, h2->maxSpellLevel());//heroes can receive this levels
ChangeSpells cs1; ChangeSpells cs1;
cs1.learn = true; cs1.learn = true;