Advertisement
Guest User

Untitled

a guest
Mar 21st, 2015
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 108.08 KB | None | 0 0
  1. monsterstorage = {} -- use functions below to set/get it
  2. -- warning: /reload will clear this table and reset monster
  3. -- Script is not efficient, just written for fun. You use it at own risk!
  4. 'Raining cats "utevo mas cat res"', 30, function(self, order) return demoneko.rainingCats(self:getId(), 0, "Cat", 15, 9, 3000, 4, 7, order) end},
  5.         [2] = {'Cat paws rage "exori gran mas hur"', 30, function(self, order) return demoneko.catPawsRage(self:getId(), order) end},
  6.     },
  7.     [1] =  {
  8.         [1] = {'Cat\'s rage "exori mas tempo hur"', 30, function(self, order) return demoneko.catsRage(self:getId(), order) end},
  9.         [2] = {'Space light "exevo gran mas lux"', 30, function(self, order) return demoneko.spaceLight(self:getId(), order) end},
  10.     },
  11.     [0] = {
  12.         [1] = {'Dark servants "utevo mas mort res"', 30, function(self, order) return demoneko.darkServants(self:getId(), order) end},
  13.         [2] = {'Catmusik "exevo mas tempo hur"', 30, function(self, order) return demoneko.catMusik(self:getId(), order) end},
  14.     }
  15. }
  16.  
  17. demoneko = {
  18.     onHealthChange = function(creature, attacker, primaryDamage, primaryType, secondaryDamage, secondaryType, origin)
  19.         local getlives = creature:getTempStorage(livesstor)
  20.        
  21.         if creature:getTempStorage(specialstor) > os.time() then
  22.             primaryDamage = math.ceil(primaryDamage * 0.2)
  23.             secondaryDamage = math.ceil(secondaryDamage * 0.2)
  24.         end
  25.        
  26.         local hp = creature:getHealth()
  27.         local maxhp = creature:getMaxHealth()
  28.        
  29.         if (hp * 100)/maxhp < 60 then
  30.             if (hp * 100)/maxhp > 20 then
  31.                 if creature:getTempStorage(spellstor) == -1 then
  32.                     creature:setTempStorage(specialstor, os.time() + spells[getlives][1][2])
  33.                     creature:setTempStorage(spellstor, 1)
  34.                     spells[getlives][1][3](creature, 1)
  35.                     creature:say(spells[getlives][1][1], TALKTYPE_MONSTER_SAY)
  36.                    
  37.                     local pos = creature:getPosition()
  38.                     creature:setTempStorage(nomovex, pos.x)
  39.                     creature:setTempStorage(nomovey, pos.y)
  40.                     creature:setTempStorage(nomovez, pos.z)
  41.                    
  42.                     return true
  43.                 end
  44.             end
  45.         end
  46.        
  47.         if (hp * 100)/maxhp < 20 then
  48.             if creature:getTempStorage(spellstor) == 1 then
  49.                 creature:setTempStorage(specialstor, os.time() + spells[getlives][2][2])
  50.                 creature:setTempStorage(spellstor, 2)
  51.                 spells[getlives][2][3](creature, 2)
  52.                 creature:say(spells[getlives][2][1], TALKTYPE_MONSTER_SAY)
  53.                
  54.                 local pos = creature:getPosition()
  55.                 creature:setTempStorage(nomovex, pos.x)
  56.                 creature:setTempStorage(nomovey, pos.y)
  57.                 creature:setTempStorage(nomovez, pos.z)
  58.                 return true
  59.             end
  60.         end
  61.        
  62.         return primaryDamage, primaryType, secondaryDamage, secondaryType
  63.     end,
  64.     onPrepareDeath = function(creature, lastHitKiller, mostDamageKiller)
  65.         creature:setTempStorage(spellstor, -1)
  66.         creature:setTempStorage(specialstor, -1)
  67.         local getlives = creature:getTempStorage(livesstor)
  68.  
  69.             if getlives == 0 then
  70.                 return true
  71.             end
  72.  
  73.             if getlives == -1 then
  74.                 creature:setTempStorage(livesstor, lives - 1)
  75.             end
  76.  
  77.             if getlives > 0 then
  78.                 creature:setTempStorage(livesstor, getlives - 1)
  79.             end
  80.            
  81.             local maxhp = creature:getMaxHealth()
  82.             creature:addHealth(maxhp)
  83.             addEvent(doCreatureAddHealth, 100, creature:getId(), maxhp)
  84.         return true
  85.     end,
  86.     onCreatureAppear = function(self, creature) return false end,
  87.     onCreatureDisappear = function(self, creature) return false end,
  88.     onCreatureMove = function(self, creature, oldPosition, newPosition) return false end,
  89.     onCreatureSay = function(self, creature, type, message) return false end,
  90.     onThink = function(self, interval)
  91.         local cid = self:getId()
  92.         if self:getTempStorage(specialstor) > os.time() then
  93.             self:teleportTo({x = self:getTempStorage(nomovex), y = self:getTempStorage(nomovey), z = self:getTempStorage(nomovez)})
  94.             return true
  95.         end
  96.        
  97.         if math.random(1, 100) <= 80 then
  98.             local target = self:getTarget()
  99.             if target then
  100.                 local pos = self:getPosition()
  101.                 local catpos = {x = pos.x + math.random(-1, 1), y = pos.y + math.random(-1, 1), z = pos.z}
  102.                 local getcat = Game.createMonster("Cat", catpos)
  103.                 if getcat then
  104.                     local catid = getcat:getId()
  105.                     local tpos = target:getPosition()
  106.                     local path = getcat:getPathTo(tpos)
  107.                     if path then
  108.                         table.insert(path, path[#path])
  109.                         table.insert(path, path[#path])
  110.                         table.insert(path, path[#path])
  111.                         for i = 1, #path do
  112.                             addEvent(demoneko.moveCat, (50 * i) + 50, self:getId(), catid, path[i], nil, true)
  113.                         end
  114.                         addEvent(doRemoveCreature, (50 * #path) + 200, catid)
  115.                     else
  116.                         local newx = 0
  117.                         local newy = 0
  118.                         local mindist = 4
  119.                         local maxdist = 7
  120.  
  121.                         if math.random(1, 2) == 1 then
  122.                             newx = math.random(-maxdist, maxdist)
  123.                             if math.random(1, 2) == 1 then
  124.                                 newy = math.random(-mindist, -maxdist)
  125.                             else
  126.                                 newy = math.random(mindist, maxdist)           
  127.                             end
  128.                         else
  129.                             newy = math.random(-maxdist, maxdist)
  130.                             if math.random(1, 2) == 1 then
  131.                                 newx = math.random(-mindist, -maxdist)
  132.                             else
  133.                                 newx = math.random(mindist, maxdist)           
  134.                             end
  135.                         end
  136.                        
  137.                         local path = getcat:getPathTo({x = pos.x + newx, y = pos.y + newy, z = pos.z})
  138.                         if path then
  139.                             table.insert(path, path[#path])
  140.                             table.insert(path, path[#path])
  141.                             table.insert(path, path[#path])
  142.                             for i = 1, #path do
  143.                                 addEvent(demoneko.moveCat, (50 * i) + 50, self:getId(), catid, path[i], nil, true)
  144.                             end
  145.                             addEvent(doRemoveCreature, (50 * #path) + 200, catid)
  146.                         else
  147.                             getcat:remove()
  148.                         end
  149.                     end
  150.                 end
  151.             end
  152.         end
  153.        
  154.         if math.random(1, 100) <= 80 then
  155.             local pos = self:getPosition()
  156.             local dir = self:getDirection()
  157.  
  158.             local left = Position(getNewPosByDir(pos, neardirs[dir][1]))
  159.             local mid = Position(getNewPosByDir(pos, dir))
  160.             local right = Position(getNewPosByDir(pos, neardirs[dir][2]))
  161.  
  162.             local combat = COMBAT_PHYSICALDAMAGE
  163.             local shooteffect = CONST_ANI_THROWINGKNIFE
  164.             local areaeffect = CONST_ME_GROUNDSHAKER
  165.             local order = self:getTempStorage(spellstor)
  166.            
  167.             pos:sendDistanceEffect(left, shooteffect)
  168.             pos:sendDistanceEffect(mid, shooteffect)
  169.             pos:sendDistanceEffect(right, shooteffect)
  170.                
  171.             addEvent(simpleCombat, 100, cid, combat, -50, -250, areaeffect, left, true)
  172.             addEvent(simpleCombat, 100, cid, combat, -50, -250, areaeffect, mid, true)
  173.             addEvent(simpleCombat, 100, cid, combat, -50, -250, areaeffect, right, true)
  174.            
  175.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, left, neardirs[dir][1], -50, -250, shooteffect, areaeffect, 1, order)
  176.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, mid, dir, -50, -250, shooteffect, areaeffect, 1, order)
  177.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, right, neardirs[dir][2], -50, -250, shooteffect, areaeffect, 1, order)
  178.            
  179.             addEvent(Position.sendDistanceEffect, 300, pos, left, shooteffect)
  180.             addEvent(Position.sendDistanceEffect, 300, pos, mid, shooteffect)
  181.             addEvent(Position.sendDistanceEffect, 300, pos, right, shooteffect)
  182.                
  183.             addEvent(simpleCombat, 400, cid, combat, -50, -250, areaeffect, left, true)
  184.             addEvent(simpleCombat, 400, cid, combat, -50, -250, areaeffect, mid, true)
  185.             addEvent(simpleCombat, 400, cid, combat, -50, -250, areaeffect, right, true)
  186.            
  187.             addEvent(demoneko.moveSimpleShot, 400, cid, combat, left, neardirs[dir][1], -50, -250, shooteffect, areaeffect, 1, order)
  188.             addEvent(demoneko.moveSimpleShot, 400, cid, combat, mid, dir, -50, -250, shooteffect, areaeffect, 1, order)
  189.             addEvent(demoneko.moveSimpleShot, 400, cid, combat, right, neardirs[dir][2], -50, -250, shooteffect, areaeffect, 1, order)
  190.  
  191.             addEvent(Position.sendDistanceEffect, 500, pos, left, shooteffect)
  192.             addEvent(Position.sendDistanceEffect, 500, pos, mid, shooteffect)
  193.             addEvent(Position.sendDistanceEffect, 500, pos, right, shooteffect)
  194.                
  195.             addEvent(simpleCombat, 600, cid, combat, -50, -250, areaeffect, left, true)
  196.             addEvent(simpleCombat, 600, cid, combat, -50, -250, areaeffect, mid, true)
  197.             addEvent(simpleCombat, 600, cid, combat, -50, -250, areaeffect, right, true)
  198.            
  199.             addEvent(demoneko.moveSimpleShot, 600, cid, combat, left, neardirs[dir][1], -50, -250, shooteffect, areaeffect, 1, order)
  200.             addEvent(demoneko.moveSimpleShot, 600, cid, combat, mid, dir, -50, -250, shooteffect, areaeffect, 1, order)
  201.             addEvent(demoneko.moveSimpleShot, 600, cid, combat, right, neardirs[dir][2], -50, -250, shooteffect, areaeffect, 1, order)
  202.            
  203.             if math.random(1, 100) <= 90 then
  204.                 addEvent(demoneko.moveSelf, 700, cid, math.random(3, 7), math.random(3, 7), order)
  205.             end
  206.             return false
  207.         end
  208.        
  209.         if math.random(1, 100) <= 30 then
  210.             demoneko.orbWave(cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  211.             addEvent(demoneko.orbWave, 100, cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  212.             addEvent(demoneko.orbWave, 150, cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  213.             return false
  214.         end
  215.        
  216.         if math.random(1, 100) <= 40 then
  217.             demoneko.orbBeam(cid, 900, 75, COMBAT_HOLYDAMAGE, CONST_ANI_HOLY, CONST_ME_HOLYDAMAGE)
  218.             addEvent(demoneko.orbBeam, 300, cid, 300, 30, COMBAT_HOLYDAMAGE, CONST_ANI_HOLY, CONST_ME_HOLYDAMAGE)
  219.             addEvent(demoneko.orbBeam, 600, cid, 100, 15, COMBAT_HOLYDAMAGE, CONST_ANI_HOLY, CONST_ME_HOLYDAMAGE)
  220.             return false
  221.         end
  222.        
  223.         if math.random(1, 100) <= 70 then
  224.             demoneko.simpleWave(cid, COMBAT_FIREDAMAGE, CONST_ANI_FIRE, CONST_ME_FIREATTACK)
  225.             return false
  226.         end
  227.         return false
  228.     end,
  229.     orbWave = function(cid, combat, shooteffect, areaeffect)
  230.         local self = Monster(cid)
  231.         local dir = self:getDirection()
  232.         local pos = self:getPosition()
  233.        
  234.         if self then
  235.             local left = getNewPosByDir(pos, neardirs[dir][1])
  236.             local mid = getNewPosByDir(pos, dir)
  237.             local right = getNewPosByDir(pos, neardirs[dir][2])
  238.             local mindmg = -100
  239.             local maxdmg = -250
  240.  
  241.             simpleCombat(cid, combat, mindmg, maxdmg, areaeffect, left)
  242.             simpleCombat(cid, combat, mindmg, maxdmg, areaeffect, mid)
  243.             simpleCombat(cid, combat, mindmg, maxdmg, areaeffect, right)
  244.  
  245.             addEvent(demoneko.orbWave_move, 500, cid, left, dir, neardirs[dir][1], 1, 500, combat, shooteffect, areaeffect, mindmg, maxdmg)
  246.             addEvent(demoneko.orbWave_move, 500, cid, mid, dir, dir, 1, 500, combat, shooteffect, areaeffect, mindmg, maxdmg)
  247.             addEvent(demoneko.orbWave_move, 500, cid, right, dir, neardirs[dir][2], 1, 500, combat, shooteffect, areaeffect, mindmg, maxdmg)
  248.  
  249.             addEvent(demoneko.orbWave_move, 500, cid, right, dir, neardirs[dir][1], 1, 500, combat, shooteffect, areaeffect, mindmg, maxdmg)
  250.             addEvent(demoneko.orbWave_move, 500, cid, left, dir, neardirs[dir][2], 1, 500, combat, shooteffect, areaeffect, mindmg, maxdmg)        
  251.         end
  252.         return true
  253.     end,
  254.     orbWave_move = function(cid, pos, basedir, diagdir, movementid, basedelay, combat, shooteffect, areaeffect, mindmg, maxdmg)
  255.         basedelay = math.max(0, basedelay - 50)
  256.         if basedelay <= 0 then
  257.             return true
  258.         end
  259.        
  260.         if not isMonster(cid) then
  261.             return true
  262.         end
  263.        
  264.         if Monster(cid):getTempStorage(specialstor) > os.time() then
  265.             Position(pos):sendMagicEffect(CONST_ME_POFF)
  266.             return true
  267.         end
  268.        
  269.         local npos = nil
  270.        
  271.         if movementid < 1 then
  272.             movementid = movementid + 1
  273.             npos = getNewPosByDir(pos, basedir)
  274.         else
  275.             movementid = 0
  276.             npos = getNewPosByDir(pos, diagdir)
  277.         end
  278.        
  279.         local nposm = Position(npos)
  280.         if nposm then
  281.             if nposm:isPathable(true) then
  282.                 Position(pos):sendDistanceEffect(npos, shooteffect)
  283.                 addEvent(simpleCombat, 100, cid, combat, mindmg, maxdmg, areaeffect, npos)
  284.                 addEvent(demoneko.orbWave_move, basedelay, cid, npos, basedir, diagdir, movementid, basedelay, combat, shooteffect, areaeffect, mindmg, maxdmg)
  285.             end
  286.         end
  287.         return true
  288.     end,
  289.     orbBeam = function(cid, delay, slower, combat, shooteffect, areaeffect)
  290.         local self = Monster(cid)
  291.         if not self then return true end
  292.         local dir = self:getDirection()
  293.         local pos = self:getPosition()
  294.        
  295.         if self then
  296.             local left = getNewPosByDir(pos, neardirs[dir][1])
  297.             local right = getNewPosByDir(pos, neardirs[dir][2])
  298.             local mindmg = -50
  299.             local maxdmg = -250
  300.            
  301.             simpleCombat(cid, combat, mindmg, maxdmg, areaeffect, left)
  302.             simpleCombat(cid, combat, mindmg, maxdmg, areaeffect, right)       
  303.  
  304.             addEvent(demoneko.orbBeam_move, delay, cid, left, dir, neardirs[dir][1], 1, delay, slower, shooteffect, areaeffect, mindmg, maxdmg)
  305.             addEvent(demoneko.orbBeam_move, delay, cid, right, dir, neardirs[dir][2], 1, delay, slower, shooteffect, areaeffect, mindmg, maxdmg)
  306.         end
  307.         return true
  308.     end,
  309.     orbBeam_move = function(cid, pos, basedir, diagdir, movementid, basedelay, slower, shooteffect, areaeffect, mindmg, maxdmg, step)
  310.         if not step then step = 1 end
  311.        
  312.         basedelay = math.max(0, basedelay - slower)
  313.         if basedelay <= 0 then
  314.             return true
  315.         end
  316.        
  317.         local monster = Monster(cid)
  318.         if not monster then
  319.             return true
  320.         end
  321.        
  322.         if monster:getTempStorage(specialstor) > os.time() then
  323.             Position(pos):sendMagicEffect(CONST_ME_POFF)
  324.             return true
  325.         end
  326.        
  327.         local npos = nil
  328.        
  329.         if movementid < 3 then
  330.             movementid = movementid + 1
  331.             npos = getNewPosByDir(pos, basedir)
  332.             local nposm = Position(npos)
  333.             if nposm then
  334.                 if nposm:isPathable(true) then
  335.                     Position(pos):sendDistanceEffect(npos, shooteffect)
  336.                     addEvent(simpleCombat, 100, cid, COMBAT_PHYSICALDAMAGE, mindmg, maxdmg, areaeffect, npos)
  337.                     addEvent(demoneko.orbBeam_move, basedelay, cid, npos, basedir, diagdir, movementid, basedelay, slower, shooteffect, areaeffect, mindmg, maxdmg, step)
  338.                 end
  339.             end
  340.         else
  341.             movementid = 0
  342.             -- if step == 2 then
  343.             -- double orb
  344.                 step = 0
  345.                 npos1 = getNewPosByDir(pos, neardirs[basedir][1])
  346.                 npos2 = getNewPosByDir(pos, neardirs[basedir][2])
  347.                 local nposm1 = Position(npos1)
  348.                 if nposm1 then
  349.                     if nposm1:isPathable(true) then
  350.                         Position(pos):sendDistanceEffect(npos1, shooteffect)
  351.                         addEvent(simpleCombat, 100, cid, COMBAT_PHYSICALDAMAGE, mindmg, maxdmg, areaeffect, npos1)
  352.                         addEvent(demoneko.orbBeam_move, basedelay, cid, npos1, basedir, neardirs[basedir][1], movementid, basedelay, slower, shooteffect, areaeffect, mindmg, maxdmg, step)
  353.                     end
  354.                 end
  355.                
  356.                 local nposm2 = Position(npos2)
  357.                 if nposm2 then
  358.                     if nposm2:isPathable(true) then
  359.                         Position(pos):sendDistanceEffect(npos2, shooteffect)
  360.                         addEvent(simpleCombat, 100, cid, COMBAT_PHYSICALDAMAGE, mindmg, maxdmg, areaeffect, npos2)
  361.                         addEvent(demoneko.orbBeam_move, basedelay, cid, npos2, basedir, neardirs[basedir][2], movementid, basedelay, slower, shooteffect, areaeffect, mindmg, maxdmg, step)
  362.                     end
  363.                 end
  364.             --[[else
  365.                 -- less hardcore
  366.                 step = step + 1
  367.                 npos = getNewPosByDir(pos, diagdir)
  368.                 local nposm = Position(npos)
  369.                 if nposm then
  370.                     if nposm:isPathable(true) then
  371.                         Position(pos):sendDistanceEffect(npos, shooteffect)
  372.                         addEvent(simpleCombat, 100, cid, COMBAT_PHYSICALDAMAGE, mindmg, maxdmg, areaeffect, npos)
  373.                         addEvent(demoneko.orbBeam_move, basedelay, cid, npos, basedir, diagdir, movementid, basedelay, slower, shooteffect, areaeffect, mindmg, maxdmg, step)
  374.                     end
  375.                 end
  376.             end]]
  377.         end
  378.         return true
  379.     end,
  380.     rainingCats = function(cid, wave, cat, amount, waves, interval, mindist, maxdist, order)
  381.         local monster = Monster(cid)
  382.         if not monster then
  383.             return true
  384.         end
  385.        
  386.         if wave == waves then
  387.             return true
  388.         end
  389.        
  390.         if wave == 0 then
  391.             local pos = getThingPos(cid)
  392.             for i = 1, #ar1 do
  393.                 addEvent(orderAreaCombat, math.ceil(((i / #ar1) * 15000) / 2), cid, COMBAT_HOLYDAMAGE, pos, ar_1[i], 200, 400, CONST_ME_HOLYDAMAGE, order)
  394.                 addEvent(orderAreaCombat, math.ceil(15000 + (((i / #ar1) * 15000) / 2)), cid, COMBAT_HOLYDAMAGE, pos, ar_1[i], 200, 400, CONST_ME_HOLYDAMAGE, order)
  395.             end
  396.            
  397.             for i = 1, #ar2 do
  398.                 addEvent(orderAreaCombat, math.ceil(7500 + (((i / #ar2) * 15000) / 2)), cid, COMBAT_FIREDAMAGE, pos, ar_2[i], 250, 500, CONST_ME_FIREATTACK, order)
  399.                 addEvent(orderAreaCombat, math.ceil(22500 + (((i / #ar2) * 15000) / 2)), cid, COMBAT_FIREDAMAGE, pos, ar_2[i], 250, 500, CONST_ME_FIREATTACK, order)
  400.             end
  401.         end
  402.        
  403.         wave = wave + 1
  404.        
  405.         for i = 1, amount do
  406.             local delay = math.floor((i/amount) * (interval/2))
  407.             if delay <= 0 then
  408.                 demoneko.throwCat(cid, mindist, maxdist, cat, order)
  409.             else
  410.                 addEvent(demoneko.throwCat, delay, cid, mindist, maxdist, cat, order)
  411.             end
  412.         end
  413.         addEvent(demoneko.rainingCats, interval, cid, wave, cat, amount, waves, interval, mindist, maxdist, order)
  414.         return true
  415.     end,
  416.     throwCat = function(cid, mindist, maxdist, cat, order)
  417.         local monster = Monster(cid)
  418.         if not monster then
  419.             return true
  420.         end
  421.        
  422.         if monster:getTempStorage(specialstor) < os.time() then
  423.             return true
  424.         end
  425.        
  426.         if monster:getTempStorage(spellstor) ~= order then
  427.             return true
  428.         end
  429.        
  430.         local pos = monster:getPosition()
  431.         local newx = 0
  432.         local newy = 0
  433.  
  434.         if math.random(1, 2) == 1 then
  435.             newx = math.random(-maxdist, maxdist)
  436.             if math.random(1, 2) == 1 then
  437.                 newy = math.random(-mindist, -maxdist)
  438.             else
  439.                 newy = math.random(mindist, maxdist)           
  440.             end
  441.         else
  442.             newy = math.random(-maxdist, maxdist)
  443.             if math.random(1, 2) == 1 then
  444.                 newx = math.random(-mindist, -maxdist)
  445.             else
  446.                 newx = math.random(mindist, maxdist)           
  447.             end
  448.         end
  449.        
  450.         local catpos = {x = pos.x + math.random(-1, 1), y = pos.y + math.random(-1, 1), z = pos.z}
  451.         local getcat = Game.createMonster(cat, catpos)
  452.         if getcat then
  453.             local catid = getcat:getId()
  454.             local path = getcat:getPathTo({x = pos.x + newx, y = pos.y + newy, z = pos.z}, 0, 20, true, false, 30)
  455.             for i = 1, #path do
  456.                 addEvent(demoneko.moveCat, (50 * i) + 50, cid, catid, path[i], order)
  457.             end
  458.             addEvent(doRemoveCreature, (50 * #path) + 50, catid)
  459.         end
  460.         return true
  461.     end,
  462.     moveCat = function(cid, catid, dir, order, force)
  463.         local cat = Monster(catid)
  464.         if not cat then
  465.             return true
  466.         end
  467.  
  468.         local monster = Monster(cid)
  469.         local pos = cat:getPosition()
  470.         if not monster then
  471.             pos:sendMagicEffect(CONST_ME_POFF)
  472.             cat:remove()
  473.             return true
  474.         end
  475.        
  476.         if not force then
  477.             if monster:getTempStorage(specialstor) < os.time() then
  478.                 return true
  479.             end
  480.        
  481.             if monster:getTempStorage(spellstor) ~= order then
  482.                 return true
  483.             end
  484.         end
  485.        
  486.         local catdir = cat:getDirection()
  487.         local hitpos1 = getNewPosByDir(pos, catdir)
  488.         local tile1 = Tile(hitpos1)
  489.         if tile1 then
  490.             if tile1:getCreatureCount() > 0 then
  491.                 if isPlayer(tile1:getTopCreature():getId()) then
  492.                     pos:sendMagicEffect(CONST_ME_BLOCKHIT)
  493.                     simpleCombat(catid, COMBAT_PHYSICALDAMAGE, -100, -400, CONST_ME_BLOCKHIT, hitpos1)
  494.                     doMoveCreature(catid, catdir)
  495.                     cat:remove()
  496.                 end
  497.                 return true
  498.             end
  499.         end
  500.        
  501.         local hitpos2 = getNewPosByDir(pos, neardirs[catdir][1])
  502.         local tile2 = Tile(hitpos2)
  503.         if tile2 then
  504.             if tile2:getCreatureCount() > 0 then
  505.                 if isPlayer(tile2:getTopCreature():getId()) then
  506.                     pos:sendMagicEffect(CONST_ME_BLOCKHIT)
  507.                     simpleCombat(catid, COMBAT_PHYSICALDAMAGE, -100, -400, CONST_ME_BLOCKHIT, hitpos2)
  508.                     doMoveCreature(catid, neardirs[catdir][1])
  509.                     cat:remove()
  510.                 end
  511.                 return true
  512.             end
  513.         end
  514.        
  515.         local hitpos3 = getNewPosByDir(pos, neardirs[catdir][2])
  516.         local tile3 = Tile(hitpos3)
  517.         if tile3 then
  518.             if tile3:getCreatureCount() > 0 then
  519.                 if isPlayer(tile3:getTopCreature():getId()) then
  520.                     pos:sendMagicEffect(CONST_ME_BLOCKHIT)
  521.                     simpleCombat(catid, COMBAT_PHYSICALDAMAGE, -100, -400, CONST_ME_BLOCKHIT, hitpos3)
  522.                     doMoveCreature(catid, neardirs[catdir][2])
  523.                     cat:remove()
  524.                 end
  525.                 return true
  526.             end
  527.         end
  528.        
  529.         local npos = {x = pos.x + dirs[dir].x, y = pos.y + dirs[dir].y, z = pos.z}
  530.         if Position(npos):isPathable(true) then
  531.             pos:sendMagicEffect(CONST_ME_BLOCKHIT)
  532.             doMoveCreature(catid, dir)
  533.             return true
  534.         end
  535.        
  536.         pos:sendMagicEffect(CONST_ME_POFF)
  537.         cat:remove()
  538.         return true
  539.     end,
  540.     simpleWave = function(cid, combat, shooteffect, areaeffect)
  541.         local monster = Monster(cid)
  542.         if not monster then
  543.             return true
  544.         end
  545.        
  546.         if monster:getTempStorage(specialstor) > os.time() then
  547.             return true
  548.         end
  549.        
  550.         local pos = monster:getPosition()
  551.         local dir = monster:getDirection()
  552.         local npos = getNewPosByDir(pos, dir)
  553.         simpleCombat(cid, combat, -100, -400, areaeffect, npos)
  554.         addEvent(demoneko.simpleWaveStep, 400, cid, npos, dir, combat, shooteffect, areaeffect, 1, 400, 100, 400)
  555.         return true
  556.     end,
  557.     simpleWaveStep = function(cid, pos, dir, combat, shooteffect, areaeffect, step, basedelay, mindmg, maxdmg)
  558.         basedelay = math.max(0, basedelay - 50)
  559.         if basedelay <= 0 then
  560.             return true
  561.         end
  562.        
  563.         local monster = Monster(cid)
  564.         if not monster then
  565.             return true
  566.         end
  567.        
  568.         local oldpos = Position(pos)
  569.         if monster:getTempStorage(specialstor) > os.time() then
  570.             oldpos:sendMagicEffect(CONST_ME_POFF)
  571.             return true
  572.         end
  573.        
  574.         local midpos = Position(getNewPosByDir(pos, dir))
  575.         if midpos:isPathable(true) then
  576.             oldpos:sendDistanceEffect(midpos, shooteffect)
  577.             addEvent(simpleCombat, 100, cid, combat, mindmg, maxdmg, areaeffect, midpos)
  578.         end
  579.        
  580.         if step == 1 then
  581.             local leftpos = Position(getNewPosByDir(pos, neardirs[dir][1]))
  582.             local rightpos = Position(getNewPosByDir(pos, neardirs[dir][2]))
  583.            
  584.             if leftpos:isPathable(true) then
  585.                 oldpos:sendDistanceEffect(leftpos, shooteffect)
  586.                 addEvent(simpleCombat, 100, cid, combat, mindmg, maxdmg, areaeffect, leftpos)
  587.                 addEvent(demoneko.simpleWaveStep, basedelay, cid, leftpos, dir, combat, shooteffect, areaeffect, -1, basedelay, mindmg, maxdmg)
  588.             end
  589.            
  590.             if rightpos:isPathable(true) then
  591.                 oldpos:sendDistanceEffect(rightpos, shooteffect)
  592.                 addEvent(simpleCombat, 100, cid, combat, mindmg, maxdmg, areaeffect, rightpos)
  593.                 addEvent(demoneko.simpleWaveStep, basedelay, cid, rightpos, dir, combat, shooteffect, areaeffect, -1, basedelay, mindmg, maxdmg)
  594.             end
  595.            
  596.             if midpos:isPathable(true) then
  597.                 addEvent(demoneko.simpleWaveStep, basedelay, cid, midpos, dir, combat, shooteffect, areaeffect, -1, basedelay, mindmg, maxdmg)
  598.             end
  599.            
  600.         else
  601.             if midpos:isPathable(true) then
  602.                 addEvent(demoneko.simpleWaveStep, basedelay, cid, midpos, dir, combat, shooteffect, areaeffect, step + 1, basedelay, mindmg, maxdmg)
  603.             end
  604.         end
  605.         return true
  606.     end,
  607.     catPawsRage = function(cid, order)
  608.         local monster = Monster(cid)
  609.         if not monster then
  610.             return true
  611.         end
  612.        
  613.         local pos = monster:getPosition()
  614.         local basedelay = 1000
  615.         for i = 1, 15 do
  616.             addEvent(demoneko.simpleShot, basedelay * 2 * i, cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGKNIFE, CONST_ME_HITAREA, order)
  617.         end
  618.        
  619.         demoneko.clockInit(cid, COMBAT_HOLYDAMAGE, CONST_ANI_HOLY, CONST_ME_HOLYDAMAGE, order)
  620.         return true
  621.     end,
  622.     simpleShot = function(cid, combat, shooteffect, areaeffect, order, pos)
  623.         local monster = Monster(cid)
  624.         if not monster then
  625.             return true
  626.         end
  627.        
  628.         if monster:getTempStorage(specialstor) < os.time() then
  629.             return true
  630.         end
  631.        
  632.         if monster:getTempStorage(spellstor) ~= order then
  633.             return true
  634.         end
  635.        
  636.         if pos then
  637.             pos = Position(pos)
  638.         else
  639.             pos = monster:getPosition()
  640.         end
  641.        
  642.         for i = 0, 7 do
  643.             local npos = getNewPosByDir(pos, i)
  644.             pos:sendDistanceEffect(npos, shooteffect)
  645.            
  646.             addEvent(simpleCombat, 100, cid, combat, -50, -200, areaeffect, npos, true)
  647.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, npos, i, -50, -200, shooteffect, areaeffect, 1, order)
  648.         end    
  649.         return true
  650.     end,
  651.     moveSimpleShot = function(cid, combat, pos, ndir, mind, maxd, shooteffect, areaeffect, step, order)
  652.         local monster = Monster(cid)
  653.         if not monster then
  654.             return true
  655.         end
  656.        
  657.         if monster:getTempStorage(spellstor) ~= order then
  658.             Position(pos):sendMagicEffect(CONST_ME_POFF)
  659.             return true
  660.         end
  661.        
  662.         local npos = getNewPosByDir(pos, ndir)
  663.         if Position(npos):isPathable(true, true) then
  664.             Position(pos):sendDistanceEffect(npos, shooteffect)
  665.             simpleCombat(cid, combat, mind, maxd, areaeffect, npos, true)
  666.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, npos, ndir, mind, maxd, shooteffect, areaeffect, step + 1, order)
  667.         else
  668.             simpleCombat(cid, combat, mind, maxd, areaeffect, npos, true)
  669.         end
  670.         return true
  671.     end,
  672.     clockInit = function(cid, combat, shooteffect, areaeffect, order, noturn)
  673.         local monster = Monster(cid)
  674.         if not monster then
  675.             return true
  676.         end
  677.        
  678.         local pos = monster:getPosition()      
  679.         for i = 0, 3 do
  680.             demoneko.clockShot(cid, pos, combat, shooteffect, areaeffect, -10, -200, i, neardirs[i][2], order, nil, nil, noturn)
  681.         end
  682.         return true
  683.     end,
  684.     clockShot = function(cid, pos, combat, shooteffect, areaeffect, mind, maxd, dir, diagdir, order, step, total, noturn)
  685.         if not step then step = 1 end
  686.         if not total then total = 1 end
  687.         if total == 9 then return true end
  688.        
  689.         local monster = Monster(cid)
  690.         if not monster then
  691.             return true
  692.         end
  693.        
  694.         pos = Position(pos)
  695.        
  696.         if monster:getTempStorage(specialstor) < os.time() then
  697.             pos:sendMagicEffect(CONST_ME_POFF)
  698.             return true
  699.         end
  700.        
  701.         if monster:getTempStorage(spellstor) ~= order then
  702.             pos:sendMagicEffect(CONST_ME_POFF)
  703.             return true
  704.         end
  705.        
  706.         local npos = getNewPosByDir(pos, dir)
  707.         if step == 2 then
  708.             npos = getNewPosByDir(pos, diagdir)
  709.             addEvent(simpleCombat, 100, cid, combat, mind, maxd, areaeffect, npos)
  710.             for i = 1, (9 - total) do
  711.                 addEvent(simpleCombat, 100 + (450 * i), cid, combat, mind, maxd, areaeffect, npos)
  712.             end
  713.             step = 0
  714.         end
  715.        
  716.         if total < 9 then
  717.             pos:sendDistanceEffect(npos, shooteffect)
  718.         end
  719.        
  720.         if total == 1 and (not noturn) then
  721.             for k = 1, 5 do
  722.                 for i = 1, #arclock do
  723.                     addEvent(orderAreaCombat, 4050 + (450 * i) + (5400 * (k-1)), cid, combat, pos, ar_clock[i], mind, maxd, areaeffect, order)
  724.                 end
  725.             end
  726.         end
  727.        
  728.         addEvent(simpleCombat, 100, cid, combat, mind, maxd, areaeffect, npos, true)
  729.         addEvent(demoneko.clockShot, 450, cid, npos, combat, shooteffect, areaeffect, mind, maxd, dir, diagdir, order, step + 1, total + 1, noturn)
  730.         return true
  731.     end,
  732.     catsRage = function(cid, order)
  733.         local monster = Monster(cid)
  734.         if not monster then
  735.             return true
  736.         end
  737.        
  738.         local pos = monster:getPosition()
  739.        
  740.         for i = 1, 60 do
  741.             local x = math.random(1, 4)
  742.             local y = math.random(1, 4)
  743.             if math.random(1, 2) == 1 then
  744.                 x = -x
  745.             end
  746.  
  747.             if math.random(1, 2) == 1 then
  748.                 y = -y
  749.             end
  750.             local npos = {x = pos.x + x, y = pos.y + y, z = pos.z}
  751.             addEvent(simpleCombat, math.max(100, (500 * (i - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -100, CONST_ME_GROUNDSHAKER, npos)
  752.             addEvent(demoneko.simpleShot, 100 + (500 * (i - 1)), cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGKNIFE, CONST_ME_HITAREA, order, npos)
  753.         end
  754.         return true
  755.     end,
  756.     moveSelf = function(cid, x, y, order)
  757.         local monster = Monster(cid)
  758.         if not monster then return true end
  759.         if monster:getTempStorage(spellstor) ~= order then return true end
  760.        
  761.         if math.random(1, 2) == 1 then
  762.             x = -x
  763.         end
  764.        
  765.         if math.random(1, 2) == 1 then
  766.             y = -y
  767.         end
  768.        
  769.         local pos = monster:getPosition()
  770.         local npos = {x = pos.x + x, y = pos.y + y, z = pos.z}
  771.        
  772.         local path = monster:getPathTo(npos)
  773.         if not path then return true end
  774.         if #path > 12 then return true end
  775.        
  776.         for i = 1, #path do
  777.             addEvent(demoneko.push, 100 + (50 * (i - 1)), cid, path[i], order)
  778.         end
  779.        
  780.         return true
  781.     end,
  782.     push = function(cid, dir, order)
  783.         local monster = Monster(cid)
  784.         if not monster then return true end
  785.         if monster:getTempStorage(spellstor) ~= order then return true end
  786.        
  787.         doMoveCreature(cid, dir)
  788.         return true
  789.     end,
  790.     spaceLight = function(cid, order)
  791.         local monster = Monster(cid)
  792.         if not monster then
  793.             return true
  794.         end
  795.        
  796.         local pos = monster:getPosition()
  797.         for i = 1, 30 do
  798.             local x = math.random(1, 4)
  799.             local y = math.random(1, 4)
  800.             if math.random(1, 2) == 1 then
  801.                 x = -x
  802.             end
  803.  
  804.             if math.random(1, 2) == 1 then
  805.                 y = -y
  806.             end
  807.             local npos = {x = pos.x + x, y = pos.y + y, z = pos.z}
  808.             addEvent(simpleCombat, math.max(100, (900 * (i - 1))), cid, COMBAT_ICEDAMAGE, -50, -100, CONST_ME_POFF, npos)
  809.             addEvent(demoneko.simpleShot, 100 + (900 * (i - 1)), cid, COMBAT_ICEDAMAGE, CONST_ANI_SNOWBALL, CONST_ME_POFF, order, npos)
  810.         end
  811.        
  812.         local dir = monster:getDirection()
  813.        
  814.         for k = 1, 8 do
  815.             local left = Position(getNewPosByDir(pos, neardirs[dir][1]))
  816.             local mid = Position(getNewPosByDir(pos, dir))
  817.             local right = Position(getNewPosByDir(pos, neardirs[dir][2]))
  818.        
  819.             for i = 1, 3 do
  820.                 addEvent(simpleCombat, 100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_BLUE, left)
  821.                 addEvent(simpleCombat, 100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_YELLOW, mid)
  822.                 addEvent(simpleCombat, 100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_RED, right)
  823.             end
  824.            
  825.             local left2 = Position(getNewPosByDir(left, neardirs[dir][1]))
  826.             left = Position(getNewPosByDir(left, dir))
  827.             mid = Position(getNewPosByDir(mid, dir))
  828.             local right2 = Position(getNewPosByDir(right, neardirs[dir][2]))
  829.             right = Position(getNewPosByDir(right, dir))
  830.            
  831.             for i = 1, 3 do
  832.                 addEvent(simpleCombat, 600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_BLUE, left2)
  833.                 addEvent(simpleCombat, 600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_CARNIPHILA, left)
  834.                 addEvent(simpleCombat, 600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_YELLOW, mid)
  835.                 addEvent(simpleCombat, 600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_EXPLOSIONHIT, right)
  836.                 addEvent(simpleCombat, 600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_RED, right2)
  837.             end
  838.            
  839.             left2 = Position(getNewPosByDir(left2, dir))
  840.             left = Position(getNewPosByDir(left, dir))
  841.             mid = Position(getNewPosByDir(mid, dir))
  842.             right = Position(getNewPosByDir(right, dir))
  843.             right2 = Position(getNewPosByDir(right2, dir))
  844.            
  845.             for i = 1, 3 do
  846.                 addEvent(simpleCombat, 1100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_BLUE, left2)
  847.                 addEvent(simpleCombat, 1100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_CARNIPHILA, left)
  848.                 addEvent(simpleCombat, 1100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_YELLOW, mid)
  849.                 addEvent(simpleCombat, 1100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_EXPLOSIONHIT, right)
  850.                 addEvent(simpleCombat, 1100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_RED, right2)
  851.             end
  852.            
  853.             left2 = Position(getNewPosByDir(left2, neardirs[dir][1]))
  854.             left = Position(getNewPosByDir(left, neardirs[dir][1]))
  855.             mid = Position(getNewPosByDir(mid, neardirs[dir][1]))
  856.             right = Position(getNewPosByDir(right, neardirs[dir][1]))
  857.             right2 = Position(getNewPosByDir(right2, neardirs[dir][1]))
  858.            
  859.             for i = 1, 3 do
  860.                 addEvent(simpleCombat, 1600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_BLUE, left2)
  861.                 addEvent(simpleCombat, 1600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_CARNIPHILA, left)
  862.                 addEvent(simpleCombat, 1600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_YELLOW, mid)
  863.                 addEvent(simpleCombat, 1600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_EXPLOSIONHIT, right)
  864.                 addEvent(simpleCombat, 1600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_RED, right2)
  865.             end
  866.            
  867.             left2 = Position(getNewPosByDir(left2, dir))
  868.             left = Position(getNewPosByDir(left, dir))
  869.             mid = Position(getNewPosByDir(mid, dir))
  870.             right = Position(getNewPosByDir(right, dir))
  871.             right2 = Position(getNewPosByDir(right2, dir))
  872.            
  873.             for i = 1, 3 do
  874.                 addEvent(simpleCombat, 2100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_BLUE, left2)
  875.                 addEvent(simpleCombat, 2100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_CARNIPHILA, left)
  876.                 addEvent(simpleCombat, 2100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_YELLOW, mid)
  877.                 addEvent(simpleCombat, 2100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_EXPLOSIONHIT, right)
  878.                 addEvent(simpleCombat, 2100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_RED, right2)
  879.             end
  880.            
  881.             left2 = Position(getNewPosByDir(left2, neardirs[dir][2]))
  882.             left = Position(getNewPosByDir(left, neardirs[dir][2]))
  883.             mid = Position(getNewPosByDir(mid, neardirs[dir][2]))
  884.             right = Position(getNewPosByDir(right, neardirs[dir][2]))
  885.             right2 = Position(getNewPosByDir(right2, neardirs[dir][2]))
  886.            
  887.             for i = 1, 3 do
  888.                 addEvent(simpleCombat, 2600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_BLUE, left2)
  889.                 addEvent(simpleCombat, 2600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_CARNIPHILA, left)
  890.                 addEvent(simpleCombat, 2600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_YELLOW, mid)
  891.                 addEvent(simpleCombat, 2600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_EXPLOSIONHIT, right)
  892.                 addEvent(simpleCombat, 2600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_RED, right2)
  893.             end
  894.            
  895.             left2 = Position(getNewPosByDir(left2, dir))
  896.             left = Position(getNewPosByDir(left, dir))
  897.             mid = Position(getNewPosByDir(mid, dir))
  898.             right = Position(getNewPosByDir(right, dir))
  899.             right2 = Position(getNewPosByDir(right2, dir))
  900.            
  901.             for i = 1, 3 do
  902.                 addEvent(simpleCombat, 3100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_BLUE, left2)
  903.                 addEvent(simpleCombat, 3100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_CARNIPHILA, left)
  904.                 addEvent(simpleCombat, 3100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_YELLOW, mid)
  905.                 addEvent(simpleCombat, 3100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_EXPLOSIONHIT, right)
  906.                 addEvent(simpleCombat, 3100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_RED, right2)
  907.             end
  908.            
  909.             left2 = Position(getNewPosByDir(left2, neardirs[dir][1]))
  910.             left = Position(getNewPosByDir(left, neardirs[dir][1]))
  911.             mid = Position(getNewPosByDir(mid, neardirs[dir][1]))
  912.             right = Position(getNewPosByDir(right, neardirs[dir][1]))
  913.             right2 = Position(getNewPosByDir(right2, neardirs[dir][1]))
  914.            
  915.             for i = 1, 3 do
  916.                 addEvent(simpleCombat, 3600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_BLUE, left2)
  917.                 addEvent(simpleCombat, 3600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_CARNIPHILA, left)
  918.                 addEvent(simpleCombat, 3600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_YELLOW, mid)
  919.                 addEvent(simpleCombat, 3600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_EXPLOSIONHIT, right)
  920.                 addEvent(simpleCombat, 3600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_RED, right2)
  921.             end
  922.            
  923.             left2 = Position(getNewPosByDir(left2, dir))
  924.             left = Position(getNewPosByDir(left, dir))
  925.             mid = Position(getNewPosByDir(mid, dir))
  926.             right = Position(getNewPosByDir(right, dir))
  927.             right2 = Position(getNewPosByDir(right2, dir))
  928.            
  929.             for i = 1, 3 do
  930.                 addEvent(simpleCombat, 4100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_BLUE, left2)
  931.                 addEvent(simpleCombat, 4100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_CARNIPHILA, left)
  932.                 addEvent(simpleCombat, 4100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_YELLOW, mid)
  933.                 addEvent(simpleCombat, 4100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_EXPLOSIONHIT, right)
  934.                 addEvent(simpleCombat, 4100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_RED, right2)
  935.             end
  936.            
  937.             left2 = Position(getNewPosByDir(left2, neardirs[dir][2]))
  938.             left = Position(getNewPosByDir(left, neardirs[dir][2]))
  939.             mid = Position(getNewPosByDir(mid, neardirs[dir][2]))
  940.             right = Position(getNewPosByDir(right, neardirs[dir][2]))
  941.             right2 = Position(getNewPosByDir(right2, neardirs[dir][2]))
  942.            
  943.             for i = 1, 3 do
  944.                 addEvent(simpleCombat, 4600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_BLUE, left2)
  945.                 addEvent(simpleCombat, 4600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_CARNIPHILA, left)
  946.                 addEvent(simpleCombat, 4600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_YELLOW, mid)
  947.                 addEvent(simpleCombat, 4600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_EXPLOSIONHIT, right)
  948.                 addEvent(simpleCombat, 4600 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_RED, right2)
  949.             end
  950.            
  951.             left2 = Position(getNewPosByDir(left2, dir))
  952.             left = Position(getNewPosByDir(left, dir))
  953.             mid = Position(getNewPosByDir(mid, dir))
  954.             right = Position(getNewPosByDir(right, dir))
  955.             right2 = Position(getNewPosByDir(right2, dir))
  956.            
  957.             for i = 1, 3 do
  958.                 addEvent(simpleCombat, 5100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_BLUE, left2)
  959.                 addEvent(simpleCombat, 5100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_CARNIPHILA, left)
  960.                 addEvent(simpleCombat, 5100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_YELLOW, mid)
  961.                 addEvent(simpleCombat, 5100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_EXPLOSIONHIT, right)
  962.                 addEvent(simpleCombat, 5100 + (500 * (i - 1) + (4000 * ( k - 1))), cid, COMBAT_PHYSICALDAMAGE, -50, -300, CONST_ME_FIREWORK_RED, right2)
  963.             end
  964.         end
  965.  
  966.         return true
  967.     end,
  968.     darkServants = function(cid, order)
  969.         local monster = Monster(cid)
  970.         if not monster then
  971.             return true
  972.         end
  973.        
  974.         for i = 1, 30 do
  975.             addEvent(demoneko.hellspawnOrb, math.max(100, 1000 * (i - 1)), cid, order)
  976.         end
  977.        
  978.         for i = 1, 15 do
  979.             addEvent(demoneko.simpleShot, math.max(100, 2000 * (i - 1)), cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGKNIFE, CONST_ME_HITAREA, order)
  980.             addEvent(demoneko.clockInit, math.max(100, 2000 * (i - 1)), cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGKNIFE, CONST_ME_HITAREA, order, true)
  981.         end
  982.         return true
  983.     end,
  984.     hellspawnOrb = function(cid, order)
  985.         local monster = Monster(cid)
  986.         if not monster then
  987.             return true
  988.         end
  989.        
  990.         if monster:getTempStorage(spellstor) ~= order then
  991.             return true
  992.         end
  993.        
  994.         local pos = monster:getPosition()
  995.         local dir = math.random(0, 3)
  996.         demoneko.putHellspawnOrb(cid, getNewPosByDir(pos, dir), dir, dir, 0, order)
  997.         return true
  998.     end,
  999.     putHellspawnOrb = function(cid, pos, dir, ndir, step, order)
  1000.         local monster = Monster(cid)
  1001.         if not monster then return true end
  1002.  
  1003.         pos = Position(pos)    
  1004.         if monster:getTempStorage(spellstor) ~= order then
  1005.             pos:sendMagicEffect(CONST_ME_POFF)
  1006.             return true
  1007.         end
  1008.        
  1009.         local npos = Position(getNewPosByDir(pos, dir))
  1010.         if step == 2 then
  1011.             ndir = neardirs[dir][math.random(1, 2)]
  1012.             dir = turndirs[dir][ndir] or dir
  1013.             npos = Position(getNewPosByDir(pos, ndir))
  1014.             step = 0
  1015.         end
  1016.        
  1017.         if math.random(1, 100) <= 5 then
  1018.             if #monster:getSummons() < maxsummons then
  1019.                 Game.createMonster("Hellspawn", pos):setMaster(monster)
  1020.                 return true
  1021.             end
  1022.         end
  1023.        
  1024.         if npos:isPathable(true, true) then
  1025.             pos:sendDistanceEffect(npos, CONST_ANI_DEATH)
  1026.             addEvent(simpleCombat, 100, cid, COMBAT_DEATHDAMAGE, -50, -250, CONST_ME_MORTAREA, npos)
  1027.             addEvent(doSendDistanceShoot, 900, pos, npos, CONST_ANI_DEATH)
  1028.             addEvent(simpleCombat, 1000, cid, COMBAT_DEATHDAMAGE, -50, -250, CONST_ME_MORTAREA, npos)
  1029.             addEvent(doSendDistanceShoot, 1900, pos, npos, CONST_ANI_DEATH)
  1030.             addEvent(simpleCombat, 2000, cid, COMBAT_DEATHDAMAGE, -50, -250, CONST_ME_MORTAREA, npos)
  1031.             addEvent(demoneko.putHellspawnOrb, 1000, cid, npos, dir, ndir, step + 1, order)
  1032.         else
  1033.             simpleCombat(cid, COMBAT_DEATHDAMAGE, -50, -250, CONST_ME_MORTAREA, npos, true)
  1034.         end
  1035.         return true
  1036.     end,
  1037.     catMusik = function(cid, order)
  1038.         local monster = Monster(cid)
  1039.         if not monster then return true end
  1040.        
  1041.         local summons = monster:getSummons()
  1042.         if #summons > 0 then
  1043.             for i = 1, #summons do
  1044.                 summons[i]:remove()
  1045.             end
  1046.         end
  1047.        
  1048.         for i = 1, 20 do
  1049.             addEvent(demoneko.soundWave, math.min(29500, math.max(100, 1000 * (i - 1))), cid, math.random(0, 3), sounds[math.random(1, #sounds)], order)
  1050.             addEvent(demoneko.soundWave, math.min(29500, math.max(100, 1000 + (1000 * (i - 1)))), cid, math.random(4, 7), sounds[math.random(1, #sounds)], order)
  1051.         end
  1052.        
  1053.         addEvent(demoneko.escape, 50000, cid)
  1054.         return true
  1055.     end,
  1056.     soundWave = function(cid, dir, effect, order)
  1057.         local monster = Monster(cid)
  1058.         if not monster then return true end
  1059.         if monster:getTempStorage(specialstor) < os.time() then return false end
  1060.         if monster:getTempStorage(spellstor) ~= order then return false end
  1061.        
  1062.         local pos = monster:getPosition()
  1063.         demoneko.soundWaveThrow(cid, COMBAT_PHYSICALDAMAGE, -50, -250, dir, effect, pos, order)
  1064.         local left = getNewPosByDir(pos, neardirs[neardirs[dir][1]][1])
  1065.         local right = getNewPosByDir(pos, neardirs[neardirs[dir][2]][2])
  1066.         addEvent(demoneko.soundWaveThrow, 1000, cid, COMBAT_PHYSICALDAMAGE, -50, -250, dir, effect, left, order)
  1067.         addEvent(demoneko.soundWaveThrow, 1000, cid, COMBAT_PHYSICALDAMAGE, -50, -250, dir, effect, right, order)
  1068.        
  1069.         left = getNewPosByDir(left, neardirs[neardirs[dir][1]][1])
  1070.         right = getNewPosByDir(right, neardirs[neardirs[dir][2]][2])
  1071.         addEvent(demoneko.soundWaveThrow, 2000, cid, COMBAT_PHYSICALDAMAGE, -50, -250, dir, effect, left, order)
  1072.         addEvent(demoneko.soundWaveThrow, 2000, cid, COMBAT_PHYSICALDAMAGE, -50, -250, dir, effect, right, order)
  1073.         return true
  1074.     end,
  1075.     soundWaveThrow = function(cid, combat, mind, maxd, dir, effect, pos, order)
  1076.         local monster = Monster(cid)
  1077.         if not monster then return true end
  1078.        
  1079.         local npos = Position(getNewPosByDir(pos, dir))
  1080.         if monster:getTempStorage(specialstor) < os.time() then
  1081.             npos:sendMagicEffect(CONST_ME_POFF)
  1082.             return false
  1083.         end
  1084.        
  1085.         if monster:getTempStorage(spellstor) ~= order then
  1086.             npos:sendMagicEffect(CONST_ME_POFF)
  1087.             return false
  1088.         end
  1089.        
  1090.         if npos:isPathable(true, true) then
  1091.             simpleCombat(cid, combat, mind, maxd, effect, npos)
  1092.             addEvent(demoneko.soundWaveThrow, 1000, cid, combat, mind, maxd, dir, effect, npos, order)
  1093.         else
  1094.             simpleCombat(cid, combat, mind, maxd, effect, npos)
  1095.         end
  1096.         return true
  1097.     end,
  1098.     escape = function(cid)
  1099.         local monster = Monster(cid)
  1100.         if not monster then return true end
  1101.  
  1102.         local mpos = monster:getPosition()
  1103.         mpos:sendMagicEffect(CONST_ME_POFF)
  1104.         Position(getNewPosByDir(mpos, DIRECTION_EAST)):sendMagicEffect(CONST_ME_SMOKE)
  1105.         monster:say("The cat mage escaped.", TALKTYPE_MONSTER_SAY)
  1106.        
  1107.         monster:remove()
  1108.     end,
  1109. }
  1110.  
  1111. neko = {
  1112.     exhaust = {},
  1113.     onThink = function(self, interval)
  1114.         local cid = self:getId()
  1115.         if not neko.exhaust[cid] then
  1116.             neko.exhaust[cid] = {}
  1117.         end
  1118.        
  1119.         if math.random(1, 100) <= 95 then
  1120.             if not neko.exhaust[cid].cat then
  1121.                 neko.exhaust[cid].cat = 0
  1122.             end
  1123.            
  1124.             if neko.exhaust[cid].cat > os.time() then
  1125.                 return false
  1126.             end
  1127.            
  1128.             neko.exhaust[cid].cat = os.time() + 2
  1129.            
  1130.             local target = self:getTarget()
  1131.             if target then
  1132.                 local pos = self:getPosition()
  1133.                 local catpos = {x = pos.x + math.random(-1, 1), y = pos.y + math.random(-1, 1), z = pos.z}
  1134.                 local getcat = Game.createMonster("Cat", catpos)
  1135.                 if getcat then
  1136.                     local catid = getcat:getId()
  1137.                     local tpos = target:getPosition()
  1138.                     local path = getcat:getPathTo(tpos)
  1139.                     if path then
  1140.                         table.insert(path, path[#path])
  1141.                         table.insert(path, path[#path])
  1142.                         table.insert(path, path[#path])
  1143.                         for i = 1, #path do
  1144.                             addEvent(demoneko.moveCat, (50 * i) + 50, self:getId(), catid, path[i], nil, true)
  1145.                         end
  1146.                         addEvent(doRemoveCreature, (50 * #path) + 200, catid)
  1147.                     else
  1148.                         local newx = 0
  1149.                         local newy = 0
  1150.                         local mindist = 4
  1151.                         local maxdist = 7
  1152.  
  1153.                         if math.random(1, 2) == 1 then
  1154.                             newx = math.random(-maxdist, maxdist)
  1155.                             if math.random(1, 2) == 1 then
  1156.                                 newy = math.random(-mindist, -maxdist)
  1157.                             else
  1158.                                 newy = math.random(mindist, maxdist)           
  1159.                             end
  1160.                         else
  1161.                             newy = math.random(-maxdist, maxdist)
  1162.                             if math.random(1, 2) == 1 then
  1163.                                 newx = math.random(-mindist, -maxdist)
  1164.                             else
  1165.                                 newx = math.random(mindist, maxdist)           
  1166.                             end
  1167.                         end
  1168.                        
  1169.                         local path = getcat:getPathTo({x = pos.x + newx, y = pos.y + newy, z = pos.z})
  1170.                         if path then
  1171.                             table.insert(path, path[#path])
  1172.                             table.insert(path, path[#path])
  1173.                             table.insert(path, path[#path])
  1174.                             for i = 1, #path do
  1175.                                 addEvent(demoneko.moveCat, (50 * i) + 50, self:getId(), catid, path[i], nil, true)
  1176.                             end
  1177.                             addEvent(doRemoveCreature, (50 * #path) + 200, catid)
  1178.                         else
  1179.                             getcat:remove()
  1180.                         end
  1181.                     end
  1182.                 end
  1183.             end
  1184.         end
  1185.        
  1186.         if math.random(1, 100) <= 10 then
  1187.             if not neko.exhaust[cid].knife then
  1188.                 neko.exhaust[cid].knife = 0
  1189.             end
  1190.            
  1191.             if neko.exhaust[cid].knife > os.time() then
  1192.                 return false
  1193.             end
  1194.            
  1195.             neko.exhaust[cid].knife = os.time() + 10
  1196.            
  1197.             local pos = self:getPosition()
  1198.             local dir = self:getDirection()
  1199.  
  1200.             local left = Position(getNewPosByDir(pos, neardirs[dir][1]))
  1201.             local mid = Position(getNewPosByDir(pos, dir))
  1202.             local right = Position(getNewPosByDir(pos, neardirs[dir][2]))
  1203.  
  1204.             local combat = COMBAT_PHYSICALDAMAGE
  1205.             local shooteffect = CONST_ANI_THROWINGKNIFE
  1206.             local areaeffect = CONST_ME_GROUNDSHAKER
  1207.             local order = self:getTempStorage(spellstor)
  1208.            
  1209.             pos:sendDistanceEffect(left, shooteffect)
  1210.             pos:sendDistanceEffect(mid, shooteffect)
  1211.             pos:sendDistanceEffect(right, shooteffect)
  1212.                
  1213.             addEvent(simpleCombat, 100, cid, combat, -50, -250, areaeffect, left, true)
  1214.             addEvent(simpleCombat, 100, cid, combat, -50, -250, areaeffect, mid, true)
  1215.             addEvent(simpleCombat, 100, cid, combat, -50, -250, areaeffect, right, true)
  1216.            
  1217.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, left, neardirs[dir][1], -50, -250, shooteffect, areaeffect, 1, order)
  1218.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, mid, dir, -50, -250, shooteffect, areaeffect, 1, order)
  1219.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, right, neardirs[dir][2], -50, -250, shooteffect, areaeffect, 1, order)
  1220.            
  1221.             addEvent(Position.sendDistanceEffect, 300, pos, left, shooteffect)
  1222.             addEvent(Position.sendDistanceEffect, 300, pos, mid, shooteffect)
  1223.             addEvent(Position.sendDistanceEffect, 300, pos, right, shooteffect)
  1224.                
  1225.             addEvent(simpleCombat, 400, cid, combat, -50, -250, areaeffect, left, true)
  1226.             addEvent(simpleCombat, 400, cid, combat, -50, -250, areaeffect, mid, true)
  1227.             addEvent(simpleCombat, 400, cid, combat, -50, -250, areaeffect, right, true)
  1228.            
  1229.             addEvent(demoneko.moveSimpleShot, 400, cid, combat, left, neardirs[dir][1], -50, -250, shooteffect, areaeffect, 1, order)
  1230.             addEvent(demoneko.moveSimpleShot, 400, cid, combat, mid, dir, -50, -250, shooteffect, areaeffect, 1, order)
  1231.             addEvent(demoneko.moveSimpleShot, 400, cid, combat, right, neardirs[dir][2], -50, -250, shooteffect, areaeffect, 1, order)
  1232.  
  1233.             addEvent(Position.sendDistanceEffect, 500, pos, left, shooteffect)
  1234.             addEvent(Position.sendDistanceEffect, 500, pos, mid, shooteffect)
  1235.             addEvent(Position.sendDistanceEffect, 500, pos, right, shooteffect)
  1236.                
  1237.             addEvent(simpleCombat, 600, cid, combat, -50, -250, areaeffect, left, true)
  1238.             addEvent(simpleCombat, 600, cid, combat, -50, -250, areaeffect, mid, true)
  1239.             addEvent(simpleCombat, 600, cid, combat, -50, -250, areaeffect, right, true)
  1240.            
  1241.             addEvent(demoneko.moveSimpleShot, 600, cid, combat, left, neardirs[dir][1], -50, -250, shooteffect, areaeffect, 1, order)
  1242.             addEvent(demoneko.moveSimpleShot, 600, cid, combat, mid, dir, -50, -250, shooteffect, areaeffect, 1, order)
  1243.             addEvent(demoneko.moveSimpleShot, 600, cid, combat, right, neardirs[dir][2], -50, -250, shooteffect, areaeffect, 1, order)
  1244.            
  1245.             if math.random(1, 100) <= 90 then
  1246.                 addEvent(demoneko.moveSelf, 700, cid, math.random(3, 7), math.random(3, 7), order)
  1247.             end
  1248.             return false
  1249.         end
  1250.        
  1251.         if math.random(1, 100) <= 2 then
  1252.             if not neko.exhaust[cid].orbv then
  1253.                 neko.exhaust[cid].orbv = 0
  1254.             end
  1255.            
  1256.             if neko.exhaust[cid].orbv > os.time() then
  1257.                 return false
  1258.             end
  1259.            
  1260.             neko.exhaust[cid].orbv = os.time() + 10
  1261.            
  1262.             demoneko.orbWave(cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  1263.             addEvent(demoneko.orbWave, 100, cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  1264.             addEvent(demoneko.orbWave, 150, cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  1265.             return false
  1266.         end
  1267.        
  1268.         if math.random(1, 100) <= 2 then
  1269.             if not neko.exhaust[cid].fv then
  1270.                 neko.exhaust[cid].fv = 0
  1271.             end
  1272.            
  1273.             if neko.exhaust[cid].fv > os.time() then
  1274.                 return false
  1275.             end
  1276.            
  1277.             neko.exhaust[cid].fv = os.time() + 10
  1278.            
  1279.             demoneko.simpleWave(cid, COMBAT_FIREDAMAGE, CONST_ANI_FIRE, CONST_ME_FIREATTACK)
  1280.             return false
  1281.         end
  1282.         return false
  1283.     end,
  1284. }
  1285.  
  1286. noviceneko = {
  1287.     onThink = function(self, interval)
  1288.         local cid = self:getId()
  1289.         if not neko.exhaust[cid] then
  1290.             neko.exhaust[cid] = {}
  1291.         end
  1292.        
  1293.         if math.random(1, 100) <= 95 then
  1294.             if not neko.exhaust[cid].cat then
  1295.                 neko.exhaust[cid].cat = 0
  1296.             end
  1297.            
  1298.             if neko.exhaust[cid].cat > os.time() then
  1299.                 return false
  1300.             end
  1301.            
  1302.             neko.exhaust[cid].cat = os.time() + 4
  1303.            
  1304.             local target = self:getTarget()
  1305.             if target then
  1306.                 local pos = self:getPosition()
  1307.                 local catpos = {x = pos.x + math.random(-1, 1), y = pos.y + math.random(-1, 1), z = pos.z}
  1308.                 local getcat = Game.createMonster("Cat", catpos)
  1309.                 if getcat then
  1310.                     local catid = getcat:getId()
  1311.                     local tpos = target:getPosition()
  1312.                     local path = getcat:getPathTo(tpos)
  1313.                     if path then
  1314.                         table.insert(path, path[#path])
  1315.                         table.insert(path, path[#path])
  1316.                         table.insert(path, path[#path])
  1317.                         for i = 1, #path do
  1318.                             addEvent(demoneko.moveCat, (50 * i) + 50, self:getId(), catid, path[i], nil, true)
  1319.                         end
  1320.                         addEvent(doRemoveCreature, (50 * #path) + 200, catid)
  1321.                     else
  1322.                         local newx = 0
  1323.                         local newy = 0
  1324.                         local mindist = 4
  1325.                         local maxdist = 7
  1326.  
  1327.                         if math.random(1, 2) == 1 then
  1328.                             newx = math.random(-maxdist, maxdist)
  1329.                             if math.random(1, 2) == 1 then
  1330.                                 newy = math.random(-mindist, -maxdist)
  1331.                             else
  1332.                                 newy = math.random(mindist, maxdist)           
  1333.                             end
  1334.                         else
  1335.                             newy = math.random(-maxdist, maxdist)
  1336.                             if math.random(1, 2) == 1 then
  1337.                                 newx = math.random(-mindist, -maxdist)
  1338.                             else
  1339.                                 newx = math.random(mindist, maxdist)           
  1340.                             end
  1341.                         end
  1342.                        
  1343.                         local path = getcat:getPathTo({x = pos.x + newx, y = pos.y + newy, z = pos.z})
  1344.                         if path then
  1345.                             table.insert(path, path[#path])
  1346.                             table.insert(path, path[#path])
  1347.                             table.insert(path, path[#path])
  1348.                             for i = 1, #path do
  1349.                                 addEvent(demoneko.moveCat, (50 * i) + 50, self:getId(), catid, path[i], nil, true)
  1350.                             end
  1351.                             addEvent(doRemoveCreature, (50 * #path) + 200, catid)
  1352.                         else
  1353.                             getcat:remove()
  1354.                         end
  1355.                     end
  1356.                 end
  1357.             end
  1358.         end
  1359.        
  1360.         if math.random(1, 100) <= 10 then
  1361.             if not neko.exhaust[cid].knife then
  1362.                 neko.exhaust[cid].knife = 0
  1363.             end
  1364.            
  1365.             if neko.exhaust[cid].knife > os.time() then
  1366.                 return false
  1367.             end
  1368.            
  1369.             neko.exhaust[cid].knife = os.time() + 10
  1370.            
  1371.             local pos = self:getPosition()
  1372.             local dir = self:getDirection()
  1373.  
  1374.             local left = Position(getNewPosByDir(pos, neardirs[dir][1]))
  1375.             local mid = Position(getNewPosByDir(pos, dir))
  1376.             local right = Position(getNewPosByDir(pos, neardirs[dir][2]))
  1377.  
  1378.             local combat = COMBAT_PHYSICALDAMAGE
  1379.             local shooteffect = CONST_ANI_THROWINGKNIFE
  1380.             local areaeffect = CONST_ME_GROUNDSHAKER
  1381.             local order = self:getTempStorage(spellstor)
  1382.            
  1383.             pos:sendDistanceEffect(left, shooteffect)
  1384.             pos:sendDistanceEffect(mid, shooteffect)
  1385.             pos:sendDistanceEffect(right, shooteffect)
  1386.                
  1387.             addEvent(simpleCombat, 100, cid, combat, -50, -150, areaeffect, left, true)
  1388.             addEvent(simpleCombat, 100, cid, combat, -50, -150, areaeffect, mid, true)
  1389.             addEvent(simpleCombat, 100, cid, combat, -50, -150, areaeffect, right, true)
  1390.            
  1391.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, left, neardirs[dir][1], -50, -150, shooteffect, areaeffect, 1, order)
  1392.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, mid, dir, -50, -150, shooteffect, areaeffect, 1, order)
  1393.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, right, neardirs[dir][2], -50, -150, shooteffect, areaeffect, 1, order)
  1394.             return false
  1395.         end
  1396.        
  1397.         if math.random(1, 1000) <= 3 then
  1398.             if not neko.exhaust[cid].orbv then
  1399.                 neko.exhaust[cid].orbv = 0
  1400.             end
  1401.            
  1402.             if neko.exhaust[cid].orbv > os.time() then
  1403.                 return false
  1404.             end
  1405.            
  1406.             neko.exhaust[cid].orbv = os.time() + 10
  1407.            
  1408.             demoneko.orbWave(cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  1409.             addEvent(demoneko.orbWave, 100, cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  1410.             addEvent(demoneko.orbWave, 150, cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  1411.             return false
  1412.         end
  1413.        
  1414.         if math.random(1, 1000) <= 3 then
  1415.             if not neko.exhaust[cid].fv then
  1416.                 neko.exhaust[cid].fv = 0
  1417.             end
  1418.            
  1419.             if neko.exhaust[cid].fv > os.time() then
  1420.                 return false
  1421.             end
  1422.            
  1423.             neko.exhaust[cid].fv = os.time() + 10
  1424.            
  1425.             demoneko.simpleWave(cid, COMBAT_FIREDAMAGE, CONST_ANI_FIRE, CONST_ME_FIREATTACK)
  1426.             return false
  1427.         end
  1428.         return false
  1429.     end,
  1430. }
  1431.  
  1432. nekoelite = {
  1433.     exhaust = {},
  1434.     onThink = function(self, interval)
  1435.         local cid = self:getId()
  1436.         if not neko.exhaust[cid] then
  1437.             neko.exhaust[cid] = {}
  1438.         end
  1439.        
  1440.         if math.random(1, 100) <= 95 then
  1441.             local target = self:getTarget()
  1442.             if target then
  1443.                 local pos = self:getPosition()
  1444.                 local catpos = {x = pos.x + math.random(-1, 1), y = pos.y + math.random(-1, 1), z = pos.z}
  1445.                 local getcat = Game.createMonster("Cat", catpos)
  1446.                 if getcat then
  1447.                     local catid = getcat:getId()
  1448.                     local tpos = target:getPosition()
  1449.                     local path = getcat:getPathTo(tpos)
  1450.                     if path then
  1451.                         table.insert(path, path[#path])
  1452.                         table.insert(path, path[#path])
  1453.                         table.insert(path, path[#path])
  1454.                         for i = 1, #path do
  1455.                             addEvent(demoneko.moveCat, (50 * i) + 50, self:getId(), catid, path[i], nil, true)
  1456.                         end
  1457.                         addEvent(doRemoveCreature, (50 * #path) + 200, catid)
  1458.                     else
  1459.                         local newx = 0
  1460.                         local newy = 0
  1461.                         local mindist = 4
  1462.                         local maxdist = 7
  1463.  
  1464.                         if math.random(1, 2) == 1 then
  1465.                             newx = math.random(-maxdist, maxdist)
  1466.                             if math.random(1, 2) == 1 then
  1467.                                 newy = math.random(-mindist, -maxdist)
  1468.                             else
  1469.                                 newy = math.random(mindist, maxdist)           
  1470.                             end
  1471.                         else
  1472.                             newy = math.random(-maxdist, maxdist)
  1473.                             if math.random(1, 2) == 1 then
  1474.                                 newx = math.random(-mindist, -maxdist)
  1475.                             else
  1476.                                 newx = math.random(mindist, maxdist)           
  1477.                             end
  1478.                         end
  1479.                        
  1480.                         local path = getcat:getPathTo({x = pos.x + newx, y = pos.y + newy, z = pos.z})
  1481.                         if path then
  1482.                             table.insert(path, path[#path])
  1483.                             table.insert(path, path[#path])
  1484.                             table.insert(path, path[#path])
  1485.                             for i = 1, #path do
  1486.                                 addEvent(demoneko.moveCat, (50 * i) + 50, self:getId(), catid, path[i], nil, true)
  1487.                             end
  1488.                             addEvent(doRemoveCreature, (50 * #path) + 200, catid)
  1489.                         else
  1490.                             getcat:remove()
  1491.                         end
  1492.                     end
  1493.                 end
  1494.             end
  1495.         end
  1496.        
  1497.         if math.random(1, 100) <= 10 then
  1498.             if not neko.exhaust[cid].knife then
  1499.                 neko.exhaust[cid].knife = 0
  1500.             end
  1501.            
  1502.             if neko.exhaust[cid].knife > os.time() then
  1503.                 return false
  1504.             end
  1505.            
  1506.             neko.exhaust[cid].knife = os.time() + 10
  1507.            
  1508.             local pos = self:getPosition()
  1509.             local dir = self:getDirection()
  1510.  
  1511.             local left = Position(getNewPosByDir(pos, neardirs[dir][1]))
  1512.             local mid = Position(getNewPosByDir(pos, dir))
  1513.             local right = Position(getNewPosByDir(pos, neardirs[dir][2]))
  1514.  
  1515.             local combat = COMBAT_PHYSICALDAMAGE
  1516.             local shooteffect = CONST_ANI_THROWINGKNIFE
  1517.             local areaeffect = CONST_ME_GROUNDSHAKER
  1518.             local order = self:getTempStorage(spellstor)
  1519.            
  1520.             pos:sendDistanceEffect(left, shooteffect)
  1521.             pos:sendDistanceEffect(mid, shooteffect)
  1522.             pos:sendDistanceEffect(right, shooteffect)
  1523.                
  1524.             addEvent(simpleCombat, 100, cid, combat, -50, -100, areaeffect, left, true)
  1525.             addEvent(simpleCombat, 100, cid, combat, -50, -100, areaeffect, mid, true)
  1526.             addEvent(simpleCombat, 100, cid, combat, -50, -100, areaeffect, right, true)
  1527.            
  1528.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, left, neardirs[dir][1], -50, -100, shooteffect, areaeffect, 1, order)
  1529.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, mid, dir, -50, -100, shooteffect, areaeffect, 1, order)
  1530.             addEvent(demoneko.moveSimpleShot, 100, cid, combat, right, neardirs[dir][2], -50, -100, shooteffect, areaeffect, 1, order)
  1531.            
  1532.             addEvent(Position.sendDistanceEffect, 300, pos, left, shooteffect)
  1533.             addEvent(Position.sendDistanceEffect, 300, pos, mid, shooteffect)
  1534.             addEvent(Position.sendDistanceEffect, 300, pos, right, shooteffect)
  1535.                
  1536.             addEvent(simpleCombat, 400, cid, combat, -50, -100, areaeffect, left, true)
  1537.             addEvent(simpleCombat, 400, cid, combat, -50, -100, areaeffect, mid, true)
  1538.             addEvent(simpleCombat, 400, cid, combat, -50, -100, areaeffect, right, true)
  1539.            
  1540.             addEvent(demoneko.moveSimpleShot, 400, cid, combat, left, neardirs[dir][1], -50, -100, shooteffect, areaeffect, 1, order)
  1541.             addEvent(demoneko.moveSimpleShot, 400, cid, combat, mid, dir, -50, -100, shooteffect, areaeffect, 1, order)
  1542.             addEvent(demoneko.moveSimpleShot, 400, cid, combat, right, neardirs[dir][2], -50, -100, shooteffect, areaeffect, 1, order)
  1543.  
  1544.             addEvent(Position.sendDistanceEffect, 500, pos, left, shooteffect)
  1545.             addEvent(Position.sendDistanceEffect, 500, pos, mid, shooteffect)
  1546.             addEvent(Position.sendDistanceEffect, 500, pos, right, shooteffect)
  1547.                
  1548.             addEvent(simpleCombat, 600, cid, combat, -50, -100, areaeffect, left, true)
  1549.             addEvent(simpleCombat, 600, cid, combat, -50, -100, areaeffect, mid, true)
  1550.             addEvent(simpleCombat, 600, cid, combat, -50, -100, areaeffect, right, true)
  1551.            
  1552.             addEvent(demoneko.moveSimpleShot, 600, cid, combat, left, neardirs[dir][1], -50, -100, shooteffect, areaeffect, 1, order)
  1553.             addEvent(demoneko.moveSimpleShot, 600, cid, combat, mid, dir, -50, -100, shooteffect, areaeffect, 1, order)
  1554.             addEvent(demoneko.moveSimpleShot, 600, cid, combat, right, neardirs[dir][2], -50, -100, shooteffect, areaeffect, 1, order)
  1555.            
  1556.             addEvent(Position.sendDistanceEffect, 700, pos, left, shooteffect)
  1557.             addEvent(Position.sendDistanceEffect, 700, pos, mid, shooteffect)
  1558.             addEvent(Position.sendDistanceEffect, 700, pos, right, shooteffect)
  1559.                
  1560.             addEvent(simpleCombat, 800, cid, combat, -50, -100, areaeffect, left, true)
  1561.             addEvent(simpleCombat, 800, cid, combat, -50, -100, areaeffect, mid, true)
  1562.             addEvent(simpleCombat, 800, cid, combat, -50, -100, areaeffect, right, true)
  1563.            
  1564.             addEvent(demoneko.moveSimpleShot, 800, cid, combat, left, neardirs[dir][1], -50, -100, shooteffect, areaeffect, 1, order)
  1565.             addEvent(demoneko.moveSimpleShot, 800, cid, combat, mid, dir, -50, -100, shooteffect, areaeffect, 1, order)
  1566.             addEvent(demoneko.moveSimpleShot, 800, cid, combat, right, neardirs[dir][2], -50, -100, shooteffect, areaeffect, 1, order)
  1567.  
  1568.             addEvent(Position.sendDistanceEffect, 900, pos, left, shooteffect)
  1569.             addEvent(Position.sendDistanceEffect, 900, pos, mid, shooteffect)
  1570.             addEvent(Position.sendDistanceEffect, 900, pos, right, shooteffect)
  1571.                
  1572.             addEvent(simpleCombat, 1000, cid, combat, -50, -100, areaeffect, left, true)
  1573.             addEvent(simpleCombat, 1000, cid, combat, -50, -100, areaeffect, mid, true)
  1574.             addEvent(simpleCombat, 1000, cid, combat, -50, -100, areaeffect, right, true)
  1575.            
  1576.             addEvent(demoneko.moveSimpleShot, 1000, cid, combat, left, neardirs[dir][1], -50, -100, shooteffect, areaeffect, 1, order)
  1577.             addEvent(demoneko.moveSimpleShot, 1000, cid, combat, mid, dir, -50, -100, shooteffect, areaeffect, 1, order)
  1578.             addEvent(demoneko.moveSimpleShot, 1000, cid, combat, right, neardirs[dir][2], -50, -100, shooteffect, areaeffect, 1, order)
  1579.            
  1580.             if math.random(1, 100) <= 90 then
  1581.                 addEvent(demoneko.moveSelf, 1100, cid, math.random(3, 7), math.random(3, 7), order)
  1582.             end
  1583.             return false
  1584.         end
  1585.        
  1586.         if math.random(1, 100) <= 7 then
  1587.             if not neko.exhaust[cid].orbv then
  1588.                 neko.exhaust[cid].orbv = 0
  1589.             end
  1590.            
  1591.             if neko.exhaust[cid].orbv > os.time() then
  1592.                 return false
  1593.             end
  1594.            
  1595.             neko.exhaust[cid].orbv = os.time() + 10
  1596.            
  1597.             demoneko.orbWave(cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  1598.             addEvent(demoneko.orbWave, 100, cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  1599.             addEvent(demoneko.orbWave, 150, cid, COMBAT_PHYSICALDAMAGE, CONST_ANI_THROWINGSTAR, CONST_ME_GROUNDSHAKER)
  1600.             return false
  1601.         end
  1602.        
  1603.         if math.random(1, 100) <= 7 then
  1604.             if not neko.exhaust[cid].fv then
  1605.                 neko.exhaust[cid].fv = 0
  1606.             end
  1607.            
  1608.             if neko.exhaust[cid].fv > os.time() then
  1609.                 return false
  1610.             end
  1611.            
  1612.             neko.exhaust[cid].fv = os.time() + 20
  1613.            
  1614.             demoneko.simpleWave(cid, COMBAT_FIREDAMAGE, CONST_ANI_FIRE, CONST_ME_FIREATTACK)
  1615.             return false
  1616.         end
  1617.        
  1618.         if math.random(1, 100) <= 7 then
  1619.             if not neko.exhaust[cid].hs then
  1620.                 neko.exhaust[cid].hs = 0
  1621.             end
  1622.            
  1623.             if neko.exhaust[cid].hs > os.time() then
  1624.                 return false
  1625.             end
  1626.            
  1627.             neko.exhaust[cid].hs = os.time() + 30
  1628.            
  1629.             demoneko.hellspawnOrb(cid, order)
  1630.             return false
  1631.         end
  1632.        
  1633.         if math.random(1, 100) <= 7 then
  1634.             if not neko.exhaust[cid].sn then
  1635.                 neko.exhaust[cid].sn = 0
  1636.             end
  1637.            
  1638.             if neko.exhaust[cid].sn > os.time() then
  1639.                 return false
  1640.             end
  1641.            
  1642.             neko.exhaust[cid].sn = os.time() + 10
  1643.            
  1644.             demoneko.soundWave(cid, math.random(0, 7), sounds[math.random(1, #sounds)], order)
  1645.             return false
  1646.         end
  1647.        
  1648.         return false
  1649.     end,
  1650. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement