The Enemy Defense System

Combat States:

Short:
En Guard
Blocking High
Blocking Low
Parry High
Parry Low
Move Back
Attack Strings

Long:
Lunge
Move Up

Both:
Hurt
Dizzy
Down

Other:
Invincible

Close Combat

When in Close Combat, the default enemy behaviour is the En Guard behaviour. After a certain amount of time has passed, enemies will do any of the following randomly. There is a bias for enemies to do the "Attack" Behaviour instead of a "Defensive" one.

En Guarde ->

Blocking High
Blocking Low
Parry High
Parry Low
Move Back
Attack Strings
Reset

After an attack is made, the enemy defaults back to the En Guarde behaviour unless otherwise stated.


**From Hurt

When an enemy is Hurt, they will respond randomly and do either a High/Low Block or (if the enemy has one) a High/Low Parry, do nothing, or get Dizzy Knocked Down. There is a statistical bias towards the Defensive behaviour being the height of the landed attack. The odds of getting Dizzy Downed are proportional to the number of attacks landed by the player in a row and the type of enemy. More difficult enemies will rarely be dizzy.

Hurt -> Dizzy
Hurt -> Block/Parry
Hurt -> Down
Hurt -> En Guarde


**From Dizzy

When an enemy is Dizzy, they will respond randomly to further attacks. There is a chance that they will fall Down. This chance increases with each further attack. For example, a Dizzy enemy is hit, there is a 25% chance (for example) that they will fall
Down. If they do not and are hit again, then there would be a 50% chance and so on.
With certain enemies, they will go into a Defensive behaviour instead of falling Down.

Dizzy -> Down
Dizzy -> Block/Parry


**From Down

Down Enemies cannot be damaged and are in an "Invincible" state. The Invincible state lasts for a short period of time or until the player receives damage. They will do behaviours based on their distance to the player.
At Close Range, they will Attack or Move Back. A bias towards Attacking will be given for more difficult enemies.
At Long Range, they will Lunge or En Guarde. A bias towards Attacking will be given for more difficult enemies.

Enemies default back to the En Guarde state once they get up. Further actions are controlled by that behaviour.
Down -> Attack
Down -> Move Back

Down -> En Guarde
Down -> Lunge (Long)


**From Blocking

When an Enemy Blocks successfully and Stuns the player they will Attack or Move Back with bias towards Attacking.
Otherwise, a Block lasts for a random amount of time until a new Behaviour is set . An enemy can go right from a block to another behaviour without going back to En Guarde.

Blocking -> Attack
Blocking -> Move Back
Blocking -> Reset

**From Parry

When an enemy Parries successfully, the player is Stunned and the enemy goes right into their preselected Attack String counter attack.

Otherwise, a Parry lasts until a new Behaviour is set.

Parry -> Reset
Parry -> Attack

Glossary

Behaviour - An AI based "Action" that an enemy will do in certain circumstances. Includes attacking, blocking and parrying. Based on the Action Timer or part of a "Chain".

Chain - A sequence of Behaviours. For example, Block high -> Moving Back -> Lunge

Defensive Behaviour - A Block, Parry or Move behaviour.

Invincible - Immune to attacks. Cannot be damaged and cannot have their behaviour changed by attacks.

String - A sequence of Attacks. Since an "Attack" is a Behaviour and can be part of a Chain.