Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.34 KB | None | 0 0
  1. local spellName = "fire striker"
  2. local cf = {atk = spellsInfo[spellName].atk}
  3.  
  4. local MyLocal = {}
  5. MyLocal.players = {}
  6.  
  7. local combat = createCombatObject()
  8. setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
  9.  
  10. function onGetPlayerMinMaxValues(cid, level, magLevel)
  11.     local min = (level+(magLevel/2)*2.1)+math.random(30, 40)
  12.     local max = (level+(magLevel/2)*2.7)+math.random(50, 60)
  13.     if getPlayerInWaterWithUnderwater(cid) then
  14.         min = min*0.5
  15.         max = max*0.5
  16.     end
  17.     local dano = math.random(min, max)
  18.     local atk = cf.atk
  19.     if atk and type(atk) == "number" then
  20.         dano = dano * (atk/100)
  21.         dano = dano+1
  22.     end
  23.     return -dano, -dano
  24. end
  25. setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetPlayerMinMaxValues")
  26.  
  27. local combatFocus = createCombatObject()
  28. setCombatParam(combatFocus, COMBAT_PARAM_TYPE, COMBAT_FIREDAMAGE)
  29.  
  30. function onGetPlayerMinMaxValuesFocus(cid, level, magLevel)
  31.     local min = ((level+(magLevel/2)*2.1)+math.random(30, 40))*1.3
  32.     local max = ((level+(magLevel/2)*2.7)+math.random(50, 60))*1.7
  33.     if getPlayerInWaterWithUnderwater(cid) then
  34.         min = min*0.5
  35.         max = max*0.5
  36.     end
  37.     local dano = math.random(min, max)
  38.     local atk = cf.atk
  39.     if atk and type(atk) == "number" then
  40.         dano = dano * (atk/100)
  41.         dano = dano+1
  42.     end
  43.     return -dano, -dano
  44. end
  45. setCombatCallback(combatFocus, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetPlayerMinMaxValuesFocus")
  46.  
  47. local arr = {
  48.     {1, 1, 1, 1, 1},
  49.     {1, 1, 1, 1, 1},
  50.     {1, 1, 3, 1, 1},
  51.     {1, 1, 1, 1, 1},
  52.     {1, 1, 1, 1, 1}
  53. }
  54.  
  55. setCombatArea(combat, createCombatArea(arr))
  56. setCombatArea(combatFocus, createCombatArea(arr))
  57.  
  58. local function sendDamage(cid, finish, focus)
  59.     if getTileInfo(getCreaturePosition(cid)).protection then return false end
  60.     if not isCreature(cid) then
  61.         return true
  62.     end
  63.     local playerPos = getCreaturePosition(cid)
  64.     doSendMagicEffect({x=playerPos.x+1, y=playerPos.y+1, z=playerPos.z}, 121)
  65.     if focus then
  66.         doCombat(cid, combatFocus, {pos=playerPos, type=2})
  67.     else
  68.         doCombat(cid, combat, {pos=playerPos, type=2})
  69.     end
  70.     if finish then
  71.  
  72.     end
  73. end
  74.  
  75. function onCastSpell(cid, var)
  76.     if getSpellCancels(cid, "fire") == true then
  77.         return false
  78.     end
  79.     if getPlayerExaust(cid, "fire", "striker", fireExausted.striker) == false then
  80.         return false
  81.     end
  82.     if MyLocal.players[cid] == nil then
  83.         if getPlayerHasStun(cid) then
  84.             if getDobrasLevel(cid) >= 17 then
  85.                 doPlayerAddExaust(cid, "fire", "striker", fireExausted.striker-9)
  86.             else
  87.                 doPlayerAddExaust(cid, "fire", "striker", fireExausted.striker)
  88.             end
  89.             workAllCdAndAndPrevCd(cid, "fire", "striker", nil, 1)
  90.             return true
  91.         end
  92.         MyLocal.players[cid] = true
  93.  
  94.         local focused = getPlayerOverPower(cid, "fire", true, true)
  95.         for x = 0, 8 do
  96.             addEvent(sendDamage, 1000*x, cid, x == 8, focused)
  97.         end
  98.         workAllCdAndAndPrevCd(cid, "fire", "striker", nil, 1)
  99.             if getDobrasLevel(cid) >= 17 then
  100.             doPlayerAddExaust(cid, "fire", "striker", 8+fireExausted.striker-9)
  101.         else
  102.             doPlayerAddExaust(cid, "fire", "striker", 8+fireExausted.striker)
  103.         end
  104.    
  105.         MyLocal.players[cid] = nil
  106.         return true
  107.     else
  108.         doPlayerSendCancelEf(cid, "You're already using this fold.")
  109.         return false
  110.     end
  111. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement