forked from Bastion/Bastion
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
592 B
31 lines
592 B
local Tinkr, Bastion = ...
|
|
|
|
-- Create a new SpellBook class
|
|
---@class SpellBook
|
|
local SpellBook = {}
|
|
SpellBook.__index = SpellBook
|
|
|
|
-- Constructor
|
|
---@return SpellBook
|
|
function SpellBook:New()
|
|
local self = setmetatable({}, SpellBook)
|
|
self.spells = {}
|
|
return self
|
|
end
|
|
|
|
-- Get a spell from the spellbook
|
|
---@return Spell
|
|
function SpellBook:GetSpell(id)
|
|
if self.spells[id] == nil then
|
|
self.spells[id] = Bastion.Spell:New(id)
|
|
end
|
|
|
|
return self.spells[id]
|
|
end
|
|
|
|
---@return Spell
|
|
function SpellBook:GetIfRegistered(id)
|
|
return self.spells[id]
|
|
end
|
|
|
|
return SpellBook
|
|
|