> For the complete documentation index, see [llms.txt](https://axiomemu.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://axiomemu.gitbook.io/docs/data/monster/monsteraielement.md).

# MonsterAIElement

Defines the actual actions monsters perform when an Automata transition places them in a state. Each Element is one atomic behavior: chase, attack, heal, summon, teleport, grant immunity, switch AI.

## File Location

```
Data/Monster/MonsterAIElement.xml
```

Loaded once at GameServer startup. Changes require a restart. Supports up to 100 element entries (Number 0-99).

After the XML is parsed, the loader also opens `Data/Monster/MovePath/MovePath_35.dat` (Crywolf path data, binary; do not hand-edit).

## Element Classes

`Class` is informational for the evaluator - the actual behavior is dispatched purely by `Type`. Keep Class consistent with the Type for clarity and for the AI Unit slot mapping.

| Class | Name      | Meaning                                          |
| ----- | --------- | ------------------------------------------------ |
| `0`   | CONDITION | Passive check / wait (no action)                 |
| `1`   | MOVE      | Movement actions                                 |
| `2`   | ATTACK    | Offensive actions                                |
| `3`   | HEAL      | Recovery actions                                 |
| `4`   | AVOID     | Evasion actions                                  |
| `5`   | HELP      | Support actions (heal allies, buff)              |
| `6`   | SPECIAL   | Summon, immunity, teleport, skill-pattern attack |
| `7`   | EVENT     | AI change (used in shipped data for Type 68)     |

## Element Types

Dispatched by `Type` value. Types not listed here are ignored by the evaluator.

| Type | Name                       | Meaning                                                                                                                                                  |
| ---- | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `1`  | COMMON\_NORMAL             | Idle / no-op (Class 0)                                                                                                                                   |
| `11` | MOVE\_NORMAL               | Chase (move toward target) or patrol when no target                                                                                                      |
| `12` | MOVE\_TARGET               | Goal move to (`X`, `Y`). Uses map movement path if available                                                                                             |
| `13` | GROUP\_MOVE                | Group migration. TODO: verify exact semantics                                                                                                            |
| `14` | GROUP\_MOVE\_TARGET        | Group goal move. TODO: verify exact semantics                                                                                                            |
| `21` | ATTACK\_NORMAL             | General basic attack on current target                                                                                                                   |
| `22` | ATTACK\_AREA               | Position attack at (`X`, `Y`)                                                                                                                            |
| `23` | ATTACK\_PENETRATION        | "Rubber Meat" skill-disabling attack                                                                                                                     |
| `31` | HEAL\_SELF                 | Self treatment                                                                                                                                           |
| `32` | HEAL\_GROUP                | Group therapy (nearby group members)                                                                                                                     |
| `41` | AVOID\_NORMAL              | Flee from danger                                                                                                                                         |
| `51` | SUPPORT\_HEAL              | Heal a targeted ally within 6 tiles                                                                                                                      |
| `52` | SUPPORT\_BUFF              | Declared but currently a no-op in the evaluator                                                                                                          |
| `62` | SPECIAL\_SOMMON            | Group summon: revives a dead member of the same group via monster skill unit 30                                                                          |
| `64` | SPECIAL\_IMMUNE            | Grants damage immunity. `X` = physical immunity ticks, `Y` = magic immunity ticks. Any value below 1 is clamped to 10 ticks                              |
| `65` | SPECIAL\_NIGHTMARE\_SUMMON | Kanturu Nightmare summon hook (fires monster skill unit 30, triggers Kanturu monster stage 6)                                                            |
| `66` | SPECIAL\_WARP              | Teleport self to (`X`, `Y`); broadcasts teleport skill and clears current target                                                                         |
| `67` | SPECIAL\_SKILLATTACK       | Boss skill rotation. Uses the monster's skill slots 0/1/2. `TargetType` = percent roll for skill 0, `X` = percent for skill 1, `Y` = percent for skill 2 |
| `68` | SPECIAL\_CHANGEAI          | Calls `ChangeAIOrder` on group `TargetType` with order index `X`. Switches every group member to StartAI / AI01 / AI02 / AI03                            |
| `71` | EVENT                      | Declared in the enum but has no dispatch branch; treat as unused                                                                                         |

## Attributes

```xml
<Element Number="..." Name="..."
         Class="..." Type="..."
         SuccessRate="..." DelayTime="..."
         TargetType="..." X="..." Y="..." />
```

| Attribute     | Type       | Effect                                                                                                                                                       |
| ------------- | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `Number`      | 0-99       | Unique Element ID. Referenced by `MonsterAIUnit` Element slots                                                                                               |
| `Name`        | string     | Human-readable label. Stored but not used for logic                                                                                                          |
| `Class`       | 0-7        | Informational category (see Element Classes)                                                                                                                 |
| `Type`        | int        | Dispatch key (see Element Types)                                                                                                                             |
| `SuccessRate` | 0-100      | Probability the element actually executes. A random 0-99 above this rate skips the action                                                                    |
| `DelayTime`   | ms         | Used by the owning AI Unit rule; the element itself does not re-check it                                                                                     |
| `TargetType`  | int or `*` | `*` stored as -1. In shipped data `1` = player targets, `2` = self/monster. For Type 67 it is the skill-0 percent. For Type 68 it is the target group number |
| `X`           | int or `*` | Context-dependent. Move/warp destination X, immunity physical ticks, skill-1 percent for Type 67, AI order (0-3) for Type 68                                 |
| `Y`           | int or `*` | Context-dependent. Move/warp destination Y, immunity magic ticks, skill-2 percent for Type 67                                                                |

`*` values for `TargetType`, `X`, and `Y` are stored as -1.

## Cross-File Dependencies

| Attribute                             | Related in                                                                                                                                                      |
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Number`                              | Referenced by `MonsterAIUnit.ElementNormal / Move / Attack / Heal / Avoid / Help / Special / Event` in [MonsterAIUnit.xml](/docs/data/monster/monsteraiunit.md) |
| Type `66` warp targets                | Must land on a walkable tile; see [MapManager.xml](/docs/data/mapmanager.md)                                                                                    |
| Type `62` group summon                | [MonsterAIGroup.xml](/docs/data/monster/monsteraigroup.md) (dead member with matching `GroupNumber`)                                                            |
| Type `68` AI change                   | `TargetType` is a group from [MonsterAIGroup.xml](/docs/data/monster/monsteraigroup.md); `X` selects StartAI / AI01 / AI02 / AI03                               |
| Monster skill slots used by Type `67` | Monster skill configuration; see [MonsterAIRule.xml](/docs/data/monster/monsterairule.md) and monster-skill configs                                             |

## Common Issues

* **Monster attacks but never approaches** - Element mapped to state 1 (MOVE) missing or its `Type` is not `11` (Chase).
* **Goal-move element lands the monster in a dead-end** - Type `12` ignores walkability; verify (`X`, `Y`) is reachable or provide a Crywolf-style path file.
* **Teleport always lands on the same tile** - Type `66` hard-codes (`X`, `Y`). Use multiple alternating elements with different Automata priorities for variety.
* **Immunity is permanent** - Type `64` with `X` or `Y` below 1 defaults to 10 ticks, not zero. Set explicit values, with 1 tick roughly 1 second.
* **Attack pattern always fires the same skill** - Type `67` rolls `TargetType`, then `X`, then `Y` in order. Lower the earlier percents or set them to 0 to let later skills fire.
* **AI change does nothing** - Type `68` needs a valid group in `TargetType` and an order (0-3) in `X` that points at a populated `StartAI` / `AI01` / `AI02` / `AI03` slot.
