Table of Contents

Class Ability

Namespace
AO
Assembly
CoreAssembly.dll
public abstract class Ability
Inheritance
Ability
Inherited Members
Extension Methods

Fields

AppliedEffect

The effect applied to a target. Only set if there is a single target

public AEffect AppliedEffect

Field Value

AEffect

CooldownRemaining

How much cooldown is remaining in seconds.

public float CooldownRemaining

Field Value

float

MaxCooldown

Tha max cooldown used to display. Will often just be set to Cooldown, but can be overridden if needed.

public float MaxCooldown

Field Value

float

Player

The player who owns the ability

public Player Player

Field Value

Player

Properties

CancelableInterrupt

The interrupt value passed to the AppliedEffect when canceled. Depends on EffectIsCancelable being true.

public virtual bool CancelableInterrupt { get; }

Property Value

bool

Cooldown

Maximum cooldown on ability activation.

public virtual float Cooldown { get; }

Property Value

float

DrawAimingIndicators

Whether to draw the aiming indicator while aiming this ability (if applicable).

public virtual bool DrawAimingIndicators { get; }

Property Value

bool

Effect

The effect to apply on ability activation. This is the recommended way to use abilities.

public virtual Type Effect { get; }

Property Value

Type

EffectIsCancelable

If true, the ability will remain activatable while monitoring the AppliedEffect. If activated, AppliedEffect will be removed with interrupt == CancelableInterrupt.

public virtual bool EffectIsCancelable { get; }

Property Value

bool

Icon

The texture to display in the default UI

public virtual Texture Icon { get; }

Property Value

Texture

MaxDistance

The maximum distance to choose targets. Each targetting mode will use this differently.

public virtual float MaxDistance { get; }

Property Value

float

MaxTargets

The maximum number of allowed targets. Each targetting mode will use this differently.

public virtual int MaxTargets { get; }

Property Value

int

MonitorEffectDuration

If true the ability system will monitor the duration of AppliedEffect, as a secondary countdown before the cooldown is applied.

public virtual bool MonitorEffectDuration { get; }

Property Value

bool

TargettingEffect

The effect to apply on ability activation. This is the recommended way to use abilities.

public virtual Type TargettingEffect { get; }

Property Value

Type

TargettingMode

How the ability should choose targets.

public virtual TargettingMode TargettingMode { get; }

Property Value

TargettingMode

Methods

CanBeginTargeting()

Called when we are trying to get into a targeting mode. Here is where you might check for resources like bullets and deny targeting if the player has no ammo. This will be called multiple times so keep it a pure function; i.e. don't deduct resources. Popping up a message with something like Notifications.Show() to tell the user why they can't begin targeting is encouraged.

public virtual bool CanBeginTargeting()

Returns

bool

CanTarget(Player)

Called for every potential target, determines if the player is a valid target. Eg. You could filter targets based on teams here.

public abstract bool CanTarget(Player player)

Parameters

player Player

Returns

bool

CanUse()

Called each frame from the ability system to determine if the ability can be used.

public abstract bool CanUse()

Returns

bool

IsOnCooldown()

public bool IsOnCooldown()

Returns

bool

OnTryActivate(AbilityActivationInfo)

Called on ability activation. You can do whatever you want here, but we recommend using Effect instead.

public virtual bool OnTryActivate(Player.AbilityActivationInfo info)

Parameters

info Player.AbilityActivationInfo

Returns

bool

OnTryActivate(List<Player>, Vector2, float)

Called on ability activation. You can do whatever you want here, but we recommend using Effect instead.

public virtual bool OnTryActivate(List<Player> targetPlayers, Vector2 direction, float magnitude)

Parameters

targetPlayers List<Player>
direction Vector2
magnitude float

Returns

bool