Class PreDamageContext.PreDamageInfoStepBuilder
- Namespace
- ElectricDrill.AstraHealth.Damage
- Assembly
- com.electricdrill.astra-health.Runtime.dll
Concrete step builder implementing the fluent interfaces. After all required fields are set, optional fields (dealer, critical, multiplier, instigator, ignore) can be configured before calling Build().
public sealed class PreDamageContext.PreDamageInfoStepBuilder : PreDamageContext.DamageInfoAmount, PreDamageContext.DamageInfoType, PreDamageContext.DamageInfoSource, PreDamageContext.DamageInfoTarget
- Inheritance
-
objectPreDamageContext.PreDamageInfoStepBuilder
- Implements
Methods
Build()
Build the PreDamageContext instance with the previously configured values.
public PreDamageContext Build()
Returns
WithAmount(long)
Set the damage amount.
public PreDamageContext.DamageInfoType WithAmount(long amount)
Parameters
amountlong
Returns
WithCriticalMultiplier(double)
Set the critical damage multiplier. Values <= 0 will be normalized to 1.0 by the constructor.
public PreDamageContext.PreDamageInfoStepBuilder WithCriticalMultiplier(double multiplier)
Parameters
multiplierdouble
Returns
WithIgnore(bool)
Set the initial Ignore flag for the built context.
Defaults to false. Listeners may still mutate the flag after dispatch.
public PreDamageContext.PreDamageInfoStepBuilder WithIgnore(bool ignore)
Parameters
ignorebool
Returns
WithInstigator(IEffectInstigator)
Set the specific cause of this damage — for example an ability definition, a modifier definition or instance, or a passive. Use this to allow downstream listeners to identify the exact origin beyond entity (WithPerformer(EntityCore)) and category (WithSource(DamageSourceSO)).
public PreDamageContext.PreDamageInfoStepBuilder WithInstigator(IEffectInstigator instigator)
Parameters
instigatorIEffectInstigator
Returns
WithIsCritical(bool)
Mark this damage as critical or not.
public PreDamageContext.PreDamageInfoStepBuilder WithIsCritical(bool isCritical)
Parameters
isCriticalbool
Returns
WithIsReactable(bool)
Set the reactability flag for the built context.
Pass false when building a context for a secondary effect (counter-damage,
passive modifier) so that reactive systems do not respond to it and infinite chains
are prevented. Defaults to true.
public PreDamageContext.PreDamageInfoStepBuilder WithIsReactable(bool isReactable)
Parameters
isReactablebool
Returns
WithPerformer(EntityCore)
Set the performer entity (the entity causing the damage). Optional — pass null or
omit entirely when no specific entity performed the damage (e.g. environmental, traps,
system-initiated).
public PreDamageContext.PreDamageInfoStepBuilder WithPerformer(EntityCore performer)
Parameters
performerEntityCore
Returns
WithSource(DamageSourceSO)
Set the damage source category.
public PreDamageContext.DamageInfoTarget WithSource(DamageSourceSO damageSource)
Parameters
damageSourceDamageSourceSO
Returns
WithTarget(EntityCore)
Set the target entity that will receive the damage.
public PreDamageContext.PreDamageInfoStepBuilder WithTarget(EntityCore target)
Parameters
targetEntityCore
Returns
WithType(DamageTypeSO)
Set the damage type.
public PreDamageContext.DamageInfoSource WithType(DamageTypeSO type)
Parameters
typeDamageTypeSO