Struct DamageContext

Namespace
TDMaker.Core
Assembly
TDMaker.Core.dll

A modifiable raw damage request, before defense and incoming multipliers.

public struct DamageContext
Inherited Members

Constructors

DamageContext(int, int, float, DamageDef, int, float)

Creates a raw damage request; Amount is already scaled by its caller.

public DamageContext(int sourceId, int targetId, float amount, DamageDef definition, int experienceRecipientId = 0, float outputScale = 1)

Parameters

sourceId int
targetId int
amount float
definition DamageDef
experienceRecipientId int
outputScale float

Properties

Amount

Raw damage amount; hooks may change it to a finite nonnegative value.

public float Amount { readonly get; set; }

Property Value

float

Cancelled

Whether a pre-queue hook cancels the request.

public bool Cancelled { readonly get; set; }

Property Value

bool

Definition

Immutable damage behavior.

public readonly DamageDef Definition { get; }

Property Value

DamageDef

ExperienceRecipientId

Explicit hero experience recipient, or zero.

public readonly int ExperienceRecipientId { get; }

Property Value

int

Origin

Original mechanism classification, retained through native secondary impacts.

public readonly DamageOrigin Origin { get; }

Property Value

DamageOrigin

OutputScale

Outgoing scale inherited by attached effects.

public readonly float OutputScale { get; }

Property Value

float

RequestId

Unique admitted queue-attempt identifier, assigned before pre-damage hooks; cancellation can leave gaps.

public readonly long RequestId { get; }

Property Value

long

RootRequestId

First request in this native secondary/reflection causal lineage.

public readonly long RootRequestId { get; }

Property Value

long

RootSourceId

Source of the lineage root, even if that entity no longer exists.

public readonly int RootSourceId { get; }

Property Value

int

SourceId

Originating entity, or zero.

public readonly int SourceId { get; }

Property Value

int

TargetId

Recipient entity.

public readonly int TargetId { get; }

Property Value

int

Methods

WithOrigin(DamageOrigin)

Marks an extension-created packet before RequestDamage. Pre-damage hooks cannot replace admitted provenance.

public DamageContext WithOrigin(DamageOrigin origin)

Parameters

origin DamageOrigin

Returns

DamageContext