Table of Contents

Class PetSupport

Namespace
FishMMO.Server.Implementation.World.SceneServer.AI
Assembly
FishMMO.Server.dll

How a pet uses the heals and buffs it knows: on its owner first, always, then on itself and the friends around it.

public static class PetSupport
Inheritance
PetSupport
Inherited Members

Remarks

Driven by what the pet knows, not by its archetype. A pet's spells can come from its summon spell (AbilityOnSummonEvent), so a melee pet may well know a heal. The heals and buffs are found the way HealerAttackingState finds its heals — from the ability's own ECA actions (AIAbilityClassifier) — and a pet that knows none finds nothing to do here. Run in combat by BaseAttackingState before the attack, and out of combat by PetIdleState, so a pet patches its owner up after a fight as well as during one.

The order is fixed. The owner is looked after first, at any distance: an owner below the heal threshold is healed, and an owner missing a buff the pet can give is buffed, before anyone else is considered — the pet walks back to its owner to do it. Then the most wounded of the pet itself and its friends, then their buffs. AIPetSupportSettings tunes the threshold and the reach; it cannot reorder this.

A friend is someone the pet's owner may not harm and is on the same side as: the owner's party, guild and other pets, and anyone the owner is allied with (IsFriend(Pet, ICharacter)).

Static and single-threaded, like the healer's ally sweep: every call runs to completion inside one synchronous AI tick, which is what lets the filters below share one scratch recipient instead of allocating a closure per pick.

Methods

Activate(AIController, IAbilityController, Ability)

Queues a support cast for an NPC with no attack pacing of its own (the pet's idle state).

public static bool Activate(AIController controller, IAbilityController abilityController, Ability ability)

Parameters

controller AIController

The pet's AI controller.

abilityController IAbilityController

The pet's ability controller.

ability Ability

The ability to cast.

Returns

bool

True when the cast was queued.

BeginCast(AIController, in Choice)

Turns the pet, and its aim, to the recipient and stops it, ready for the cast.

public static void BeginCast(AIController controller, in PetSupport.Choice choice)

Parameters

controller AIController

The pet's AI controller.

choice PetSupport.Choice

The decided cast.

EndSupportAim(AIController)

Hands the aim and the facing back to the enemy (or to nobody, out of combat) once nothing is being cast at a friend.

public static void EndSupportAim(AIController controller)

Parameters

controller AIController

The AI controller.

IsCasting(IAbilityController)

True while a cast is being made or is queued.

public static bool IsCasting(IAbilityController abilityController)

Parameters

abilityController IAbilityController

The ability controller.

Returns

bool

IsFriend(Pet, ICharacter)

Whether candidate is someone the pet looks after: its owner's side, and never someone its owner may harm.

public static bool IsFriend(Pet pet, ICharacter candidate)

Parameters

pet Pet

The pet.

candidate ICharacter

The character to judge.

Returns

bool

True for a friend.

Plan(AIController, LayerMask, bool, out Choice)

Decides the pet's support action for this tick and, when the recipient is out of reach and mayMove allows, starts walking to them.

public static PetSupport.Step Plan(AIController controller, LayerMask fallbackLayers, bool mayMove, out PetSupport.Choice choice)

Parameters

controller AIController

The pet's AI controller.

fallbackLayers LayerMask

Layers to sweep for friends when the settings name none.

mayMove bool

False while the pet has been told to stay where it is.

choice PetSupport.Choice

The decided cast, when the step is not None.

Returns

PetSupport.Step

What the caller should do.

TryChoose(AIController, AIPetSupportSettings, LayerMask, out Choice)

The support cast the pet should make, in the fixed order: owner first, then itself and its friends. Does not move or cast anything.

public static bool TryChoose(AIController controller, AIPetSupportSettings settings, LayerMask fallbackLayers, out PetSupport.Choice choice)

Parameters

controller AIController

The pet's AI controller.

settings AIPetSupportSettings

The archetype's settings; null or disabled chooses nothing.

fallbackLayers LayerMask

Layers to sweep for friends when the settings name none.

choice PetSupport.Choice

The decided cast.

Returns

bool

True when there is something to cast.