Table of Contents

Class ExpCollectionStrategySO

Namespace
ElectricDrill.AstraHealth.Experience
Assembly
com.electricdrill.astra-health.Runtime.dll

Abstract base class for experience collection strategies. Implements the Template Method pattern to define when and how experience should be collected. Derive from this class to create custom experience collection logic.

public abstract class ExpCollectionStrategySO : ScriptableObject, ITaggable
Inheritance
object
ExpCollectionStrategySO
Implements
ITaggable
Derived

Properties

Tags

The tags associated with this object.

public GameTagSet Tags { get; }

Property Value

GameTagSet

Methods

CalculateExpAmount(IExpSource, float)

Calculates the final experience amount to collect based on the source and multiplier. Override this method to customize experience calculation logic.

protected virtual long CalculateExpAmount(IExpSource expSource, float multiplier)

Parameters

expSource IExpSource

The experience source providing the base amount.

multiplier float

The multiplier to apply to the base experience.

Returns

long

The final experience amount to add.

CollectExp(EntityCore, IExpSource, float)

Performs the actual experience collection: calculates the amount, adds it to the collector's level, and marks the source as harvested. Override this method to customize the entire collection process (e.g., for party XP sharing).

protected virtual bool CollectExp(EntityCore collector, IExpSource expSource, float multiplier)

Parameters

collector EntityCore

The entity collecting the experience.

expSource IExpSource

The experience source to collect from.

multiplier float

The multiplier to apply to the base experience.

Returns

bool

True if experience was collected, false otherwise.

TryCollectExp(EntityCore, EntityCore, DamageResolutionContext)

Attempts to collect experience from a victim entity and add it to the collector's level. This is the main public interface for experience collection. Handles validation, extraction of IExpSource, calculation, adding to EntityLevel, and marking as harvested.

public virtual bool TryCollectExp(EntityCore collector, EntityCore victim, DamageResolutionContext dmgResolutionContext)

Parameters

collector EntityCore

The entity attempting to collect experience.

victim EntityCore

The entity that died and may provide experience.

dmgResolutionContext DamageResolutionContext

The damage resolution that caused the death.

Returns

bool

True if experience was successfully collected, false otherwise.

TryGetExpSource(EntityCore, out IExpSource)

Attempts to extract an IExpSource from the victim's EntityCore. Override this method to customize how the IExpSource is retrieved.

protected virtual bool TryGetExpSource(EntityCore victim, out IExpSource expSource)

Parameters

victim EntityCore

The entity core to extract the IExpSource from.

expSource IExpSource

The extracted IExpSource, or null if not found.

Returns

bool

True if an IExpSource was found, false otherwise.

Validate(EntityCore, EntityCore, DamageResolutionContext, out float)

Override this method to implement the specific validation logic for the strategy.

protected abstract bool Validate(EntityCore collector, EntityCore victim, DamageResolutionContext dmgResolutionContext, out float multiplier)

Parameters

collector EntityCore

The entity attempting to collect experience.

victim EntityCore

The entity that died and may provide experience.

dmgResolutionContext DamageResolutionContext

The damage resolution that caused the death.

multiplier float

Output multiplier to apply to the base experience (1.0 = full exp).

Returns

bool

True if the strategy's conditions are met, false otherwise.