Interface ICharacterDamageController
Interface for character damage controllers, providing damage, healing, and death logic for a character. Includes static events for global damage/heal/kill notifications and resource management properties.
public interface ICharacterDamageController : ICharacterBehaviour, IDamageable, IHealable
- Inherited Members
Fields
OnCombatStateChanged
Raised when a character enters or leaves combat. Carries the character and the new state.
public static Action<ICharacter, bool> OnCombatStateChanged
Field Value
Remarks
A hook rather than a nameplate: what a combat indicator should look like is a UI decision, and wiring one into the damage controller would put presentation inside authoritative state. Subscribers filter by the character they care about — this is static, so it fires for every character in view, the same contract the buff events carry.
Fires on every peer that knows the state, which since CharacterCombatStateBroadcast
includes observers — before it, only the character's own client could know a peer was
fighting, so there was nothing a nameplate could have read.
OnDamaged
Event invoked when a character is damaged. Parameters: attacker, defender, amount, damage type.
public static Action<ICharacter, ICharacter, int, DamageAttributeTemplate> OnDamaged
Field Value
OnHealed
Event invoked when a character is healed. Parameters: healer, healed, amount.
public static Action<ICharacter, ICharacter, int> OnHealed
Field Value
OnKilled
Event invoked when a character is killed. Parameters: killer, victim.
public static Action<ICharacter, ICharacter> OnKilled
Field Value
OnResurrectOffered
Event invoked when a resurrect is offered to a character but not yet applied. Params: resurrector, target, health amount the offer would restore.
public static Action<ICharacter, ICharacter, int> OnResurrectOffered
Field Value
Remarks
Raised instead of reviving when the target is a player who can be asked. The server's character system records the offer and notifies the client; the revive happens only if the player accepts. Exists as an event because the action that offers lives in shared code and must not reference server types.
OnResurrected
Event invoked when a character is resurrected. Params: resurrector, resurrected.
public static Action<ICharacter, ICharacter> OnResurrected
Field Value
Properties
CombatDurationTicks
Gets the configured combat duration in ticks.
uint CombatDurationTicks { get; }
Property Value
Immortal
Gets or sets whether the character is immortal (cannot be damaged or killed).
bool Immortal { get; set; }
Property Value
IsAlive
Returns true if the character is alive (resource attribute's current value is above zero).
bool IsAlive { get; }
Property Value
IsInCombat
Gets whether this character is currently in combat (within the combat duration window).
bool IsInCombat { get; }
Property Value
LastCombatTick
Gets the tick of the last combat action.
uint LastCombatTick { get; }
Property Value
OnDamageTriggers
Triggers invoked when this character deals damage to another. EventData: DamageEventData.
List<Trigger> OnDamageTriggers { get; }
Property Value
OnDamagedTriggers
Triggers invoked when this character receives damage from another. EventData: DamageEventData.
List<Trigger> OnDamagedTriggers { get; }
Property Value
OnHealTriggers
Triggers invoked when this character heals another. EventData: HealEventData.
List<Trigger> OnHealTriggers { get; }
Property Value
OnHealedTriggers
Triggers invoked when this character is healed by another. EventData: HealEventData.
List<Trigger> OnHealedTriggers { get; }
Property Value
OnKillTriggers
Triggers invoked when this character kills another. EventData with TargetCharacter set.
List<Trigger> OnKillTriggers { get; }
Property Value
OnKilledTriggers
Triggers invoked when this character is killed by another. EventData with TargetCharacter set.
List<Trigger> OnKilledTriggers { get; }
Property Value
OnResurrectTriggers
Triggers invoked when this character resurrects another. EventData with TargetCharacter set.
List<Trigger> OnResurrectTriggers { get; }
Property Value
OnResurrectedTriggers
Triggers invoked when this character is resurrected by another. EventData with TargetCharacter set.
List<Trigger> OnResurrectedTriggers { get; }
Property Value
ResourceInstance
Gets the cached health resource attribute for this character.
CharacterResourceAttribute ResourceInstance { get; }
Property Value
Methods
ClearCombatContributions()
Drops all contribution bookkeeping in both directions.
void ClearCombatContributions()
CompleteHeal()
Fully heals the character to maximum resource value.
void CompleteHeal()
EnterCombat()
Enters combat state, refreshing the combat timer. Sets IsInCombat flag and records the current tick. Safe to call repeatedly — refreshes expiry.
void EnterCombat()
HasCombatContributor(long)
True when characterID has contributed to this character's current
combat.
bool HasCombatContributor(long characterID)
Parameters
characterIDlongThe character to look for.
Returns
Remarks
A peek, unlike TryConsumeContributors(out List<long>), which hands the list out and clears it — this is asked once per viewer per observer-scheduling pass and must not disturb the loot-rights ledger it reads.
Exists so observer streaming can pin the characters a player is actually fighting. The visibility budget can otherwise despawn an enemy mid-fight when it is neither the player's current target nor a party member, and a despawned victim takes its combat reports with it — no damage numbers, and the player's own predicted numbers greying out as unconfirmed while every hit is landing.
Kill(ICharacter)
Kills the character, optionally specifying the killer.
void Kill(ICharacter killer)
Parameters
killerICharacterThe character responsible for the kill (can be null).
PropagateCombatContribution(ICharacter)
Extends this character's own contribution credit to supporter.
void PropagateCombatContribution(ICharacter supporter)
Parameters
supporterICharacterThe character to extend credit to.
Remarks
This is how healing earns loot rights. A healer never touches the victim, so there is nothing for RecordCombatContribution(ICharacter, CombatContributionKind) to key off; instead the character who WAS healed pushes its credit outward to everyone still fighting whatever it is fighting. Called on the healed character, not on the victim.
RecordCombatContribution(ICharacter, CombatContributionKind)
Credits contributor with a share of this character's death.
void RecordCombatContribution(ICharacter contributor, CombatContributionKind kind)
Parameters
contributorICharacterThe character whose action earned the credit.
kindCombatContributionKindHow the credit was earned.
Remarks
Server-only, and idempotent per contributor — a thousand hits earn the same single share as one. Credit is resolved to the controlling player, so a pet's damage counts for its owner; contributions from anything that is not ultimately a player are discarded, since only a player can open a loot window.
Revive(ICharacter, int)
Revives (resurrects) a dead character, ADDING the given amount to its health. Equivalent to setting it only when the character is at zero, which a dead one is. Unlike Heal(), this works when CurrentValue is 0. Resets death animation.
void Revive(ICharacter resurrector, int amount)
Parameters
resurrectorICharacterThe character performing the resurrection, or null.
amountintThe amount of health to restore.
TryConsumeContributors(out List<long>)
Takes the accumulated contributor list and clears it.
bool TryConsumeContributors(out List<long> contributors)
Parameters
Returns
- bool
True when at least one contributor was credited.
Remarks
Consuming rather than reading keeps the death path single-shot: whoever takes the list owns it, and a second call cannot hand the same corpse's loot rights out twice.