Namespace Eco.Gameplay.Bonuses
Classes
ActionCause
Triggers when the action being performed matches a specific BonusAction.
Bonus
Combines causes (when to trigger) with effects (how to transform values). Created directly with causes, effects, and a name.
BonusAction
Types of actions that can trigger bonuses. Crafting and harvesting aspects are flattened into distinct actions.
BonusCause
Defines when a bonus should trigger.
BonusContext
Rich context object containing everything needed for bonus evaluation. Passed to BonusCause.IsTriggered() and BonusEffect.TransformValue().
BonusContextExtensions
Convenience factory extensions for building BonusContext.
BonusEffect
Abstract base class for bonus effects. Defines how a value is transformed. Subclasses implement specific transformation logic.
BonusEffectAdditive
Additive effect: adds a flat Value to the input. Applied at default order (after multiplicative, before overrides).
BonusEffectCappedMultiplicative
Level-aware multiplicative effect with a cap. Applies a fixed multiplier (Value) per SourceLevel, but clamps the cumulative multiplier at Cap. For cost reductions (LowerIsBetter=true), Cap is a floor (e.g. 0.5 = never below 50%). For yield boosts (LowerIsBetter=false), Cap is a ceiling (e.g. 1.5 = never above 150%). Once the cap is reached, further levels have no additional effect — pair with BonusEffectDiminishing on a separate bonus for post-cap scaling.
BonusEffectChance
Chance-based effect: on each application, rolls Chance probability. On success, replaces the value with SuccessValue. On failure, returns the input unchanged. Designed for talents like Logger's Luck (random chance to instantly process a log).
BonusEffectDiminishing
Diminishing-returns effect using project-standard LimitMapper on SourceLevel. Output approaches OutputLimit via half-life scaling. Designed for "Final Talent" infinite-stacking star sinks.
BonusEffectMultiplicative
Multiplicative effect: multiplies the input value by multiplier Value.
BonusEffectOverride
Override effect: replaces the input value entirely with Value. Applied last (order = 1).
BonusEffectSkillMultiplier
Skill-based multiplier: scales the value using a mapper function that receives the base value and the user's current skill level.
BonusManager
Central entry point for bonus resolution and application. Callers build a BonusContext and call ApplyBonuses(BonusContext, Single). Discovers bonuses from context entities that implement IHasBonuses. Handles per-source level resolution (e.g. User's per-talent levels).
CraftBonusCause
Crafting-specific cause. Triggers when the context action matches and recipe/skill/station/tag filters pass.
HarvestBonusCause
Harvest-specific cause. Triggers when the context action is a harvest action and item/skill/tag filters pass.
ResourceTagCause
Triggers when the item in context has one of the specified tags.
SkillLevelCause
Triggers when the user has a specific skill at or above a minimum level.
ToolBonusCause
Triggers when the user is using a specific type of tool.
Interfaces
IHasBonuses
Implemented by types that provide bonuses. Leaf sources (Talent, PluginModule) back this with a System.Collections.Generic.List<> so setup can add bonuses. Aggregate sources (User, WorldObject) compute Bonuses from their sub-sources. All iteration, application, and level resolution is handled by BonusManager — implementors just define the Bonuses property.