# Buff Manager

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

The **Buff Manager (AC\_BuffManager)** component is responsible for managing buffs that can be applied to the player, typically gained from items or triggered gameplay events. Unlike the **AC\_StatusEffectManager**, which tracks status effects like poison or burning, buffs are generally positive or neutral enhancements such as temporary stat boosts, increased movement speed, or resistance effects.

This component ensures that buffs are correctly applied & removed, preventing issues such as duplication or persistence after loading from save data.

It is added to the **Base Character** class by default **(B\_Base\_Character).**

### How It Works

* **Adding Buffs**
  * When an item grants a buff, the **TryAddBuff()** method is called. This method loads and creates an instance for the **Buff Object.** It ensures that effect duplication does not happen while loading from a save.
* **Removing Buffs**
  * Buffs can be removed through various functions:
    * **RemoveBuffOfType()** → Removes a single buff of a specified type.
    * **RemoveAllBuffsOfType()** → Removes all active buffs of a given type.
    * **RemoveBuffWithTag()** → Removes a buff using a gameplay tag reference.
    * **RemoveAllBuffsWithTag()** → Removes all instances of the buffs associated with a gameplay tag.
  * Buffs are removed either immediately or through a **delayed removal system**. The delayed method ensures that no race conditions occur.
* **UI & Widget Integration**
  * Whenever a buff is added or removed, the **OnBuffDetected** dispatcher fires, allowing connected UI elements (e.g., buff icons) to update accordingly.

### Example Usage

<figure><img src="/files/zr5naUiIOckF7JxRNVUF" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/cmoNqxVAX5NxnrFYLoLi" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/Af9hFqdpHV7kWTfB4Y5n" 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/shared-components/buff-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.
