载入中...
搜索中...
未找到
AttributeSystem.h
浏览该文件的文档.
自定义 op 注册表:opName -> f(currentResult, modifierValue) -> newResult。
Definition AttributeSystem.h:22
bool has(const std::string &name) const
Definition AttributeSystem.cpp:13
void unregisterOp(const std::string &name)
Definition AttributeSystem.cpp:11
void registerOp(const std::string &name, Fn fn)
Definition AttributeSystem.cpp:9
std::function< double(double current, double value)> Fn
Definition AttributeSystem.h:24
double apply(const std::string &name, double current, double value) const
Definition AttributeSystem.cpp:15
面向 RPGActor 的属性操作静态入口。数据本身存放在 RPGActor::Attributes 组件里, 这里只是围绕组件的一组无状态操作函数(+ 一张全局自定义 op 表)。
Definition AttributeSystem.h:39
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 为空)。
Definition AttributeSystem.cpp:102
static void setBase(RPGActor *actor, const std::string &attribute, double value)
设置基础值(不存在则创建该属性)。
Definition AttributeSystem.cpp:75
static bool removeModifier(RPGActor *actor, const std::string &attribute, const std::string &modifierId)
按 id 精确移除;返回是否命中。
Definition AttributeSystem.cpp:119
static bool hasAttribute(RPGActor *actor, const std::string &attribute)
Definition AttributeSystem.cpp:96
static void modifyBase(RPGActor *actor, const std::string &attribute, double delta)
增量修改基础值(如自然回蓝、升级加点)。
Definition AttributeSystem.cpp:89
static void invalidate(RPGActor *actor, const std::string &attribute)
标记某个属性需要在下次 getFinal 时重新计算(内部使用;一般不需要手动调用)。
Definition AttributeSystem.cpp:178
static double getBase(RPGActor *actor, const std::string &attribute)
Definition AttributeSystem.cpp:82
static int removeAllModifiersBySource(RPGActor *actor, const std::string &source)
按来源标签批量移除该 actor 所有属性上的修改器;返回移除数量。
Definition AttributeSystem.cpp:150
static double getFinal(RPGActor *actor, const std::string &attribute)
计算并返回最终值(内部带缓存,属性未变化时不会重复计算)。
Definition AttributeSystem.cpp:168
static int removeModifiersBySource(RPGActor *actor, const std::string &attribute, const std::string &source)
按来源标签批量移除某个属性上的修改器;返回移除数量。
Definition AttributeSystem.cpp:134