# 自定义小兵

## 什么是自定义小兵？

自定义小兵是一些很强大的自定义怪物召唤的一种生物，其实本质上还是自定义怪物，它们的作用是让游戏增加一些难度。

## 示例小兵

首先，我们需要进行如下步骤：

1. 创建将会生成小兵的自定义怪物，下文直接称之为 BOSS。
2. 再创建小兵的自定义怪物。
3. 在 BOSS 的怪物配置文件中设置小兵属性。

### 设置小兵属性

你刚刚创建的 BOSS 怪物配置文件应该如下所示：

```
isEnabled: true
entityType: ENDER_DRAGON
name: $eventBossLevel &eBinder of Worlds
level: 200
powers:
- ender_dragon_arrow_bombardment.yml
```

我们可以在能力（powers）选项下再新增如下的能力：

```
- summonable:summonType=ON_COMBAT_ENTER:filename=binder_of_worlds_phase_1_parkour_reinforcement.yml
```

这时你的 BOSS 配置文件应该像这样：

```
isEnabled: true
entityType: ENDER_DRAGON
name: $eventBossLevel &eBinder of Worlds
level: 200
powers:
- ender_dragon_arrow_bombardment.yml
- summonable:summonType=ON_COMBAT_ENTER:filename=binder_of_worlds_phase_1_parkour_reinforcement.yml
```

现在我们就已经真的做好一个小兵了，但是你会发现你还是一头雾水，别急，下面将一一介绍。

## 配置组成

我们可以看到我们新增的有关小兵一行能力由如下字段组成，每个字段使用 `;` 符号分开，字段的键与值使用 `=` 符号分开，如果没有值则不需要：

### 必须字段

#### summonable

&#x20;`summonable` 只是代表让 EliteMobs 知道这一行能力是 BOSS 召唤小兵，它是必须的。

#### summonType

`summonType=生成类型` **是代表小兵召唤类型，可以填写：**

* `summonType=ONCE` 在第一次击打 BOSS 时召唤。
* `summonType=ON_HIT` 每次击打 BOSS 都会召唤。
* `summonType=ON_COMBAT_ENTER` 当 BOSS 进入战斗状态时召唤。
* `summonType=ON_COMBAT_ENTER_PLACE_CRYSTAL` 当 BOSS 进入战斗放置末影水晶（只是给末影龙使用的）。

*进入战斗状态往往在游戏内表现为玩家进入 BOSS 的感应范围内后。*

#### filename

`filename=filename.yml` **是代表小兵的自定义怪物文件，但当** `summonType=ON_COMBAT_ENTER_PLACE_CRYSTAL` **时此字段不需要，因为这时已经指代生成“末影水晶”小兵。**

### 可选字段

#### chance

`chance=浮点类型选项` 是代表召唤小兵的几率，只在 `summonType` 为 `ONCE` 或者 `ON_HIT` 时生效。例如 `chance=0.2` 代表有 20% 几率召唤小兵。

#### location

`location=x,y,z` 是代表小兵召唤位置的较于 BOSS 当前的偏移坐标。

* 对于非区域 BOSS，则较于 BOSS 的当前坐标的偏移。例如当你设置为 `location=0,10,0` 时代表在 BOSS 当前位置上方 10 格召唤小兵，不是在世界坐标 0,10,0 位置召唤小兵！
* 对于区域 BOSS，则较于 BOSS 的生成位置点坐标。同样是上面示例，这时则代表在 BOSS 生成位置点的坐标。
* 对于末影龙，始终是四周的塔生成小兵。

#### lightningRod

`lightningRod=布尔值类型选项` 是代表末影水晶爆炸是否有一定的延迟时间，只在 `summonType=ON_COMBAT_ENTER_PLACE_CRYSTAL` 时有效。

#### inheritAggro

`inheritAggro=布尔值类型选项` 是代表小兵是否主动攻击对 BOSS 威胁最大的玩家。

#### amount

`amount=整数类型选项` 是代表召唤小兵的数量。

#### spawnNearby

`spawnNearby=布尔值类型选项` 是代表是否在 BOSS 周围生成小兵而不是上面的固定偏移位置，这可以有效解决因设置错误导致小兵卡墙问题。

#### inheritLevel

`inheritLevel=布尔值类型选项` 是代表小兵是否继承 BOSS 的怪物等级。

#### 示例

```
isEnabled: true
entityType: ENDER_DRAGON
name: $eventBossLevel &eBinder of Worlds
level: 200
powers:
- ender_dragon_arrow_bombardment.yml
- summonable:summonType=ON_COMBAT_ENTER:filename=test_boss.yml:spawnNearby=true:inheritAggro=true:inheritLevel=true
- summonable:summonType=ON_COMBAT_ENTER_PLACE_CRYSTAL:location=-80,10,0:lightningRod=true
```


---

# 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://docs.superiormc.cn/elitemobs-wiki/pei-zhi/zi-ding-yi-xiao-bing.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.
