Table of Contents

Class AIAbilityClassifier

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Works out what an ability does by reading the ECA action graph the designer already built, so archetypes never have to name specific abilities.

public static class AIAbilityClassifier
Inheritance
AIAbilityClassifier
Inherited Members

Remarks

What this replaces. A healer archetype used to carry a list of heal ability template IDs, and a defender a list of taunt IDs. That list is a second, hand-maintained statement of something the ability asset already says: an ability with an ApplyHealAction in its on-hit event is a heal. Two statements of one fact drift — a designer adds a third heal and the archetype silently keeps casting only the two it knows, with no error anywhere. It also does not scale: every archetype needs the list, every new ability needs adding to every archetype that should use it, and a shared archetype cannot be reused across creatures with different spellbooks.

How it works. An AbilityTemplate's five event lists are Triggers, and a trigger's actions are ordinary serialized objects. Walking them and looking at the action types present is enough to know whether an ability heals, damages, controls, dispels or taunts — no naming convention, no ID list, no extra field for a designer to forget.

Where it stops. A buff that expresses its effect through ECA tick events is read the same way as everything else — an ApplyDamageAction on a tick is a damage-over-time effect and says so outright. The simple buff templates that express their effect as serialized numbers instead carry no "this is a debuff" flag, so those are separated by the sign of the attributes they modify and by whether the state flags they set are incapacitating. That is a heuristic, and it is the one place this class can be wrong. It is also the place a designer can correct it, via the manual intent override on the ability template.

Results are cached per template. Templates are immutable ScriptableObjects at runtime, and the walk is deep enough that repeating it inside an ability picker would be wasteful.

Methods

Classify(Ability)

Returns what an ability instance does.

public static AIAbilityIntent Classify(Ability ability)

Parameters

ability Ability

The ability to classify.

Returns

AIAbilityIntent

The ability's intent flags, or None.

Classify(AbilityTemplate)

Returns what an ability template does, using the cache.

public static AIAbilityIntent Classify(AbilityTemplate template)

Parameters

template AbilityTemplate

The template to classify.

Returns

AIAbilityIntent

The template's intent flags, or None.

ClassifyAction(BaseAction)

Returns the intent a single ECA action contributes.

public static AIAbilityIntent ClassifyAction(BaseAction action)

Parameters

action BaseAction

The action to classify. Null contributes nothing.

Returns

AIAbilityIntent

The intent flags for this action.

ClassifyBuff(BaseBuffTemplate)

Decides whether a buff template is beneficial, detrimental, or crowd control.

public static AIAbilityIntent ClassifyBuff(BaseBuffTemplate template)

Parameters

template BaseBuffTemplate

The buff template to classify.

Returns

AIAbilityIntent

The intent flags this buff contributes.

Remarks

BaseBuffTemplate has no "harmful" flag, so this reads the effect itself: a state flag that CharacterIncapacitation recognises is control, a net negative attribute change is a debuff, a net positive one is a buff, and a resource tick is a heal or damage over time by its sign.

The sum, not the count. A buff that grants +100 armour and −5 movement speed is a buff; counting entries would call it ambiguous and counting the first entry would depend on list order.

ClearCache()

Clears the cache. Call when ability templates are reloaded in the editor.

public static void ClearCache()

Has(Ability, AIAbilityIntent)

True when an ability carries every one of the given intent flags.

public static bool Has(Ability ability, AIAbilityIntent flags)

Parameters

ability Ability

The ability to test.

flags AIAbilityIntent

Flags that must all be present.

Returns

bool

True if all flags are present.

HasAny(Ability, AIAbilityIntent)

True when an ability carries any of the given intent flags.

public static bool HasAny(Ability ability, AIAbilityIntent flags)

Parameters

ability Ability

The ability to test.

flags AIAbilityIntent

Flags to look for.

Returns

bool

True if at least one flag is present.