mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix commander ability accumulation, change commander ability bonus
This commit is contained in:
parent
20ede710c2
commit
9e9849b741
@ -82,6 +82,13 @@ namespace Selector
|
||||
return CSelectFieldEqual<BonusValueType>(&Bonus::valType)(valType);
|
||||
}
|
||||
|
||||
CSelector DLL_LINKAGE typeSubtypeValueType(BonusType Type, BonusSubtypeID Subtype, BonusValueType valType)
|
||||
{
|
||||
return type()(Type)
|
||||
.And(subtype()(Subtype))
|
||||
.And(valueType(valType));
|
||||
}
|
||||
|
||||
DLL_LINKAGE CSelector all([](const Bonus * b){return true;});
|
||||
DLL_LINKAGE CSelector none([](const Bonus * b){return false;});
|
||||
}
|
||||
|
@ -139,6 +139,7 @@ namespace Selector
|
||||
CSelector DLL_LINKAGE source(BonusSource source, BonusSourceID sourceID);
|
||||
CSelector DLL_LINKAGE sourceTypeSel(BonusSource source);
|
||||
CSelector DLL_LINKAGE valueType(BonusValueType valType);
|
||||
CSelector DLL_LINKAGE typeSubtypeValueType(BonusType Type, BonusSubtypeID Subtype, BonusValueType valType);
|
||||
|
||||
/**
|
||||
* Selects all bonuses
|
||||
|
@ -356,7 +356,7 @@ void CBonusSystemNode::addNewBonus(const std::shared_ptr<Bonus>& b)
|
||||
|
||||
void CBonusSystemNode::accumulateBonus(const std::shared_ptr<Bonus>& b)
|
||||
{
|
||||
auto bonus = exportedBonuses.getFirst(Selector::typeSubtype(b->type, b->subtype)); //only local bonuses are interesting //TODO: what about value type?
|
||||
auto bonus = exportedBonuses.getFirst(Selector::typeSubtypeValueType(b->type, b->subtype, b->valType)); //only local bonuses are interesting
|
||||
if(bonus)
|
||||
bonus->val += b->val;
|
||||
else
|
||||
|
@ -253,11 +253,11 @@ void CGameHandler::levelUpCommander (const CCommanderInstance * c, int skill)
|
||||
break;
|
||||
case ECommander::HEALTH:
|
||||
scp.accumulatedBonus.type = BonusType::STACK_HEALTH;
|
||||
scp.accumulatedBonus.valType = BonusValueType::PERCENT_TO_BASE;
|
||||
scp.accumulatedBonus.valType = BonusValueType::PERCENT_TO_ALL;
|
||||
break;
|
||||
case ECommander::DAMAGE:
|
||||
scp.accumulatedBonus.type = BonusType::CREATURE_DAMAGE;
|
||||
scp.accumulatedBonus.valType = BonusValueType::PERCENT_TO_BASE;
|
||||
scp.accumulatedBonus.valType = BonusValueType::PERCENT_TO_ALL;
|
||||
break;
|
||||
case ECommander::SPEED:
|
||||
scp.accumulatedBonus.type = BonusType::STACKS_SPEED;
|
||||
|
Loading…
Reference in New Issue
Block a user