lua_manifest = {
   "methods.lua",
   "magic.lua"
}

function give_leader_xp(id)
   local leader_ppos = dsb_get_leader()
   local who = dsb_ppos_char(leader_ppos)
   xp_up(who, CLASS_WIZARD, 0, 500, 1)
end

function monster_delay(id, lev, x, y, t, monster)
  dsb_ai(monster, AI_DELAY_ACTION, 100)
end

function monster_delayxs(id, lev, x, y, t, monster)
  dsb_ai(monster, AI_DELAY_ACTION, 50)
end

function monster_delayxl(id, lev, x, y, t, monster)
  dsb_ai(monster, AI_DELAY_ACTION, 10000)
end
function monster_peaceful(id, lev, x, y, t, monster)
  dsb_ai(monster, AI_DELAY_ACTION, 9990)
end

function xp_wizard_up(id)
   local leader_ppos = dsb_get_leader()
   local who = dsb_ppos_char(leader_ppos)
   dsb_give_xp(who, CLASS_WIZARD, 0, 500)
end

function mystra_speaks(id)
   local lines, num_lines = dsb_linesplit(exvar[id].text, "/")

   local color
   if (exvar[id].color) then color = exvar[id].color
   else color = {100,100,0} end
      
   for i=1,num_lines do
      if (i == 1) then
         dsb_write(color, dsb_get_charname(exvar[id].who) .. " SAYS: " .. lines[i])
      else
         dsb_write(color, lines[i])
      end
   end
end
function artemis_speaks(id)
   local lines, num_lines = dsb_linesplit(exvar[id].text, "/")

   local color
   if (exvar[id].color) then color = exvar[id].color
   else color = {100,0,100} end
      
   for i=1,num_lines do
      if (i == 1) then
         dsb_write(color, dsb_get_charname(exvar[id].who) .. " SAYS: " .. lines[i])
      else
         dsb_write(color, lines[i])
      end
   end
end   
function fade_speaks(id)
   local lines, num_lines = dsb_linesplit(exvar[id].text, "/")

   local color
   if (exvar[id].color) then color = exvar[id].color
   else color = {0,100,100} end
      
   for i=1,num_lines do
      if (i == 1) then
         dsb_write(color, dsb_get_charname(exvar[id].who) .. " SAYS: " .. lines[i])
      else
         dsb_write(color, lines[i])
      end
   end
end
function mummy_speaks(id)
   local lines, num_lines = dsb_linesplit(exvar[id].text, "/")

   local color
   if (exvar[id].color) then color = exvar[id].color
   else color = {125, 0, 0, } end
      
   for i=1,num_lines do
      if (i == 1) then
         dsb_write(color, dsb_get_charname(exvar[id].who) .. " SAYS: " .. lines[i])
      else
         dsb_write(color, lines[i])
      end
   end
end
   
snd.new_chapter = dsb_get_sound("NEW_CHAPTER", "chapter.mp3")
snd.amb_peace = dsb_get_sound("AMB_PEACE", "kim2.mp3")
snd.wall_nice = dsb_get_sound("WALL_NICE", "wall.mp3")
snd.bliss = dsb_get_sound("BLISS", "night.mp3")
snd.cat = dsb_get_sound("CAT", "cat.mp3")
snd.ending = dsb_get_sound("ENDING", "ending.mp3")
snd.endingtwo = dsb_get_sound("ENDINGTWO", "endingtwo.mp3")

gfx.port_mummy = dsb_get_bitmap("port_mummy")
gfx.panareturn = dsb_get_bitmap("panareturn")
gfx.glowing = dsb_get_bitmap("glowing")
gfx.nebulicon = dsb_get_bitmap("nebulicon")
gfx.nebudung = dsb_get_bitmap("nebudung")
gfx.angry = dsb_get_bitmap("angry")
gfx.port_petal = dsb_get_bitmap("port_petal")
gfx.debian = dsb_get_bitmap("debian")
gfx.assa = dsb_get_bitmap("assa")
gfx.sea = dsb_get_bitmap("sea")
gfx.guardian = dsb_get_bitmap("guardian")
gfx.carsomyr = dsb_get_bitmap("carsomyr")
gfx.demonic = dsb_get_bitmap("demonic")
gfx.slicer = dsb_get_bitmap("slicer")
gfx.endgamex = dsb_get_bitmap("endgamex")
gfx.ringa = dsb_get_bitmap("ringa")

function start_game(id)
   dsb_offer_champion(Sasha, 3, function ()
   end)
end

xp_classnames = { "FIGHTER", "THIEF", "PRIEST", "WIZARD" }

function give_leader_origmana(id)
   local leader_ppos = dsb_get_leader()
   local who = dsb_ppos_char(leader_ppos)
   dsb_set_maxbar(who, 2, 580)
end

