Attacks

## Primary Attacks

Primary Attacks are initiated by a unit whenever it's Mana is not full and there is an enemy in it's attack range.

This is the primary way to generate Mana for ranged units and those that take little damage, and the secondary way for those that take a lot of damage.

All primary attacks deal a random amount of physical damage (within a specific damage range which differs for every unit), though there are some ways to add non-physical damage to those attacks. Those are the following:

* Demon  bonus (pure damage)
* Batrider's Sticky Napalm (magic damage)

### Attack Speed

Attack Speed is the time in seconds that it takes before the hero can attack again. In-game is shown the Attack Rate of each hero, in attacks per second, which is (1 / Attack\_Speed). For example, a unit with an Attack Speed of 2 seconds, will have an Attack Rate of 0.5 attacks per second.

The actual Attack Rate of a unit, taking into account attack speed bonuses, is calculated by taking the base attack rate (in attacks per second), which is listed in-game, and multiplying that by (1 + Attack\_Speed\_Bonus).

As a result, units that have a low base attack rate (like Tiny) do not benefit more or less from attack speed items than units that have a high base attack rate.

Multiple sources of attack speed bonus (including attack speed slows) stack additively.

A 50 attack speed slow will halve the DPS of a unit without any other attack speed modifiers.

### Damage Per Second

Damage Per second, often abbreviated DPS, is a measure of the damage that can be dealt by a hero's primary attack over one second.

The average DPS of each hero's primary attack is listed in-game. It is calculated based on the middle (or median) of the possible damage that the hero can do during each primary attack.

The DPS is calculated by multiplying the median of the current damage range for the hero, by the base attack rate (in attacks per second) which is also listed in-game. Alternatively, the DPS can also be calculated by dividing the median of the current damage range for the hero, by the base attack speed (in seconds). For example, a   Tiny, with a damage range of [120/200] (median is 160) and an attack speed of 1.90 has a DPS of (160 / 1.9) = 84.

### Attack Range

The attack range of each hero's primary attack is listed in-game, in units of cells on the board. The primary attack range of the hero can also be seen on the board during a game by selecting the hero; highlighted cells on the board surrounding the hero indicate the cells that targets can be in that will be attacked by this hero.

A target is within the attack range of a unit if it is within the specified number of cells in any direction, including diagonally. The minimum attack range is 1 cell, while the maximum attack range is 7 cells which covers the entire board no matter where the unit currently is on the board.

Units that have an attack range of 1 cell are considered to be **melee** units. Units with an attack range of more than one cell are **ranged** units.

### Targeting

The targeting logic for attacks appears to use different logic depending on the range of the attacker:

* Melee units always target enemies that are on vertical or horizontal fields relative to them first, and only target those on diagonal fields if there were none.
* Ranged units tend to strongly favour attacking an enemy that is closer to them, but will sometimes attack further away units as well.
	+ The chance of hitting an enemy appears to decrease strongly with the amount of other enemies that are closer.

## Abilities

Any action that uses Mana is considered to be an ability - any passives like Viper's Corrosive Skin or Luna's Moon Glaives, are not.

Exceptions to this rule are:

* Tusk's Walrus Punch, as that counts as a critical strike and is considered a primary attack as a result