1
0
mirror of https://github.com/vcmi/vcmi.git synced 2026-05-22 09:55:17 +02:00

vcmi: allow adding global bonuses

I will use it to implement some H3 base features like
mana regen and base movement.
This commit is contained in:
Konstantin
2023-02-19 21:42:51 +03:00
parent 9280d70819
commit 4acf3778ef
6 changed files with 37 additions and 0 deletions
+14
View File
@@ -311,6 +311,20 @@ void CGHeroInstance::initHero(CRandomGenerator & rand)
levelUpAutomatically(rand);
}
// load base hero bonuses, TODO: per-map loading of base hero bonuses
// must be done separately from global bonuses since recruitable heroes in taverns
// are not attached to global bonus node but need access to some global bonuses
// e.g. MANA_PER_KNOWLEDGE for correct preview and initial state after recruit for(const auto & ob : VLC->modh->heroBaseBonuses)
// or MOVEMENT to compute initial movement before recruiting is finished
for(const auto & ob : VLC->modh->heroBaseBonuses)
{
auto bonus = ob;
bonus->source = Bonus::HERO_BASE_SKILL;
bonus->sid = id.getNum();
bonus->duration = Bonus::PERMANENT;
addNewBonus(bonus);
}
if (VLC->modh->modules.COMMANDERS && !commander)
{
commander = new CCommanderInstance(type->heroClass->commander->idNumber);