1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Fix handling of creature-specific limiters in noneOf limiter on hero

For example, if hero has specialty that provides primary skill bonuses
with "noneOf" limiter that contains limiter that can only be evaluated
in creature context (such as creature level or native terrain), limiter
itself would evaluate to DISCARD, and then will be inverted to ACCEPT by
noneOf limiter. As result, this would give hero bonus to primary skill
even though it is clearly intended to only target creatures.

This introduces NOT_APPLICABLE limiter decision that is not inverted by
noneOf limiter
This commit is contained in:
Ivan Savenko
2025-04-13 23:31:37 +03:00
parent 83099f9288
commit 1cb5f36ccb
3 changed files with 25 additions and 10 deletions

View File

@@ -595,7 +595,7 @@ void CBonusSystemNode::limitBonuses(const BonusList &allBonuses, BonusList &out)
auto b = undecided[i];
BonusLimitationContext context = {*b, *this, out, undecided};
auto decision = b->limiter ? b->limiter->limit(context) : ILimiter::EDecision::ACCEPT; //bonuses without limiters will be accepted by default
if(decision == ILimiter::EDecision::DISCARD)
if(decision == ILimiter::EDecision::DISCARD || decision == ILimiter::EDecision::NOT_APPLICABLE)
{
undecided.erase(i);
i--; continue;