1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +02:00

vcmi: split bonus to enumerator and HeroBonus.h

This commit is contained in:
Konstantin
2023-05-01 01:20:01 +03:00
committed by Konstantin P
parent 9f5ee885b4
commit 05eccbc2bb
123 changed files with 1321 additions and 1350 deletions

View File

@@ -118,17 +118,17 @@ ArmyMovementUpdater::ArmyMovementUpdater(int base, int divider, int multiplier,
std::shared_ptr<Bonus> ArmyMovementUpdater::createUpdatedBonus(const std::shared_ptr<Bonus> & b, const CBonusSystemNode & context) const
{
if(b->type == Bonus::MOVEMENT && context.getNodeType() == CBonusSystemNode::HERO)
if(b->type == BonusType::MOVEMENT && context.getNodeType() == CBonusSystemNode::HERO)
{
auto speed = static_cast<const CGHeroInstance &>(context).getLowestCreatureSpeed();
si32 armySpeed = speed * base / divider;
auto counted = armySpeed * multiplier;
auto newBonus = std::make_shared<Bonus>(*b);
newBonus->source = Bonus::ARMY;
newBonus->source = BonusSource::ARMY;
newBonus->val += vstd::amin(counted, max);
return newBonus;
}
if(b->type != Bonus::MOVEMENT)
if(b->type != BonusType::MOVEMENT)
logGlobal->error("ArmyMovementUpdater should only be used for MOVEMENT bonus!");
return b;
}
@@ -203,7 +203,7 @@ std::shared_ptr<Bonus> OwnerUpdater::createUpdatedBonus(const std::shared_ptr<Bo
owner = PlayerColor::NEUTRAL;
std::shared_ptr<Bonus> updated =
std::make_shared<Bonus>(static_cast<Bonus::BonusDuration>(b->duration), b->type, b->source, b->val, b->sid, b->subtype, b->valType);
std::make_shared<Bonus>(b->duration, b->type, b->source, b->val, b->sid, b->subtype, b->valType);
updated->limiter = std::make_shared<OppositeSideLimiter>(owner);
return updated;
}