Abilities

Abilities are assigned to Units. Look for UnitBase → CommandCard to add an Ability to a Unit.

Types of abilities:

diagram

Executable

This is an abstract class, and it defines a CastCost.It should be noted that we regard it as best practice to charge any cast costs immediately when an ability is scheduled for execution and to refund costs if an execution is cancelled.(In that way it will be impossible that a scheduled ability cannot be paid for when it gets executed)

Refunding CastCost when an ability execution is cancelled is NYI.

Inventory

The inventory ability defines an inventory. Assign the inventory ability to a unit for the unit to have that inventory. If a unit has at least one inventory ability, it can receive Items. A unit can have multiple inventories. A common usecase for multiple inventories is to separate a unit’s equipment from its back-bag by using 2 inventory abilities.

An Inventory is a list of slots, and every slot has an "Equip" boolean flag that determines if an item in that slot should be regarded as "equipped".

If the "Accepts" field of an Inventory slot is set to "None" (the default) then this slot accepts all items.

Instant

This is called "instant" because the player does not need to select a target for the ability. However, an instant ability can still have a cast time.

The target of an instant ability is always the casting unit.

This class adds Ability Cast Phases to the inheritance hierarchy.

Target

Targeted abilities require the user to select a target. A target can either be a Unit or a point. How does the system find out if the target should be a unit or a point? By looking at the ability’s effects.

Interactable

An interactable ability is an ability that a unit "offers" to another unit. It is assigned to the unit that will offer it, and that unit will also execute it. However, the owning Unit will not trigger the execution of the ability itself. It will execute it, paying the Cast Cost (if any), but the triggering Unit will be a different one.

While the editor does not prevent it, there can only be one Interactable ability on a unit.

An example usecase for Interactable Abilities is the "charcoal kiln" in Valheim. If you approach this building, it gives you the option to press "E" and thereby transfer wood from your inventory to the building. In this case the building is the owner of the interactable ability.

Directional

Directional is NYI.

Train

Train is NYI.

Use a Train Ability to train (build) a unit. Train Abilities carry an array of TrainingInfo classes. This is because one train ability can trigger more than one training. E.g., a Barracks can train more than one type of unit.

Research

Research is NYI.

A Research Ability is a Train ability targeted at Upgrades.