mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Fixed secondary skill specialties
This commit is contained in:
parent
4015d3d8bd
commit
33b5bfbbd2
@ -977,12 +977,21 @@ void CBonusSystemNode::getAllBonusesRec(BonusList &out) const
|
||||
|
||||
for(const auto & b : beforeUpdate)
|
||||
{
|
||||
auto updated = b->updater
|
||||
? getUpdatedBonus(b, b->updater)
|
||||
auto updated = b->updater
|
||||
? getUpdatedBonus(b, b->updater)
|
||||
: b;
|
||||
|
||||
//do not add bonus with same pointer
|
||||
if(!vstd::contains(out, updated))
|
||||
//do not add bonus with updater
|
||||
bool bonusExists = false;
|
||||
for (auto const & bonus : out )
|
||||
{
|
||||
if (bonus == updated)
|
||||
bonusExists = true;
|
||||
if (bonus->updater && bonus->updater == updated->updater)
|
||||
bonusExists = true;
|
||||
}
|
||||
|
||||
if (!bonusExists)
|
||||
out.push_back(updated);
|
||||
}
|
||||
}
|
||||
@ -1971,13 +1980,13 @@ JsonNode ILimiter::toJsonNode() const
|
||||
|
||||
int CCreatureTypeLimiter::limit(const BonusLimitationContext &context) const
|
||||
{
|
||||
const CCreature *c = retrieveCreature(&context.node);
|
||||
if(!c)
|
||||
return true;
|
||||
return c->getId() != creature->getId() && (!includeUpgrades || !creature->isMyUpgrade(c));
|
||||
//drop bonus if it's not our creature and (we don`t check upgrades or its not our upgrade)
|
||||
}
|
||||
|
||||
const CCreature *c = retrieveCreature(&context.node);
|
||||
if(!c)
|
||||
return true;
|
||||
return c->getId() != creature->getId() && (!includeUpgrades || !creature->isMyUpgrade(c));
|
||||
//drop bonus if it's not our creature and (we don`t check upgrades or its not our upgrade)
|
||||
}
|
||||
|
||||
CCreatureTypeLimiter::CCreatureTypeLimiter(const CCreature & creature_, bool IncludeUpgrades)
|
||||
: creature(&creature_), includeUpgrades(IncludeUpgrades)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user