当前资源系统:读写 RPGActor::Vitals 并发出事件。 @thread 调用线程应与 RPGActor 的 ECS 线程一致。 更多...
#include <VitalsSystem.h>
静态 Public 成员函数 | |
| static double | getCurrent (RPGActor *actor, const std::string &resource) |
| 当前值(无 vitals/资源时 0)。 | |
| static double | getMax (RPGActor *actor, const std::string &resource) |
| 上限:取 actor 同名最终属性(getFinalAttribute),无则 0。 | |
| static void | setCurrent (RPGActor *actor, const std::string &resource, double value) |
| 直接设定当前值,夹在 [0, max]。 | |
| static double | takeDamage (RPGActor *actor, const std::string &resource, double amount, const std::string &source="") |
| 造成伤害:current -= amount,下限 0;归零时发 death 事件。 | |
| static double | heal (RPGActor *actor, const std::string &resource, double amount) |
| 治疗:current += amount,上限 max。返回实际治疗量。 | |
| static void | publishSettledChange (RPGActor *actor, const std::string &resource, const std::string &action, double amount, const std::string &source="") |
| Publish resource events for a state change already committed by Settlement. | |
| static void | revive (RPGActor *actor, const std::string &resource, double amount=-1.0) |
| 复活:把资源设为 amount(默认当前上限),并清掉死亡状态。 | |
| static bool | isDead (RPGActor *actor, const std::string &resource) |
| 是否死亡:max > 0 且 current <= 0。 | |
| static void | pollEvents (std::vector< VitalsEvent > &out) |
| 取出并清空自上次调用以来累积的资源事件(push/poll 风格)。 | |
详细描述
当前资源系统:读写 RPGActor::Vitals 并发出事件。 @thread 调用线程应与 RPGActor 的 ECS 线程一致。
在文件 VitalsSystem.h 第 38 行定义.
成员函数说明
◆ getCurrent()
|
static |
当前值(无 vitals/资源时 0)。
在文件 VitalsSystem.cpp 第 30 行定义.
引用了 resource.
被这些函数引用 eve::rpg::RPGActor::getCurrent(), heal(), isDead(), publishSettledChange() , 以及 takeDamage().
◆ getMax()
|
static |
上限:取 actor 同名最终属性(getFinalAttribute),无则 0。
在文件 VitalsSystem.cpp 第 36 行定义.
引用了 eve::rpg::AttributeSystem::getFinal() , 以及 resource.
被这些函数引用 eve::rpg::RPGActor::getMax(), heal(), isDead(), publishSettledChange(), revive(), setCurrent() , 以及 takeDamage().
◆ heal()
|
static |
治疗:current += amount,上限 max。返回实际治疗量。
在文件 VitalsSystem.cpp 第 62 行定义.
引用了 current, getCurrent(), getMax(), max , 以及 resource.
被这些函数引用 eve::rpg::RPGActor::heal().
◆ isDead()
|
static |
是否死亡:max > 0 且 current <= 0。
在文件 VitalsSystem.cpp 第 94 行定义.
引用了 getCurrent(), getMax(), max , 以及 resource.
被这些函数引用 eve::rpg::Battle::executeNextAction(), eve::rpg::Battle::isActorAlive() , 以及 eve::rpg::RPGActor::isDead().
◆ pollEvents()
|
static |
◆ publishSettledChange()
|
static |
Publish resource events for a state change already committed by Settlement.
- 参数
-
actor Actor whose authoritative Vitals state has already changed. resource Resource that changed. action Either damageorheal.amount Applied non-negative magnitude. source Optional damage source identifier.
- 备注
- This does not mutate resource state. Call only after the settlement transaction succeeds. @thread Call on the actor's owning simulation thread. @reentrancy Does not invoke callbacks.
在文件 VitalsSystem.cpp 第 74 行定义.
引用了 action, current, getCurrent(), getMax(), maximum, resource , 以及 source.
被这些函数引用 eve::rpg::Battle::settleStatusTick().
◆ revive()
|
static |
复活:把资源设为 amount(默认当前上限),并清掉死亡状态。
在文件 VitalsSystem.cpp 第 85 行定义.
引用了 current, getMax(), max, resource , 以及 value.
被这些函数引用 eve::rpg::RPGActor::revive().
◆ setCurrent()
|
static |
直接设定当前值,夹在 [0, max]。
在文件 VitalsSystem.cpp 第 40 行定义.
引用了 getMax(), max, resource , 以及 value.
被这些函数引用 eve::rpg::RPGActor::setCurrent().
◆ takeDamage()
|
static |
造成伤害:current -= amount,下限 0;归零时发 death 事件。
- 返回
- 实际生效的伤害量(夹在 [0, currentBefore])。
在文件 VitalsSystem.cpp 第 46 行定义.
引用了 current, getCurrent(), getMax(), max, resource , 以及 source.
被这些函数引用 eve::rpg::RPGActor::takeDamage().
该类的文档由以下文件生成:
- src/modules/rpg/VitalsSystem.h
- src/modules/rpg/VitalsSystem.cpp