參考資料 › 函式參考 › Platform

Platform.mobinfo2.hitCount

相依項目

呼叫方式

Platform.mobinfo2.hitCount(self, resists, school)

記錄相依項目 Platform.mobinfo2.hitCount,然後以該名稱呼叫。含命名空間的呼叫不會傳入 self:請使用冒號呼叫,或自行傳入該物件。

作用

Reads the hit count for a spell school from a MobInfo2 resists table (the field named school.."Hits"). A missing (nil or false) count defaults to 1; otherwise it returns a readable finite number, or nil with a reason from readField or finite (restricted-value, invalid-mobinfo2-data, mobinfo2-data-error, invalid-mobinfo2-number).

參數

名稱類型作用
selfRMPlatformRotation Master platform adapter (normally addon.Platform), used for its CanReadValue check.
resiststableThe resists table from a MobInfo2 mob record.
schoolstringSchool key used in the resists table; the field read is school.."Hits".

傳回值

1number | nilRecorded hit count, 1 when none is recorded, or nil when unavailable.
2string | nilReason when the count is nil.

版本

內建輔助函式在每個版本上都會註冊。不同的是它們讀取的遊戲 API;某個 API 不存在時,輔助函式會改用備用方式,或傳回 nil 並附上原因。

它不會直接讀取任何遊戲 API。

插件如何呼叫它

相依項目

原始碼

Platform/mobinfo2.lua,第 62 行。在遊戲中為唯讀;「複製」會產生一份可編輯的複本。

Platform.mobinfo2.hitCount(self, resists, school)
    local hits,reason=readField(self,resists,school..'Hits')
    if reason then return nil,reason end
    if hits==nil or hits==false then return 1 end
    local valid,why=finite(self,hits)
    if not valid then return nil,why end
    return hits

返回函式參考