호출 방법
addon.Platform:GetHealthForecastValueObservation(unit, kind)
addon을 통해 바로 쓸 수 있으며, 의존성이 필요 없습니다.
하는 일
별도의 식별 확인 후 지연 생명력 스칼라를 읽습니다. current는 정확한 UnitHealth(unit), maximum은 정확한 UnitHealthMax(unit)를 사용합니다. 점검 또는 제한 정책 클라이언트는 0을 포함해 읽을 수 있는 유한한 음수가 아닌 숫자를 받습니다. 반복된 존재/GUID 호출이나 다른 튜플 대체는 추가하지 않습니다.
인수
| 이름 | 유형 | 하는 일 |
|---|---|---|
self | RMPlatform | Rotation Master 플랫폼 어댑터 (콜론 호출에서는 암묵적). |
unit | string | 선택한 비어 있지 않은 유닛 토큰. 이 호출만으로는 존재 여부를 판단하지 않습니다. |
kind | string | 닫힌 스칼라 종류: current 또는 maximum. |
반환값
| 1 | number | nil | 유한한 음수가 아닌 기본 생명력 값. 사용할 수 없으면 nil. |
|---|---|---|
| 2 | string | nil | 정책, 검증 또는 필수 관찰 사용 불가 이유. |
버전
기본 제공 도우미는 모든 버전에 등록됩니다. 다른 점은 읽는 게임 API이며, API가 없으면 도우미는 대체 동작을 하거나 이유와 함께 nil을 반환합니다.
- 해당 버전에서 사용할 수 없음 (이유는 툴팁에 표시)
- Blizzard의 지원 중단 대체 함수가 켜져 있을 때만
비공개 값 (Retail과 Forever)
Retail과 Forever에서는 게임이 애드온에 비공개 값을 넘깁니다. 이 도우미는 읽는 값을 확인하고(addon.Platform:CanReadValue), 비교할 수 없는 비공개 값 대신 restricted-value 같은 이유와 함께 nil을 반환합니다. nil은 거짓이 아니라 사용할 수 없음으로 취급하세요.
예시
local current = addon.Platform:GetHealthForecastValueObservation("target", "current")
local maximum = addon.Platform:GetHealthForecastValueObservation("target", "maximum")
if not current or not maximum or maximum == 0 then return nil end
return current / maximum <= 0.35의존성
finite→Platform.health_forecast.finite
소스
Platform/health_forecast.lua, 81번째 줄. 게임에서는 읽기 전용이며, 복제하면 편집 가능한 사본이 생깁니다.
Platform.health_forecast.GetHealthForecastValueObservation(self, unit, kind)
local policy=self:GetCombatDataPolicy()
if policy~='probe' and policy~='restricted' then return nil,'unsupported-policy' end
if not self:CanReadValue(unit) or not self:CanReadValue(kind) then return nil,'restricted-value' end
if type(unit)~='string' or unit=='' then return nil,'invalid-unit' end
local api
if kind=='current' then api=UnitHealth
elseif kind=='maximum' then api=UnitHealthMax
else return nil,'invalid-health-forecast-query' end
if type(api)~='function' then return nil,'missing-api' end
local ok,value=pcall(api,unit)
if not ok then return nil,'api-error' end
if not self:CanReadValue(value) then return nil,'restricted-value' end
if canaccessvalue and not canaccessvalue(value) then return nil,'restricted-value' end
if value==nil then return nil,'health-data-unavailable' end
if not finite(value) or value<0 then return nil,'invalid-api-result' end
return value




