载入中...
搜索中...
未找到
eve::rpg::SkillSystem类 参考

#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.h20 行定义.

成员类型定义说明

◆ CastCondition

using eve::rpg::SkillSystem::CastCondition = std::function<bool(RPGActor *actor, const SkillDefinition &def, std::string &outReason)>

返回 false 表示禁止释放;通过 outReason 说明原因。

在文件 SkillSystem.h23 行定义.

成员函数说明

◆ beginCast()

bool eve::rpg::SkillSystem::beginCast ( RPGActor actor,
const std::string &  skillId,
RPGActor target = nullptr,
std::string *  reason = nullptr 
)
static

尝试释放技能:通过 canCast 检查后立即扣除消耗并进入冷却; castTime<=0 时立即结算(授予效果 + 产生 SkillCastEvent), 否则进入读条状态,由 update() 在读条结束时结算。

在文件 SkillSystem.cpp103 行定义.

引用了 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()

bool eve::rpg::SkillSystem::canCast ( RPGActor actor,
const std::string &  skillId,
std::string *  reason = nullptr 
)
static

检查冷却/消耗/学会状态/自定义条件,不产生任何副作用。

在文件 SkillSystem.cpp83 行定义.

引用了 eve::rpg::SkillRegistry::find(), getCooldownRemaining(), isCasting() , 以及 knows().

被这些函数引用 beginCast(), eve::rpg::RPGActor::canCastSkill() , 以及 eve::rpg::RPGActor::canCastSkillReason().

◆ cancelCast()

void eve::rpg::SkillSystem::cancelCast ( RPGActor actor)
static

打断当前读条(不退还已扣除的消耗/冷却)。

在文件 SkillSystem.cpp125 行定义.

被这些函数引用 eve::rpg::RPGActor::cancelCastSkill() , 以及 eve::rpg::resetRpgState().

◆ clearCastConditions()

void eve::rpg::SkillSystem::clearCastConditions ( )
static

在文件 SkillSystem.cpp53 行定义.

◆ forget()

bool eve::rpg::SkillSystem::forget ( RPGActor actor,
const std::string &  skillId 
)
static

在文件 SkillSystem.cpp66 行定义.

被这些函数引用 eve::rpg::RPGActor::forgetSkill().

◆ getCastingSkillId()

std::string eve::rpg::SkillSystem::getCastingSkillId ( RPGActor actor)
static

在文件 SkillSystem.cpp132 行定义.

被这些函数引用 eve::rpg::RPGActor::getCastingSkillId().

◆ getCastProgress()

float eve::rpg::SkillSystem::getCastProgress ( RPGActor actor)
static

0..1,非读条状态返回 0

在文件 SkillSystem.cpp136 行定义.

引用了 eve::rpg::CastingState::active, p, eve::rpg::CastingState::remaining , 以及 eve::rpg::CastingState::totalCastTime.

被这些函数引用 eve::rpg::RPGActor::getCastProgress().

◆ getCooldownRemaining()

float eve::rpg::SkillSystem::getCooldownRemaining ( RPGActor actor,
const std::string &  skillId 
)
static

在文件 SkillSystem.cpp71 行定义.

被这些函数引用 canCast() , 以及 eve::rpg::RPGActor::getSkillCooldown().

◆ isCasting()

bool eve::rpg::SkillSystem::isCasting ( RPGActor actor)
static

在文件 SkillSystem.cpp130 行定义.

被这些函数引用 canCast() , 以及 eve::rpg::RPGActor::isCastingSkill().

◆ knows()

bool eve::rpg::SkillSystem::knows ( RPGActor actor,
const std::string &  skillId 
)
static

在文件 SkillSystem.cpp60 行定义.

被这些函数引用 canCast(), eve::rpg::RPGActor::knowsSkill() , 以及 eve::rpg::restoreRpgState().

◆ learn()

void eve::rpg::SkillSystem::learn ( RPGActor actor,
const std::string &  skillId 
)
static

在文件 SkillSystem.cpp55 行定义.

被这些函数引用 eve::rpg::RPGActor::learnSkill().

◆ pollCastEvents()

void eve::rpg::SkillSystem::pollCastEvents ( std::vector< SkillCastEvent > &  out)
static

在文件 SkillSystem.cpp161 行定义.

被这些函数引用 eve::rpg::RPG::update().

◆ registerCastCondition()

void eve::rpg::SkillSystem::registerCastCondition ( const std::string &  name,
CastCondition  fn 
)
static

在文件 SkillSystem.cpp47 行定义.

引用了 fn , 以及 name.

◆ setCooldownRemaining()

void eve::rpg::SkillSystem::setCooldownRemaining ( RPGActor actor,
const std::string &  skillId,
float  seconds 
)
static

在文件 SkillSystem.cpp78 行定义.

被这些函数引用 beginCast(), eve::rpg::restoreRpgState() , 以及 eve::rpg::RPGActor::setSkillCooldown().

◆ unregisterCastCondition()

void eve::rpg::SkillSystem::unregisterCastCondition ( const std::string &  name)
static

在文件 SkillSystem.cpp51 行定义.

引用了 name.

◆ update()

void eve::rpg::SkillSystem::update ( float  dt)
static

该类的文档由以下文件生成: