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

EVENGINE_API_PLATFORM public API. 更多...

#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)
 Registers cast condition.
 
static void unregisterCastCondition (const std::string &name)
 Unregisters cast condition.
 
static void clearCastConditions ()
 Clears cast conditions.
 
static void learn (RPGActor *actor, const std::string &skillId)
 Learn.
 
static bool knows (RPGActor *actor, const std::string &skillId)
 Knows.
 
static bool forget (RPGActor *actor, const std::string &skillId)
 Forget.
 
static std::string getTargetType (RPGActor *actor, const std::string &skillId)
 技能的目标类型字符串("" 表示未学会/未知)。
 
static float getCooldownRemaining (RPGActor *actor, const std::string &skillId)
 Returns the cooldown remaining.
 
static void setCooldownRemaining (RPGActor *actor, const std::string &skillId, float seconds)
 Sets the cooldown remaining.
 
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)
 True when casting.
 
static std::string getCastingSkillId (RPGActor *actor)
 Returns the casting skill id.
 
static float getCastProgress (RPGActor *actor)
 Returns the cast progress.
 
static void update (float dt)
 遍历 RPGActor::liveActors():冷却倒计时 + 读条推进/结算。
 
static void pollCastEvents (std::vector< SkillCastEvent > &out)
 Polls cast events.
 

详细描述

EVENGINE_API_PLATFORM public API.

在文件 SkillSystem.h 第 23 行定义.

成员类型定义说明

◆ CastCondition

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

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

在文件 SkillSystem.h 第 26 行定义.

成员函数说明

◆ 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.cpp 第 117 行定义.

引用了 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, target, 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

◆ cancelCast()

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

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

在文件 SkillSystem.cpp 第 139 行定义.

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

◆ clearCastConditions()

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

Clears cast conditions.

在文件 SkillSystem.cpp 第 59 行定义.

◆ forget()

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

Forget.

在文件 SkillSystem.cpp 第 72 行定义.

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

◆ getCastingSkillId()

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

Returns the casting skill id.

在文件 SkillSystem.cpp 第 146 行定义.

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

◆ getCastProgress()

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

Returns the cast progress.

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

在文件 SkillSystem.cpp 第 150 行定义.

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

Returns the cooldown remaining.

在文件 SkillSystem.cpp 第 83 行定义.

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

◆ getTargetType()

std::string eve::rpg::SkillSystem::getTargetType ( RPGActor *  actor,
const std::string &  skillId 
)
static

技能的目标类型字符串("" 表示未学会/未知)。

在文件 SkillSystem.cpp 第 77 行定义.

引用了 eve::rpg::SkillRegistry::find(), knows() , 以及 eve::rpg::SkillDefinition::targetType.

被这些函数引用 eve::rpg::Battle::executeNextAction() , 以及 eve::rpg::Battle::setActionChecked().

◆ isCasting()

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

True when casting.

在文件 SkillSystem.cpp 第 144 行定义.

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

◆ knows()

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

◆ learn()

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

Learn.

在文件 SkillSystem.cpp 第 61 行定义.

被这些函数引用 eve::rpg::ClassSystem::checkLevelSkills() , 以及 eve::rpg::RPGActor::learnSkill().

◆ pollCastEvents()

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

Polls cast events.

在文件 SkillSystem.cpp 第 175 行定义.

引用了 q.

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

◆ registerCastCondition()

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

Registers cast condition.

在文件 SkillSystem.cpp 第 53 行定义.

引用了 fn , 以及 name.

◆ setCooldownRemaining()

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

Sets the cooldown remaining.

在文件 SkillSystem.cpp 第 90 行定义.

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

◆ unregisterCastCondition()

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

Unregisters cast condition.

在文件 SkillSystem.cpp 第 57 行定义.

引用了 name.

◆ update()

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

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