GFCombatSystem¶
API Reference / Combat / 类索引
- 路径:
addons/gf/extensions/combat/core/gf_combat_system.gd - 模块:
Combat - 继承:
GFSystem - API:
public - 类别:运行时服务 (
runtime_service) - 首次版本:
3.17.0
战斗核心系统。 负责驱动所有注册实体的 Buff 计时、周期触发以及技能 CD 更新。 继承自 GFSystem,可通过架构的 tick 自动运行。
成员概览¶
| 类型 | 名称 | 签名 |
|---|---|---|
| 方法 | tick |
func tick(p_delta: float) -> void: |
| 方法 | dispose |
func dispose() -> void: |
| 方法 | register_entity |
func register_entity(p_entity: Object) -> void: |
| 方法 | unregister_entity |
func unregister_entity(p_entity: Object) -> void: |
| 方法 | add_buff |
func add_buff(p_entity: Object, p_buff: GFBuff) -> void: |
| 方法 | add_skill |
func add_skill(p_entity: Object, p_skill: GFSkill) -> void: |
| 方法 | get_buff |
func get_buff(p_entity: Object, p_buff_id: StringName) -> GFBuff: |
| 方法 | has_buff |
func has_buff(p_entity: Object, p_buff_id: StringName) -> bool: |
| 方法 | get_buffs |
func get_buffs(p_entity: Object) -> Array[GFBuff]: |
| 方法 | refresh_buff_modifiers |
func refresh_buff_modifiers(p_entity: Object, p_buff_id: StringName) -> bool: |
| 方法 | remove_buff |
func remove_buff(p_entity: Object, p_buff_id: StringName) -> bool: |
| 方法 | clear_buffs |
func clear_buffs(p_entity: Object, predicate: Callable = Callable()) -> int: |
| 方法 | remove_skill |
func remove_skill(p_entity: Object, p_skill: GFSkill) -> bool: |
方法¶
tick¶
- API:
public
推进运行时逻辑。
参数:
| 名称 | 说明 |
|---|---|
p_delta |
本帧时间增量(秒)。 |
dispose¶
- API:
public
释放系统持有的实体、Buff 与技能连接。
register_entity¶
- API:
public
注册战斗实体。
参数:
| 名称 | 说明 |
|---|---|
p_entity |
实体对象。 |
unregister_entity¶
- API:
public
注销战斗实体。
参数:
| 名称 | 说明 |
|---|---|
p_entity |
实体对象。 |
add_buff¶
- API:
public
给实体添加一个 Buff。
参数:
| 名称 | 说明 |
|---|---|
p_entity |
实体对象。 |
p_buff |
Buff 实例。 |
add_skill¶
- API:
public
为实体添加技能。
参数:
| 名称 | 说明 |
|---|---|
p_entity |
实体对象。 |
p_skill |
技能实例。 |
get_buff¶
- API:
public
获取实体上的指定 Buff。
参数:
| 名称 | 说明 |
|---|---|
p_entity |
实体对象。 |
p_buff_id |
Buff 标识。 |
返回:找到时返回正在系统中生效的 Buff 实例,否则返回 null。
has_buff¶
- API:
public
检查实体上是否存在指定 Buff。
参数:
| 名称 | 说明 |
|---|---|
p_entity |
实体对象。 |
p_buff_id |
Buff 标识。 |
返回:存在返回 true。
get_buffs¶
- API:
public
获取实体当前持有的 Buff 列表副本。
参数:
| 名称 | 说明 |
|---|---|
p_entity |
实体对象。 |
返回:Buff 实例数组副本;数组本身可安全修改,但元素仍是运行中的 Buff 引用。
refresh_buff_modifiers¶
- API:
public
强制刷新指定 Buff 已挂载修饰器影响到的属性。
参数:
| 名称 | 说明 |
|---|---|
p_entity |
实体对象。 |
p_buff_id |
Buff 标识。 |
返回:至少刷新了一个属性时返回 true。
remove_buff¶
- API:
public
移除实体上的指定 Buff。
参数:
| 名称 | 说明 |
|---|---|
p_entity |
实体对象。 |
p_buff_id |
Buff 标识。 |
返回:找到并移除 Buff 时返回 true。
clear_buffs¶
- API:
public
清理实体上的 Buff。predicate 为空时清理全部;否则仅清理返回 true 的 Buff。
参数:
| 名称 | 说明 |
|---|---|
p_entity |
实体对象。 |
predicate |
可选过滤回调,签名为 func(buff: GFBuff) -> bool。 |
返回:被清理的 Buff 数量。
remove_skill¶
- API:
public
移除实体上的指定技能。
参数:
| 名称 | 说明 |
|---|---|
p_entity |
实体对象。 |
p_skill |
技能实例。 |
返回:找到并移除技能时返回 true。