Show / Hide Table of Contents

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
Implements
IDescribable
Namespace: Eco.Gameplay.Bonuses
Assembly: Eco.Gameplay.dll
Syntax
public sealed class Bonus : Object, IDescribable

Constructors

Bonus()

Declaration
public Bonus()

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
Type Description
LocString

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
Type Description
LocString

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
Type Name Description
BonusContext context
Returns
Type Description
LocString

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
Type Name Description
BonusContext context
Returns
Type Description
LocString

Description()

IDescribable auto-generated from cause and effect descriptions.

Declaration
public LocString Description()
Returns
Type Description
LocString

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
Type Name Description
BonusContext context
Returns
Type Description
System.Boolean

Implements

IDescribable

Extension Methods

TagUtils.TagNames(Object, Boolean)
TagUtils.TagDisplayNames(Object, Boolean)
ClientSetViewExtensions.SetClassOfProperty(Object, Player, String, String, Int32)
TypeTooltipExtensions.UILinkGeneric(Object)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾