呼叫方式
Conditions.spatial.combatFilter(value, cache, unit)
記錄相依項目 Conditions.spatial.combatFilter,然後以該名稱呼叫。含命名空間的呼叫不會傳入 self:請使用冒號呼叫,或自行傳入該物件。
作用
Applies the In Combat option of Distance Count to one unit: with the option off every unit passes, with it on the unit must be in combat (UnitAffectingCombat).
參數
| 名稱 | 類型 | 作用 |
|---|---|---|
value | table | The Distance Count condition value; its incombat field turns the filter on. |
cache | table | The evaluation cache the reads go through. |
unit | string | Token of the unit being counted. |
傳回值
| 1 | boolean | nil | True when the unit passes; nil when its combat state cannot be read. |
|---|---|---|
| 2 | string | nil | Reason code when the first result is nil. |
版本
內建輔助函式在每個版本上都會註冊。不同的是它們讀取的遊戲 API;某個 API 不存在時,輔助函式會改用備用方式,或傳回 nil 並附上原因。
- 該版本無法使用(原因請見提示)
- 僅在暴雪的棄用相容層開啟時
| 遊戲 API | |||||
|---|---|---|---|---|---|
UnitAffectingCombat |
插件如何呼叫它
- 距離內計數 (evaluate)
local fighting,combatWhy=combatFilter(value,cache,entity.unit) Conditions.spatial.nameplateDistanceCountlocal fighting,combatWhy=combatFilter(value,cache,unit)
相依項目
booleanRead→Conditions.spatial.booleanRead
原始碼
Conditions/spatial.lua,第 673 行。在遊戲中為唯讀;「複製」會產生一份可編輯的複本。
Conditions.spatial.combatFilter(value, cache, unit)
if not value.incombat then return true end
local fighting,why=booleanRead(cache,UnitAffectingCombat,unit)
if fighting==nil then return nil,why end
return fighting




