Combat system

In *Heroes of Ardania*, combat is implemented in the form of a round-by-round simulation of combat actions. This page describes the rules governing combat actions.

## Overview

Combat is between two sides: the hero (along with his or her followers, if any) and an opposing side. Proficiency in combat depends on the combatant's attributes, abilities, and spells, among other things. Combat continues until one side loses or 500 rounds have elapsed, in which case the battle is considered to be a draw. In some situations, it is possible for a side to lose or gain combatants during the course of the battle. For example, creatures can be summon during combat, or lost during combat by being charmed by the opposing side.

## Action order

In each combat round, combatants act in the order of their speed attribute. Heroes/creatures with higher speed act first, while heroes/creature with lower speed act later.

When a hero/creature is able to act, actions are taken in accordance with the following rules:

* Non-offensive spells (such as self-buff spells) are cast whenever they are available (i.e., not in cooldown), starting on combat round 0. A hero/creature can cast as many non-offensive spells as there are available. After casting a non-offensive spell, the hero may still perform an attack action.
* Attack action:
	+ Offensive spells are prioritized over physical attacks.
		- Offensive spells that are cast by a readied, consumable combat item (i.e., charged item or artifact) have priority over learned spells and spells provided by non-consumable items.
		- Spells learned by the hero (or provided by a non-consumable item) are cast in an order that is based on spell level. Since priority is based on spell level, a lower-level offensive spell will cast only if a higher-level offensive is currently in cooldown. Thus, if the hero has many higher-level offensive spells, a lower-level offensive spell will rarely or never be used.
		- Casting an offensive spell precludes a hero or creature from performing a physical attack. For this reason, if a hero has an offensive spell with no cooldown timer (such as the Wizard's Energy Blast or the Priestess's Drain Life), the hero will never use a physical attack unless that spell is disabled.
	+ If no offensive spell is cast during a combat round, the hero/creature performs a physical attack. The physical attack is either melee or ranged. If a physical attack is performed, it is subject to abilities such as Double Attack, Attack Multiple Foes, and Attack of Opportunity.
		- Melee attacks cannot target opposing ranged combatants until all opposing melee combatants have been defeated.
* If a hero's health has dropped below the healing threshold and the hero has a readied healing aid, then the healing aid will be used as the first action. Healing aids out-prioritize non-offensive spells. If a healing aid is used, than that hero will not be eligible to perform any further action (including the use of non-offensive spell) until the next combat round.
	+ Consequently, it is possible for a hero to be locked in a continuous healing-aid-consumption loop, during which the hero will not be able to do anything other than consume healing aids until the loop is broken.

Action eligibility:

* Ranged physical attacks, healing aids, and non-offensive spells can be used starting on combat round 0.
* Offensive spells can be cast starting on combat round 2.
* Melee physical attacks can be performed starting on combat round 3.

## Attack resolution

* A physical attack hits if
	+ Random(1 to 200) + Attacker's H2H or Ranged **>** 100 + Defender's Parry or Dodge
* A physical attack is parried/dodged if:
	+ Random(1 to 200) + (Attacker's H2H or Ranged) ≥ 100 **and** Random(1 to 200) + (Attacker's H2H or Ranged) **≤** (Defender's Parry or Dodge)
* A physical attack misses if:
	+ Random(1 to 200) + (Attacker's H2H or Ranged) < 100
* A spell hits the target if:
	+ Random(1 to 100) + (Spell Level x 5) + INT > 20 + MGR
	+ Otherwise, the spell is resisted. Unlike physical attacks, spells cannot miss.

## Damage

* Physical damage:
	+ Damage inflicted = Random(1 to (Modified Weapon Damage)) + Weapon Enchantment + STR/8 - Opponent's Armor Roll
	+ Armor Roll = Armor/2 + Random [0 to (Armor/2 – 1)] + Armor Enchantment Bonus
* Spell damage:
	+ Damage inflicted = (Spell's damage) + INT/4 - (Opponent's Armor Enchantment Bonus x 2)