成长系统:读写 RPGActor::Progression 并驱动升级事件。 @thread 调用线程应与 RPGActor 的 ECS 线程一致。 更多...
#include <LevelSystem.h>
静态 Public 成员函数 | |
| static int | getLevel (RPGActor *actor) |
| 当前等级(无 progression 时返回 1)。 | |
| static double | getXp (RPGActor *actor) |
| 当前经验。 | |
| static double | getXpToNext (RPGActor *actor) |
| 升级所需经验。 | |
| static void | setXpToNext (RPGActor *actor, double value) |
| 设置当前等级的升级阈值。 | |
| static void | setLevel (RPGActor *actor, int level) |
| 直接设定等级(不改经验;用于读档/初始化)。 | |
| static eve::Result< void > | restoreProgression (RPGActor *actor, int level, double xp, double xpToNext) |
| Atomically restore one validated progression checkpoint. | |
| static bool | gainXp (RPGActor *actor, double amount, double xpGrowth=1.2) |
| 增加经验;每跨过阈值升一级并发出 LevelUpEvent(compatibility facade (脚本兼容门面))。 | |
| static eve::Result< PreparedProgressionGain > | prepareGainXp (RPGActor *actor, double amount, double xpGrowth=1.2) |
| Validate an XP gain and calculate its complete progression candidate without mutation/events. | |
| static eve::Result< int > | commitGainXp (PreparedProgressionGain prepared) |
| Commit a prepared XP gain if actor progression is still unchanged. | |
| static void | pollLevelUps (std::vector< LevelUpEvent > &out) |
| 取出并清空自上次调用以来累积的升级事件(push/poll 风格)。 | |
详细描述
成长系统:读写 RPGActor::Progression 并驱动升级事件。 @thread 调用线程应与 RPGActor 的 ECS 线程一致。
在文件 LevelSystem.h 第 54 行定义.
成员函数说明
◆ commitGainXp()
|
static |
Commit a prepared XP gain if actor progression is still unchanged.
- 返回
- Number of levels gained, or Conflict without mutation/events.
- 备注
- Progression is committed before level-up events are queued. @thread Same actor-owning thread used for preparation. @reentrancy No callbacks are invoked; events are poll-only.
在文件 LevelSystem.cpp 第 113 行定义.
引用了 eve::rpg::LevelUpEvent::actor, eve::Applied, eve::Conflict, current, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, offset, eve::Status::success() , 以及 eve::Result< T >::success().
被这些函数引用 gainXp() , 以及 eve::rpg::BattleVictory::settle().
◆ gainXp()
|
static |
增加经验;每跨过阈值升一级并发出 LevelUpEvent(compatibility facade (脚本兼容门面))。
- 返回
- 是否至少升了一级。
- 参数
-
xpGrowth 每级阈值增长比例(默认 1.2)。
在文件 LevelSystem.cpp 第 60 行定义.
引用了 commitGainXp() , 以及 prepareGainXp().
被这些函数引用 eve::rpg::RPGActor::gainXp().
◆ getLevel()
|
static |
当前等级(无 progression 时返回 1)。
在文件 LevelSystem.cpp 第 16 行定义.
被这些函数引用 eve::rpg::ClassSystem::checkLevelSkills() , 以及 eve::rpg::RPGActor::getLevel().
◆ getXp()
|
static |
◆ getXpToNext()
|
static |
◆ pollLevelUps()
|
static |
◆ prepareGainXp()
|
static |
Validate an XP gain and calculate its complete progression candidate without mutation/events.
- 返回
- Prepared candidate, or a structured finite/range failure. @thread Actor owning ECS simulation thread. @reentrancy No callbacks or events are emitted.
在文件 LevelSystem.cpp 第 67 行定义.
引用了 current, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::InvariantViolation, eve::Pending, eve::PreconditionViolation, eve::Status::success() , 以及 eve::Result< T >::success().
被这些函数引用 gainXp() , 以及 eve::rpg::BattleVictory::settle().
◆ restoreProgression()
|
static |
Atomically restore one validated progression checkpoint.
- 参数
-
actor Borrowed actor owned by the ECS world. level Positive level. xp Finite, non-negative progress below xpToNext. xpToNext Finite positive threshold for the current level.
- 返回
- Applied state, or a structured validation failure with no mutation. @thread Call on the actor's owning ECS simulation thread. @reentrancy No callbacks or level-up events are emitted.
在文件 LevelSystem.cpp 第 38 行定义.
引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, level, eve::Status::success() , 以及 eve::Result< T >::success().
◆ setLevel()
|
static |
◆ setXpToNext()
|
static |
该类的文档由以下文件生成:
- src/modules/rpg/LevelSystem.h
- src/modules/rpg/LevelSystem.cpp