Introduce SpellTargetQuery abstraction for flexible target filtering. Replace fixed target types with query-based system supporting union, intersection, and exclusion of target conditions. Update spells accordingly.
14 lines
489 B
Lua
14 lines
489 B
Lua
--- @alias SpellTargetTest fun(caster: Character, targetPosition: Vec3) : boolean
|
|
|
|
return {
|
|
any = function() return true end,
|
|
caster = function(caster, targetPosition)
|
|
local targetCharacterId = Tree.level.characterGrid:get(targetPosition)
|
|
return caster.id == targetCharacterId
|
|
end,
|
|
character = function(caster, targetPosition)
|
|
local targetCharacterId = Tree.level.characterGrid:get(targetPosition)
|
|
return not not targetCharacterId
|
|
end
|
|
}
|