ui = require "ui" reg = ... reg.list = {} -- name - string, the name of the ability -- infocard, the table of info and description to draw when looking at the ability -- data, the table that contains data and functions for running the ability -- visuals, the table of sprites that the data needs to function class Ability @children = {} new: (name, data) => @sprite = @@sprite @name = name or @.__class.__name @data = data @__inherited: (child) => assert(child.use, "abilities must have a .use") assert(type(child.use) == "function", "abilities must have a .use() function") assert(type(child.load) == "function", "abilities must have a .load() that shows their infocard") assert(type(child.unload) == "function", "abilities must have an .unload() that removes their infocard") assert(child.text, "ability must have text") assert(child.description, "ability must have a description") assert(child.hits_icon, "ability must have a hits icon") assert(child.speed, "ability must have a speed") @@.children[child.__name] = child reg[child.__name] = child load: () => main = require "main" infocard = am.group!\tag("infocard") main.root("screen")\append(infocard) ui.build_infocard(infocard,@@) unload: () => main = require "main" main.root\remove("infocard") --__tostring: () => -- return string.format("<%s, %s>",@.__class.__name, @name or ".name missing") reg["Ability"] = Ability return reg