调用方式
addon.Platform:GetHealthForecastTimeObservation()
可直接通过 addon 使用,无需依赖项。
作用
为所需的生命值预测重新观测一次受保护的无参数 GetTime。要求结果可读且为有限数字;保留带符号和小数值,不额外加入单调、整数或非负的限制。不使用时钟缓存或额外的原生查询。
参数
| 名称 | 类型 | 作用 |
|---|---|---|
self | RMPlatform | Rotation Master 平台适配器(使用冒号调用时隐含传入)。 |
返回值
| 1 | number | nil | 全新的可读有限时钟;不可用时为 nil。 |
|---|---|---|
| 2 | string | nil | 能力或时钟观测的可用性原因。 |
版本
内置辅助函数在每个版本上都会注册。不同的是它们读取的游戏 API;某个 API 缺失时,辅助函数会改用后备方案,或返回 nil 并附上原因。
- 该版本不可用(原因见提示)
- 仅在暴雪的弃用兼容层开启时
| 游戏 API | |||||
|---|---|---|---|---|---|
GetTime | |||||
canaccessvalue |
秘密值(正式服和永久服)
在正式服和永久服上,游戏交给插件的是秘密值。此辅助函数会检查它读取的内容(addon.Platform:CanReadValue),遇到无法比较的秘密值时返回 nil 并附上原因(例如 restricted-value),而不是返回该秘密值。请将 nil 视为不可用,而不是假。
示例
local now = addon.Platform:GetHealthForecastTimeObservation()
-- value.deadline: a GetTime() timestamp chosen in the condition editor
if not now or type(value.deadline) ~= "number" then return nil end
return now >= value.deadline依赖项
finite→Platform.health_forecast.finite
源码
Platform/health_forecast.lua,第 130 行。在游戏中为只读;“复制”会生成一份可编辑的副本。
Platform.health_forecast.GetHealthForecastTimeObservation(self)
if type(GetTime)~='function' then return nil,'missing-api' end
local ok,now=pcall(GetTime)
if not ok then return nil,'api-error' end
if not self:CanReadValue(now) then return nil,'restricted-value' end
if canaccessvalue and not canaccessvalue(now) then return nil,'restricted-value' end
if not finite(now) then return nil,'invalid-forecast-time' end
return now




