Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Classifications for actor resist/damage
- _M.classifications = {
- unliving = {undead = true, construct = true, crystal = true},
- unnatural = {demon = true, elemental = true, horror = true, construct = true, undead = true},
- living = function(type) return not _M.classifications.unliving[type] end,
- natural = function(type) return not _M.classifications.unnatural[type] end,}
- --- Check if the actor is a certain type or in an arbitrary set of classifications
- -- @param string representing the classification to check
- -- @return whether the actor is in this classification
- function _M:checkClassification(type_str)
- -- Living and Natural are defined as not being Unliving or not Unnatural
- -- Thus, all actors are in one category or the other
- if not act or not type_str or not act.type then return end
- if act.type == type_str then return true end
- local class = _M.classifications[type_str]
- if _G.type(class) == 'function' then return class(type_str) end
- return class[act.type]
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement