Class Bonus
Combines causes (when to trigger) with effects (how to transform values). Created directly with causes, effects, and a name.
Inheritance
System.Object
Bonus
Assembly: Eco.Gameplay.dll
Syntax
public sealed class Bonus : Object, IDescribable
Constructors
Bonus()
Declaration
Properties
Causes
Conditions that must ALL be met for this bonus to apply.
Declaration
public List<BonusCause> Causes { get; set; }
Property Value
| Type |
Description |
| System.Collections.Generic.List<BonusCause> |
|
EffectDescription
Optional effect description stored on the bonus. When set, replaces auto-generated effect descriptions in Describe(BonusContext).
Keeps effects generic — avoids semantic subclasses like "BonusEffectFreshness" or "BonusEffectUnlock".
Declaration
public LocString EffectDescription { get; set; }
Property Value
Effects
Effects to apply when all causes are triggered. Applied in OrderOfOperations order.
Declaration
public List<BonusEffect> Effects { get; set; }
Property Value
| Type |
Description |
| System.Collections.Generic.List<BonusEffect> |
|
Name
Display name for the bonus (Such as talent name, module name).
Declaration
public LocString Name { get; set; }
Property Value
Methods
Describe(BonusContext)
Describe this bonus for tooltips. Uses EffectDescription when set, otherwise auto-generates from effects.
Returns empty when no effect text is available (effects describe nothing and no EffectDescription override).
Declaration
public LocString Describe(BonusContext context)
Parameters
Returns
DescribeBody(BonusContext)
Returns the body text (effects + causes) without any Name/Foldout wrapper. Used by grouped displays where the header is provided externally (e.g. TalentGroup UILink).
Declaration
public LocString DescribeBody(BonusContext context)
Parameters
Returns
Description()
IDescribable auto-generated from cause and effect descriptions.
Declaration
public LocString Description()
Returns
TryApply(BonusContext, Single)
Try to apply this bonus to a value. Checks all causes first — if any fail, the value is returned unchanged.
Declaration
public float TryApply(BonusContext context, float value)
Parameters
| Type |
Name |
Description |
| BonusContext |
context |
|
| System.Single |
value |
|
Returns
| Type |
Description |
| System.Single |
|
WouldApply(BonusContext)
Check if this bonus would apply to the given context (without actually applying it).
Declaration
public bool WouldApply(BonusContext context)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Implements
Extension Methods