#include <SkillSystem.h>
Public 类型 | |
| using | CastCondition = std::function< bool(RPGActor *actor, const SkillDefinition &def, std::string &outReason)> |
| 返回 false 表示禁止释放;通过 outReason 说明原因。 | |
静态 Public 成员函数 | |
| static void | registerCastCondition (const std::string &name, CastCondition fn) |
| static void | unregisterCastCondition (const std::string &name) |
| static void | clearCastConditions () |
| static void | learn (RPGActor *actor, const std::string &skillId) |
| static bool | knows (RPGActor *actor, const std::string &skillId) |
| static bool | forget (RPGActor *actor, const std::string &skillId) |
| static float | getCooldownRemaining (RPGActor *actor, const std::string &skillId) |
| static void | setCooldownRemaining (RPGActor *actor, const std::string &skillId, float seconds) |
| static bool | canCast (RPGActor *actor, const std::string &skillId, std::string *reason=nullptr) |
| 检查冷却/消耗/学会状态/自定义条件,不产生任何副作用。 | |
| static bool | beginCast (RPGActor *actor, const std::string &skillId, RPGActor *target=nullptr, std::string *reason=nullptr) |
| 尝试释放技能:通过 canCast 检查后立即扣除消耗并进入冷却; castTime<=0 时立即结算(授予效果 + 产生 SkillCastEvent), 否则进入读条状态,由 update() 在读条结束时结算。 | |
| static void | cancelCast (RPGActor *actor) |
| 打断当前读条(不退还已扣除的消耗/冷却)。 | |
| static bool | isCasting (RPGActor *actor) |
| static std::string | getCastingSkillId (RPGActor *actor) |
| static float | getCastProgress (RPGActor *actor) |
| 0..1,非读条状态返回 0 | |
| static void | update (float dt) |
| 遍历 RPGActor::liveActors():冷却倒计时 + 读条推进/结算。 | |
| static void | pollCastEvents (std::vector< SkillCastEvent > &out) |
详细描述
在文件 SkillSystem.h 第 20 行定义.
成员类型定义说明
◆ CastCondition
| using eve::rpg::SkillSystem::CastCondition = std::function<bool(RPGActor *actor, const SkillDefinition &def, std::string &outReason)> |
返回 false 表示禁止释放;通过 outReason 说明原因。
在文件 SkillSystem.h 第 23 行定义.
成员函数说明
◆ beginCast()
|
static |
尝试释放技能:通过 canCast 检查后立即扣除消耗并进入冷却; castTime<=0 时立即结算(授予效果 + 产生 SkillCastEvent), 否则进入读条状态,由 update() 在读条结束时结算。
在文件 SkillSystem.cpp 第 103 行定义.
引用了 eve::rpg::CastingState::active, canCast(), eve::rpg::SkillDefinition::castTime, eve::rpg::SkillDefinition::cooldown, eve::rpg::SkillRegistry::find(), eve::rpg::CastingState::remaining, setCooldownRemaining(), eve::rpg::CastingState::skillId, eve::rpg::CastingState::target , 以及 eve::rpg::CastingState::totalCastTime.
被这些函数引用 eve::rpg::RPGActor::beginCastSkill().
◆ canCast()
|
static |
检查冷却/消耗/学会状态/自定义条件,不产生任何副作用。
在文件 SkillSystem.cpp 第 83 行定义.
引用了 eve::rpg::SkillRegistry::find(), getCooldownRemaining(), isCasting() , 以及 knows().
被这些函数引用 beginCast(), eve::rpg::RPGActor::canCastSkill() , 以及 eve::rpg::RPGActor::canCastSkillReason().
◆ cancelCast()
|
static |
打断当前读条(不退还已扣除的消耗/冷却)。
在文件 SkillSystem.cpp 第 125 行定义.
被这些函数引用 eve::rpg::RPGActor::cancelCastSkill() , 以及 eve::rpg::resetRpgState().
◆ clearCastConditions()
|
static |
在文件 SkillSystem.cpp 第 53 行定义.
◆ forget()
|
static |
在文件 SkillSystem.cpp 第 66 行定义.
被这些函数引用 eve::rpg::RPGActor::forgetSkill().
◆ getCastingSkillId()
|
static |
在文件 SkillSystem.cpp 第 132 行定义.
◆ getCastProgress()
|
static |
0..1,非读条状态返回 0
在文件 SkillSystem.cpp 第 136 行定义.
引用了 eve::rpg::CastingState::active, p, eve::rpg::CastingState::remaining , 以及 eve::rpg::CastingState::totalCastTime.
◆ getCooldownRemaining()
|
static |
在文件 SkillSystem.cpp 第 71 行定义.
被这些函数引用 canCast() , 以及 eve::rpg::RPGActor::getSkillCooldown().
◆ isCasting()
|
static |
在文件 SkillSystem.cpp 第 130 行定义.
被这些函数引用 canCast() , 以及 eve::rpg::RPGActor::isCastingSkill().
◆ knows()
|
static |
在文件 SkillSystem.cpp 第 60 行定义.
被这些函数引用 canCast(), eve::rpg::RPGActor::knowsSkill() , 以及 eve::rpg::restoreRpgState().
◆ learn()
|
static |
在文件 SkillSystem.cpp 第 55 行定义.
被这些函数引用 eve::rpg::RPGActor::learnSkill().
◆ pollCastEvents()
|
static |
在文件 SkillSystem.cpp 第 161 行定义.
被这些函数引用 eve::rpg::RPG::update().
◆ registerCastCondition()
|
static |
在文件 SkillSystem.cpp 第 47 行定义.
◆ setCooldownRemaining()
|
static |
在文件 SkillSystem.cpp 第 78 行定义.
被这些函数引用 beginCast(), eve::rpg::restoreRpgState() , 以及 eve::rpg::RPGActor::setSkillCooldown().
◆ unregisterCastCondition()
|
static |
在文件 SkillSystem.cpp 第 51 行定义.
引用了 name.
◆ update()
|
static |
遍历 RPGActor::liveActors():冷却倒计时 + 读条推进/结算。
在文件 SkillSystem.cpp 第 144 行定义.
引用了 eve::rpg::CastingState::active, eve::rpg::SkillRegistry::find(), eve::rpg::RPGActor::liveActors(), eve::rpg::CastingState::remaining, eve::rpg::CastingState::skillId , 以及 eve::rpg::CastingState::target.
被这些函数引用 eve::rpg::RPG::update().
该类的文档由以下文件生成:
- src/modules/rpg/SkillSystem.h
- src/modules/rpg/SkillSystem.cpp