# AI Combat Manager

<div align="left"><figure><img src="/files/Pxb9F1D6r6SRb7Q5t5rd" alt=""><figcaption></figcaption></figure></div>

The **AI Combat Manager** (**AC\_AI\_CombatManager)** component is responsible for handling AI combat interactions, including damage processing, hit reactions, poise/stance breaks, unarmed combat, and death handling. It functions *similarly* to the [**Combat Manager** used for the player](/components-managers/player-specific-components/combat-manager.md) but is specifically designed for AI, ensuring that AI enemies can react to incoming attacks, process damage correctly, and execute appropriate combat behaviors.

It is added to the **Soulslike Enemy (B\_Soulslike\_Enemy)** class by default.

### **How It Works**

* **Event Bindings**
  * **Registers AI combat events**, such as `OnTakeDamage` and `OnStatUpdated`, to ensure AI responds dynamically to combat situations.
* **Ability Selection**
  * The `TryGetAbility` method (called from **BTS\_TryGetAbility**) is used to retrieve a possible attack Ability while the AI is in Combat state.
* **Damage Handling**
  * **Listens for incoming damage events** and adjusts HP accordingly. If HP falls to zero, it triggers the death logic.
* **Poise System**
  * **Listens for poise stat changes & manages poise mechanics,** triggering a stagger/stun when poise is broken (if Poise falls to zero)
* **Stance Breaks & Hit Reactions**
  * Upon taking damage, the `HandleHitReaction` method checks if Stance is broken, if so, determines the correct hit reaction animation and applies knockback forces based on damage impact.
* **Weapon & Projectile Damage Processing:**&#x20;
  * Handles incoming melee and projectile attacks, applying damage effects accordingly.
* **Unarmed Combat**
  * Uses socket-based tracing for unarmed combat.
* **Notify Related Properties**
  * Manages defensive properties such as [**Hyper Armor**](/animation-notifies/defensive/hyper-armor-notify.md) **&** [**Invincibility**](/animation-notifies/defensive/invincibility-frame-notify.md) which can be toggled through notifies.
* **World Healthbar Updates**
  * Updates the world UI, displaying AI health changes in real-time, Souls style.
* **Death Handling**
  * Initiates the AI death sequence, plays the ragdoll/directional death animation and stops AI controller logic.

### Example Usage

<figure><img src="/files/7lRFLNW1fMtHU5RYw7sq" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://soulslike-framework.isik.vip/components-managers/ai-only-components/ai-combat-manager.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
