# AI Boss Manager

<div align="left"><figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2FOXndO6hKeLj0uEuE8Vaf%2FActorComponent_64x.png?alt=media&#x26;token=b00844b2-cbc3-4f89-9f4b-d2c8e193007c" alt=""><figcaption></figcaption></figure></div>

The **AI Boss Manager (AC\_AI\_Boss)** component is designed for handling advanced boss behavior, allowing for dynamic phase transitions based on various conditions, such as health thresholds or custom triggers. It extends upon the standard [**AI Combat Manager**](https://soulslike-framework.isik.vip/components-managers/ai-only-components/ai-combat-manager), overriding its **Ability system** to support **phase-based Ability sets**, cinematic transitions, and boss-specific mechanics. This ensures that boss encounters feel more engaging and responsive to the player's actions.

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

### **How It Works**

* **Phase Management**
  * The component listens for **stat updates** and evaluates whether a phase transition should be triggered based on a predefined condition (e.g., health dropping below a threshold).
  * If a phase transition is required, it sets the new phase and updates the boss’s ability set accordingly.
  * It supports playing a **cinematic sequence, music, or an animation montage** before resuming combat.
* **Event Bindings & Damage Handling**
  * It binds to **OnStatUpdated** events to track changes in stats that may trigger a phase change.
  * Additionally, it listens for **OnDeath**, ensuring that once a boss is defeated, necessary actions such as **unlocking doors**, **playing a final death cinematic**, or **displaying a "Boss Defeated" message** are executed.
* **Ability Overrides**
  * Dynamically **overrides abilities** at each phase, replacing the boss's current ability set with a new one appropriate for the given phase.
  * This allows bosses to change their combat behavior as the fight progresses, introducing **new mechanics, attack patterns, or defensive maneuvers**.
* **Death Handling**
  * Upon death, it marks the fight as inactive and attempts to **play a death sequence**.
  * If applicable, nearby **boss doors** will be unlocked.
  * A **delayed screen message** (e.g, "Boss Defeated") can be displayed after a configurable delay.

### Example Usage

<figure><img src="https://3303637552-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FOAGs3il6rJbkejwPOlEP%2Fuploads%2Fzy5PSOWq7bOHIVg7ICwZ%2Fimage.png?alt=media&#x26;token=877ba7aa-4317-406b-b6f0-e4ffe3a54170" alt=""><figcaption></figcaption></figure>

{% embed url="<https://youtu.be/X4sAa8LQ6KU>" %}
