载入中...
搜索中...
未找到
RPGActor.cpp
浏览该文件的文档.
66std::string RPGActor::addAttributeModifier(const std::string &attribute, const std::string &source,
71bool RPGActor::removeAttributeModifier(const std::string &attribute, const std::string &modifierId) {
108bool RPGActor::hasEffect(const std::string &effectId) { return StatusSystem::hasEffect(this, effectId); }
120float RPGActor::getStatusRemaining(int index) { return StatusSystem::getActiveRemaining(this, index); }
122int RPGActor::getStatusInstanceId(int index) { return StatusSystem::getActiveInstanceId(this, index); }
124std::string RPGActor::getStatusSource(int index) { return StatusSystem::getActiveSource(this, index); }
180bool RPGActor::knowsSkill(const std::string &skillId) { return SkillSystem::knows(this, skillId); }
182bool RPGActor::forgetSkill(const std::string &skillId) { return SkillSystem::forget(this, skillId); }
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 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
bool beginCastSkill(const std::string &skillId, RPGActor *target=nullptr)
开始读条释放;false 表示不满足条件。
Definition RPGActor.cpp:202
double getBaseAttribute(const std::string &attribute)
Definition RPGActor.cpp:54
static const std::vector< RPGActor * > & liveActors()
返回所有通过 createActor() 创建、且当前仍存活的 actor。 StatusSystem::update / SkillSystem::update 用它遍历所有 actor 逐帧推进。 ...
Definition RPGActor.cpp:33
std::string canCastSkillReason(const std::string &skillId)
不能释放的原因("" = 可以)。
Definition RPGActor.cpp:196
std::string getStatusEffectId(int index)
Definition RPGActor.cpp:114
int removeAttributeModifiersBySource(const std::string &attribute, const std::string &source)
Definition RPGActor.cpp:75
int removeAllAttributeModifiersBySource(const std::string &source)
Definition RPGActor.cpp:80
static RPGActor * createActor()
创建一个空白 actor(三张表均为空,按需惰性写入),并纳入 liveActors() 跟踪。
Definition RPGActor.cpp:23
int removeStatusByTag(const std::string &tag)
Definition RPGActor.cpp:104
void setSkillCooldown(const std::string &skillId, float seconds)
Definition RPGActor.cpp:188
int removeStatusBySource(const std::string &source)
Definition RPGActor.cpp:100
std::string getBuffEffectId(int index)
Definition RPGActor.cpp:157
bool hasAttribute(const std::string &attribute)
Definition RPGActor.cpp:62
bool forgetSkill(const std::string &skillId)
Definition RPGActor.cpp:182
std::string getBuffProp(int instanceId, const std::string &key, const std::string &fallback={})
Definition RPGActor.cpp:167
int applyBuff(const std::string &effectId, const std::string &source="")
Buff 别名(与 Status API 等价,便于游戏侧按习惯命名)。
Definition RPGActor.cpp:135
bool canCastSkill(const std::string &skillId)
Definition RPGActor.cpp:192
void setBaseAttribute(const std::string &attribute, double value)
便捷成员方法(转发到 AttributeSystem / StatusSystem / SkillSystem)。 提供这一层薄封装主要是为了让脚本可以写 actor....
Definition RPGActor.cpp:50
void modifyBaseAttribute(const std::string &attribute, double delta)
Definition RPGActor.cpp:58
bool knowsSkill(const std::string &skillId)
Definition RPGActor.cpp:180
int removeBuffByEffect(const std::string &effectId)
Definition RPGActor.cpp:141
bool hasStatusTag(const std::string &tag)
Definition RPGActor.cpp:110
std::string addAttributeModifier(const std::string &attribute, const std::string &source, const std::string &op, double value, int priority=0)
Definition RPGActor.cpp:66
int removeStatusByEffect(const std::string &effectId)
Definition RPGActor.cpp:96
int removeBuffBySource(const std::string &source)
Definition RPGActor.cpp:145
bool setBuffProp(int instanceId, const std::string &key, const std::string &value)
Definition RPGActor.cpp:172
int getStatusInstanceId(int index)
Definition RPGActor.cpp:122
bool setStatusProp(int instanceId, const std::string &key, const std::string &value)
Definition RPGActor.cpp:131
std::string getStatusSource(int index)
Definition RPGActor.cpp:124
double getFinalAttribute(const std::string &attribute)
Definition RPGActor.cpp:84
std::string getStatusProp(int instanceId, const std::string &key, const std::string &fallback={})
Definition RPGActor.cpp:126
float getStatusRemaining(int index)
Definition RPGActor.cpp:120
int applyEffect(const std::string &effectId, const std::string &source="")
状态(buff/debuff)—— Statuses ECS 组件的薄封装。
Definition RPGActor.cpp:90
int removeBuffByTag(const std::string &tag)
Definition RPGActor.cpp:149
float getSkillCooldown(const std::string &skillId)
Definition RPGActor.cpp:184
bool removeAttributeModifier(const std::string &attribute, const std::string &modifierId)
Definition RPGActor.cpp:71
static bool forget(RPGActor *actor, const std::string &skillId)
Definition SkillSystem.cpp:66
static std::string getCastingSkillId(RPGActor *actor)
Definition SkillSystem.cpp:132
static void setCooldownRemaining(RPGActor *actor, const std::string &skillId, float seconds)
Definition SkillSystem.cpp:78
static bool isCasting(RPGActor *actor)
Definition SkillSystem.cpp:130
static float getCooldownRemaining(RPGActor *actor, const std::string &skillId)
Definition SkillSystem.cpp:71
static void learn(RPGActor *actor, const std::string &skillId)
Definition SkillSystem.cpp:55
static bool knows(RPGActor *actor, const std::string &skillId)
Definition SkillSystem.cpp:60
static bool canCast(RPGActor *actor, const std::string &skillId, std::string *reason=nullptr)
检查冷却/消耗/学会状态/自定义条件,不产生任何副作用。
Definition SkillSystem.cpp:83
static bool beginCast(RPGActor *actor, const std::string &skillId, RPGActor *target=nullptr, std::string *reason=nullptr)
尝试释放技能:通过 canCast 检查后立即扣除消耗并进入冷却; castTime<=0 时立即结算(授予效果 + 产生 SkillCastEvent), 否则进入读条状态,由 update() 在读...
Definition SkillSystem.cpp:103
static bool setProp(RPGActor *actor, int instanceId, const std::string &key, const std::string &value)
Definition StatusSystem.cpp:423
static std::string getActiveSource(RPGActor *actor, int index)
Definition StatusSystem.cpp:408
static int apply(RPGActor *actor, const std::string &effectId, const std::string &source="")
施加一个效果。返回值: -1 — 失败(actor 为空 / 效果不存在 / 条件拒绝 / stackPolicy 拒绝重复) 0 — durationPolicy=="instant":已立即生效,无...
Definition StatusSystem.cpp:118
static int getActiveStacks(RPGActor *actor, int index)
Definition StatusSystem.cpp:387
static int getActiveInstanceId(RPGActor *actor, int index)
Definition StatusSystem.cpp:401
static bool hasEffect(RPGActor *actor, const std::string &effectId)
Definition StatusSystem.cpp:358
static bool hasTag(RPGActor *actor, const std::string &tag)
是否存在任一效果定义带有该 tag 的活动实例。
Definition StatusSystem.cpp:366
static int removeBySource(RPGActor *actor, const std::string &source)
移除该 actor 身上所有 source 匹配的实例;返回移除数量。
Definition StatusSystem.cpp:309
static bool remove(RPGActor *actor, int instanceId)
按实例 id 精确移除(撤销其属性修改器);返回是否命中。
Definition StatusSystem.cpp:264
static int getActiveCount(RPGActor *actor)
Definition StatusSystem.cpp:375
static std::string getProp(RPGActor *actor, int instanceId, const std::string &key, const std::string &fallback={})
按实例 id 读写 props;找不到实例时 get 返回 fallback,set 返回 false。
Definition StatusSystem.cpp:415
static int removeByEffect(RPGActor *actor, const std::string &effectId)
移除该 actor 身上所有 effectId 匹配的实例;返回移除数量。
Definition StatusSystem.cpp:285
static int removeByTag(RPGActor *actor, const std::string &tag)
移除该 actor 身上所有 tag 匹配(效果定义带该 tag)的实例;返回移除数量。
Definition StatusSystem.cpp:333
static std::string getActiveEffectId(RPGActor *actor, int index)
Definition StatusSystem.cpp:380
static float getActiveRemaining(RPGActor *actor, int index)
Definition StatusSystem.cpp:394