FANDOM


local p = {}
 
local formatNum = require( 'Module:FormatNum' ).formatNum
 
-- Add a record here in the order you wish the spells to appear
p.spells = {
   'lightning',
   'santassurprise',
   'healing',
   'rage',
   'jump',
   'freeze',
   'clone',
   'poison',
   'earthquake',
   'haste',
   'skeleton'
}
 
p.spellData = {
   ['lightning'] = {
      ['name']          = 'Lightning Spell',
      ['resource']      = 'Elixir',
      ['housing space'] = 2,
      ['total damage']  = {   300,    330,    360,     390,     450,     510,     570 },
      ['creation cost'] = { 15000,  16500,  18000,   20000,   22000,   24000,   26000 },
      ['research cost'] = {     0, 200000, 500000, 1000000, 2000000, 6000000, 8000000 },
   },
   ['santassurprise'] = {
      ['name']          = 'Santa\'s Surprise',
      ['resource']      = 'Elixir',
      ['housing space'] = 2,
      ['total damage']  = {   900 },
      ['creation cost'] = { 19000 },
      ['research cost'] = {     0 },
   },
   ['healing'] = {
      ['name']          = 'Healing Spell',
      ['resource']      = 'Elixir',
      ['housing space'] = 2,
      ['total healing'] = {   600,    800,   1000,    1200,    1400,    1600,   1800 },
      ['creation cost'] = { 15000,  16500,  18000,  19000,   21000,   23000,   25000 },
      ['research cost'] = {     0, 300000, 600000, 1200000, 2000000, 4000000,   6000000 },
   },
   ['rage'] = {
      ['name']          = 'Rage Spell',
      ['resource']      = 'Elixir',
      ['housing space'] = 2,
      ['damage boost']  = {   1.3,    1.4,    1.5,     1.6,     1.7 },
      ['speed boost']   = {    20,     22,     24,      26,      28 },
      ['creation cost'] = { 23000,  25000,  27000,   30000,   33000 },
      ['research cost'] = {     0, 450000, 900000, 1800000, 3000000 },
   },
   ['jump'] = {
      ['name']          = 'Jump Spell',
      ['resource']      = 'Elixir',
      ['housing space'] = 2,
      ['duration']      = {    20,      40,      60 },
      ['creation cost'] = { 23000,   27000,   31000 },
      ['research cost'] = {     0, 3000000, 6000000 },
   },
   ['freeze'] = {
      ['name']          = 'Freeze Spell',
      ['resource']      = 'Elixir',
      ['housing space'] = 2,
      ['duration']      = {     5,    5.75,     6.5,    7.25,       8,  9 },
      ['creation cost'] = { 23000,  26000,   29000,   31000,   33000,   35000 },
      ['research cost'] = {     0, 3000000, 4000000, 5000000, 7000000, 9000000 },
   },
   ['clone'] = {
      ['name']          = 'Clone Spell',
      ['resource']      = 'Elixir',
      ['housing space'] = 4,
      ['cloned capacity']= {   25,      28,      32,      36,   40 },
      ['creation cost'] = { 39000,   39000,     41000,   43000,   45000 },
      ['research cost'] = {     0, 4000000,     6000000, 8000000, 10000000 },
   },
   ['poison'] = {
      ['name']                 = 'Poison Spell',
      ['resource']             = 'Dark Elixir',
      ['housing space']        = 1,
      ['speed decrease']       = { 0.26,   0.3,  0.34,  0.38,    0.4 },
      ['attack rate decrease'] = { 0.35,   0.4,  0.45,   0.5,   0.55 },
      ['max dps']              = {   90,   115,   145,   180,    220 },
      ['creation cost']        = {   95,   110,   125,   140,    155 },
      ['research cost']        = {    0, 25000, 50000, 75000, 150000 },
   },
   ['earthquake'] = {
      ['name']          = 'Earthquake Spell',
      ['resource']      = 'Dark Elixir',
      ['housing space'] = 1,
      ['damage']        = {  0.14,  0.17,  0.21,  0.25 },
      ['creation cost'] = {   125,   140,   160,   180 },
      ['research cost'] = {     0, 30000, 60000, 90000 },
   },
   ['haste'] = {
      ['name']           = 'Haste Spell',
      ['resource']       = 'Dark Elixir',
      ['housing space']  = 1,
      ['duration']       = { 10,    15,    20,     25 },
      ['speed increase'] = { 28,    34,    40,     46 },
      ['creation cost']  = { 80,    85,    90,     95 },
      ['research cost']  = {  0, 40000, 80000, 100000 },
   },
   ['skeleton'] = {
      ['name']           = 'Skeleton Spell',
      ['resource']       = 'Dark Elixir',
      ['housing space']  = 1,
      ['skeletons generated'] = { 15,    18,    22,     26 },
      ['creation cost']  = { 110,    120,   130,     140 },
      ['research cost']  = {  0, 50000, 75000, 100000 },
   },
}
function p.spellStatistics( spellName, statistic, level, format )
   local retVal
 
   spellName = string.lower( spellName or '' )
   statistic = string.lower( statistic or '' )
   level     = level or 0
   format    = not ( not format )
 
   -- Remove spaces and punctuation from spell name
   spellName = string.gsub( string.gsub( spellName, '%s+', '' ), '%p+', '' )
 
   -- If the spell name has 'spell' at the end, remove that
   if string.sub( spellName, -5 ) == 'spell' then
      spellName = string.sub( spellName, 0, -6 )
   end
 
   if not p.spellData[ spellName ] then
      retVal = ''
   elseif not p.spellData[ spellName ][ statistic ] then
      retVal = ''
   else
      retVal = p.spellData[ spellName ][ statistic ]
 
      if type( retVal ) == 'table' and level ~= 0 then
         if not retVal[ level ] then
            retVal = 0
         else
            retVal = retVal[ level ]
         end
      end
   end
 
   if type( retVal ) == 'number' then
      if format then
         retVal = formatNum( retVal )
      end
   elseif type ( retVal ) == 'table' then
      retVal = '{' .. table.concat( retVal, ',' ) .. '}'
   end
 
   return retVal
end
 
function p.main( frame )
   local spellName = frame.args[ 'spell' ] or frame.args[ 1 ]
   local statistic = frame.args[ 'stat' ] or frame.args[ 2 ]
   local level     = tonumber( frame.args[ 'level' ] ) or tonumber( frame.args[ 3 ] )
   local format    = frame.args[ 'format' ] or frame.args[ 4 ]
 
   return p.spellStatistics( spellName, statistic, level, format )
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.