Class ProgressionExtensions
Progression extensions for Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig.
Inheritance
Namespace: BlueprintCore.Utils.Types
Assembly: BlueprintCore.dll
Syntax
public static class ProgressionExtensions
Remarks
Only one progression can be applied to a config; only call one of these functions for a config.
If the config should return the base value, no progression is needed.
Integer division is truncated: 3 / 2 = 1
(rounds down) and -3 / 2 = -1
(rounds up).
Config progressions are deceptively named; the functions attempt to name them correctly. For easy mapping to the enum each function comment explains the progression formula and which enums are used. See also the ContextRankConfig Calculator.
Methods
| Improve this Doc View SourceWithBonusValueProgression(ContextRankConfig, Int32, Boolean)
Result = BaseValue + Bonus
OR
OR = 2*BaseValue + Bonus
, if doubleBaseValue
is true
Declaration
public static ContextRankConfig WithBonusValueProgression(this ContextRankConfig config, int bonus, bool doubleBaseValue = false)
Parameters
Type | Name | Description |
---|---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig | config | |
System.Int32 | bonus | |
System.Boolean | doubleBaseValue |
Returns
Type | Description |
---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig |
Remarks
Implements Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.BonusValue and Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.DoublePlusBonusValue
WithCustomProgression(ContextRankConfig, (Int32 Base, Int32 Progression)[])
Implements Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.Custom
Declaration
public static ContextRankConfig WithCustomProgression(this ContextRankConfig config, params (int Base, int Progression)[] progression)
Parameters
Type | Name | Description |
---|---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig | config | |
System.ValueTuple<System.Int32, System.Int32>[] | progression |
Returns
Type | Description |
---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig |
Remarks
Entries must be provided in ascending order by their Base.
The result is the Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig.CustomProgressionItem.ProgressionValue of the first entry where the config's BaseValue is less than or equal to the entry's Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig.CustomProgressionItem.BaseValue. If the config's BaseValue is greater than all entry Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig.CustomProgressionItem.BaseValue, the last entry's Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig.CustomProgressionItem.ProgressionValue is returned.
ContextRankConfigs.CharacterLevel().CustomProgression((5, 1), (10, 2), (13, 4), (18, 6));
- Levels 1-5
Result = 1
- Levels 6-10
Result = 2
- Levels 11-13
Result = 4
- Levels 14+
Result = 6
WithDiv2Progression(ContextRankConfig, Int32)
Result = BaseValue / 2 + Bonus
Declaration
public static ContextRankConfig WithDiv2Progression(this ContextRankConfig config, int bonus = 0)
Parameters
Type | Name | Description |
---|---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig | config | |
System.Int32 | bonus |
Returns
Type | Description |
---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig |
Remarks
Implements Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.Div2 and Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.Div2PlusStep
WithDivStepProgression(ContextRankConfig, Int32)
Result = BaseValue / Divisor
Declaration
public static ContextRankConfig WithDivStepProgression(this ContextRankConfig config, int divisor)
Parameters
Type | Name | Description |
---|---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig | config | |
System.Int32 | divisor |
Returns
Type | Description |
---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig |
Remarks
Implements Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.DivStep
WithHalfMoreProgression(ContextRankConfig)
Result = BaseValue + BaseValue / 2
Declaration
public static ContextRankConfig WithHalfMoreProgression(this ContextRankConfig config)
Parameters
Type | Name | Description |
---|---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig | config |
Returns
Type | Description |
---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig |
Remarks
Implements Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.HalfMore
WithLinearProgression(ContextRankConfig, Single, Single, Int32, Int32, Int32, Nullable<Int32>, Nullable<Int32>)
Creates a linear custom progression: ProgressionValue = a * BaseValue + b
.
Declaration
public static ContextRankConfig WithLinearProgression(this ContextRankConfig config, float a, float b, int startingBaseValue = 1, int maxBaseValue = 40, int progressionValueBeforeStart = 0, int? minProgressionValue = null, int? maxProgressionValue = null)
Parameters
Type | Name | Description |
---|---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig | config | |
System.Single | a | |
System.Single | b | |
System.Int32 | startingBaseValue | |
System.Int32 | maxBaseValue | |
System.Int32 | progressionValueBeforeStart | |
System.Nullable<System.Int32> | minProgressionValue | |
System.Nullable<System.Int32> | maxProgressionValue |
Returns
Type | Description |
---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig |
Remarks
When BaseValue
is less than startingBaseValue
the result is
progressionValueBeforeStart
.
When BaseValue
is greater than or equal to
startingBaseValue
the result is a * BaseValue + b
.
When BaseValue
exceeds maxBaseValue
the result is a * MaxBaseValue + b
.
If specified, maxProgressionValue
sets the maximum result.
If specified, minProgressionValue
sets the minimum result.
Results are truncated so 3.6 becomes 3.
CharacterLevel
is 4, then 1 + 3/4 * CharacterLevel
ContextRankConfigs.CharacterLevel().LinearProgression(0.75f, 1, startingBaseValue = 4);
WithMultiplyByModifierProgression(ContextRankConfig, Int32)
Result = BaseValue * Multiplier
Declaration
public static ContextRankConfig WithMultiplyByModifierProgression(this ContextRankConfig config, int multiplier)
Parameters
Type | Name | Description |
---|---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig | config | |
System.Int32 | multiplier |
Returns
Type | Description |
---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig |
Remarks
Implements Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.MultiplyByModifier
WithOnePlusDiv2Progression(ContextRankConfig)
Result = 1 + (BaseValue - 1) / 2
Declaration
public static ContextRankConfig WithOnePlusDiv2Progression(this ContextRankConfig config)
Parameters
Type | Name | Description |
---|---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig | config |
Returns
Type | Description |
---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig |
Remarks
Implements Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.OnePlusDiv2
WithStartPlusDivStepProgression(ContextRankConfig, Int32, Int32, Boolean)
Result = 1 + Max((BaseValue - Start) / Divisor, 0)
OR
Result = 0
, if delayStart
is true
and BaseValue < Start
Declaration
public static ContextRankConfig WithStartPlusDivStepProgression(this ContextRankConfig config, int divisor, int start = 0, bool delayStart = false)
Parameters
Type | Name | Description |
---|---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig | config | |
System.Int32 | divisor | |
System.Int32 | start | |
System.Boolean | delayStart |
Returns
Type | Description |
---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig |
Remarks
Implements Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.StartPlusDivStep, Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.DelayedStartPlusDivStep, and Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.OnePlusDivStep
WithStartPlusDoubleDivStepProgression(ContextRankConfig, Int32, Int32)
Result = 1 + 2 * Max((BaseValue - Start) / Divisor, 0)
Declaration
public static ContextRankConfig WithStartPlusDoubleDivStepProgression(this ContextRankConfig config, int divisor, int start = 0)
Parameters
Type | Name | Description |
---|---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig | config | |
System.Int32 | divisor | |
System.Int32 | start |
Returns
Type | Description |
---|---|
Kingmaker.UnitLogic.Mechanics.Components.ContextRankConfig |
Remarks
Implements Kingmaker.UnitLogic.Mechanics.Components.ContextRankProgression.StartPlusDoubleDivStep