面向 RPGActor 的属性操作静态入口。数据本身存放在 RPGActor::Attributes 组件里, 这里只是围绕组件的一组无状态操作函数(+ 一张全局自定义 op 表)。
更多...
#include <AttributeSystem.h>
|
| static AttributeOpTable & | customOps () |
| | 全局自定义 op 注册表(进程生命周期内有效)。
|
| |
| static void | setBase (RPGActor *actor, const std::string &attribute, double value) |
| | 设置基础值(不存在则创建该属性)。
|
| |
| static double | getBase (RPGActor *actor, const std::string &attribute) |
| |
| static void | modifyBase (RPGActor *actor, const std::string &attribute, double delta) |
| | 增量修改基础值(如自然回蓝、升级加点)。
|
| |
| static bool | hasAttribute (RPGActor *actor, const std::string &attribute) |
| |
| static std::string | addModifier (RPGActor *actor, const std::string &attribute, const std::string &source, const std::string &op, double value, int priority=0) |
| | 添加一条修改器,返回自动生成的唯一 id(用于之后精确移除)。 空字符串 id 表示失败(actor 为空)。
|
| |
| static bool | removeModifier (RPGActor *actor, const std::string &attribute, const std::string &modifierId) |
| | 按 id 精确移除;返回是否命中。
|
| |
| static int | removeModifiersBySource (RPGActor *actor, const std::string &attribute, const std::string &source) |
| | 按来源标签批量移除某个属性上的修改器;返回移除数量。
|
| |
| static int | removeAllModifiersBySource (RPGActor *actor, const std::string &source) |
| | 按来源标签批量移除该 actor 所有属性上的修改器;返回移除数量。
|
| |
| static double | getFinal (RPGActor *actor, const std::string &attribute) |
| | 计算并返回最终值(内部带缓存,属性未变化时不会重复计算)。
|
| |
| static void | invalidate (RPGActor *actor, const std::string &attribute) |
| | 标记某个属性需要在下次 getFinal 时重新计算(内部使用;一般不需要手动调用)。
|
| |
面向 RPGActor 的属性操作静态入口。数据本身存放在 RPGActor::Attributes 组件里, 这里只是围绕组件的一组无状态操作函数(+ 一张全局自定义 op 表)。
在文件 AttributeSystem.h 第 39 行定义.
◆ addModifier()
| std::string eve::rpg::AttributeSystem::addModifier |
( |
RPGActor * |
actor, |
|
|
const std::string & |
attribute, |
|
|
const std::string & |
source, |
|
|
const std::string & |
op, |
|
|
double |
value, |
|
|
int |
priority = 0 |
|
) |
| |
|
static |
◆ customOps()
◆ getBase()
| double eve::rpg::AttributeSystem::getBase |
( |
RPGActor * |
actor, |
|
|
const std::string & |
attribute |
|
) |
| |
|
static |
◆ getFinal()
| double eve::rpg::AttributeSystem::getFinal |
( |
RPGActor * |
actor, |
|
|
const std::string & |
attribute |
|
) |
| |
|
static |
◆ hasAttribute()
| bool eve::rpg::AttributeSystem::hasAttribute |
( |
RPGActor * |
actor, |
|
|
const std::string & |
attribute |
|
) |
| |
|
static |
◆ invalidate()
| void eve::rpg::AttributeSystem::invalidate |
( |
RPGActor * |
actor, |
|
|
const std::string & |
attribute |
|
) |
| |
|
static |
◆ modifyBase()
| void eve::rpg::AttributeSystem::modifyBase |
( |
RPGActor * |
actor, |
|
|
const std::string & |
attribute, |
|
|
double |
delta |
|
) |
| |
|
static |
◆ removeAllModifiersBySource()
| int eve::rpg::AttributeSystem::removeAllModifiersBySource |
( |
RPGActor * |
actor, |
|
|
const std::string & |
source |
|
) |
| |
|
static |
◆ removeModifier()
| bool eve::rpg::AttributeSystem::removeModifier |
( |
RPGActor * |
actor, |
|
|
const std::string & |
attribute, |
|
|
const std::string & |
modifierId |
|
) |
| |
|
static |
◆ removeModifiersBySource()
| int eve::rpg::AttributeSystem::removeModifiersBySource |
( |
RPGActor * |
actor, |
|
|
const std::string & |
attribute, |
|
|
const std::string & |
source |
|
) |
| |
|
static |
◆ setBase()
| void eve::rpg::AttributeSystem::setBase |
( |
RPGActor * |
actor, |
|
|
const std::string & |
attribute, |
|
|
double |
value |
|
) |
| |
|
static |
该类的文档由以下文件生成: