first commit

This commit is contained in:
boybook
2025-03-17 13:24:39 +08:00
commit 9a0334ee84
6410 changed files with 221907 additions and 0 deletions

View File

@@ -0,0 +1,110 @@
---
sidebarDepth: 1
---
# 状态效果
## AddEffectToEntity
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.effectCompServer.EffectComponentServer
- 描述
为实体添加指定状态效果如果添加的状态已存在则有以下集中情况1、等级大于已存在则更新状态等级及持续时间2、状态等级相等且剩余时间duration大于已存在则刷新剩余时间3、等级小于已存在则不做修改4、粒子效果以新的为准
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| effectName | str | 状态效果名称字符串包括自定义状态效果和原版状态效果原版状态效果可在wiki查询 |
| duration | int | 状态效果持续时间,单位秒 |
| amplifier | int | 状态效果的额外等级。必须在0至255之间。若未指定默认为0。注意状态效果的第一级如生命恢复 I对应为0因此第二级状态效果如生命回复 II应指定强度为1。部分效果及自定义状态效果没有强度之分如夜视 |
| showParticles | bool | 是否显示粒子效果True显示False不显示 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | True表示设置成功 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateEffect(entityId)
res = comp.AddEffectToEntity("speed", 30, 2, True)
```
## GetAllEffects
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.effectCompServer.EffectComponentServer
- 描述
获取实体当前所有状态效果
- 参数
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| list(dict) | 状态效果信息字典的list |
- 备注
- 状态效果信息字典 effectDict
| 关键字 | 数据类型 | 说明 |
| ----------| --------------------- | ---------|
| effectName | str | 状态效果名称 |
| duration | int | 状态效果剩余持续时间,单位秒 |
| amplifier | int | 状态效果额外等级 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateEffect(entityId)
effectDictList = comp.GetAllEffects()
```
## RemoveEffectFromEntity
<span style="display:inline;color:#ff5555">服务端</span>
method in mod.server.component.effectCompServer.EffectComponentServer
- 描述
为实体删除指定状态效果
- 参数
| 参数名 | <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- | :--- |
| effectName | str | 状态效果名称字符串包括自定义状态效果和原版状态效果原版状态效果可在wiki查询 |
- 返回值
| <div style="width: 4em">数据类型</div> | 说明 |
| :--- | :--- |
| bool | True表示删除成功 |
- 示例
```python
import mod.server.extraServerApi as serverApi
comp = serverApi.GetEngineCompFactory().CreateEffect(entityId)
res = comp.RemoveEffectFromEntity("speed")
```