1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-15 01:24:45 +02:00

added basics for Bonus updater

This commit is contained in:
Henning Koehler
2017-09-09 17:43:53 +12:00
parent 3795985de9
commit 67330efa4a
2 changed files with 54 additions and 0 deletions

View File

@ -1543,3 +1543,20 @@ void LimiterList::add( TLimiterPtr limiter )
{
limiters.push_back(limiter);
}
void ScalingUpdater::update(BonusUpdateContext & context)
{
if(context.node.getNodeType() == CBonusSystemNode::HERO)
{
int level = static_cast<const CGHeroInstance &>(context.node).level;
int steps = stepSize ? level / stepSize : level;
//rounding follows format for HMM3 creature specialty bonus
context.b->val = (valPer20 * steps + 19) / 20;
}
}
std::shared_ptr<Bonus> Bonus::addUpdater(TUpdaterPtr Updater)
{
updater = Updater;
return this->shared_from_this();
}