adrianoswatt

Boost System - Incompleto

Sep 25th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.16 KB | None | 0 0
  1. local eventName = "00testing"
  2. local percent_limit = 500
  3.  
  4. function onStatsChange(cid, attacker, type, combat, value)
  5.     print('LUTA OCORRENDO')
  6.     if type == STATSCHANGE_HEALTHLOSS and value >= 1 then
  7.             -- print('LIST TARGET: '..getMonsterTargetList(attacker)[1]..'') -- Retorna UID
  8.             registerCreatureEvent(getCreatureTarget(attacker), eventName)
  9.             print('REGISTRANDO EVENTO EM: '..getCreatureName(attacker):lower()..' ATACANDO UM '..getCreatureName(getCreatureTarget(attacker)):lower()..'.')
  10.         if getCreatureMaster(attacker) then
  11.             ownSummon = getCreatureMaster(attacker)
  12.             print('TEMOS: '..getCreatureName(attacker):lower()..' ATACANDO UM '..getCreatureName(cid):lower()..'.')
  13.             if isPlayer(ownSummon) then
  14.                 local overflow_protection = {}
  15.                 if overflow_protection[attacker] then
  16.                     overflow_protection[attacker] = nil
  17.                     return true
  18.                 end
  19.                 getML = getPlayerMagLevel(ownSummon)
  20.                 getLvL = getPlayerLevel(ownSummon)
  21.                 addDMG = getML + getLvL -- Percent
  22.                 if addDMG < percent_limit then
  23.                     percDMG = math.floor(value*(addDMG/100))
  24.                     newValue = (value+percDMG)
  25.                     print('True Value: '..value..' // PercDMG: '..percDMG..' // NewValue: '..newValue..' [ML: '..getML..'/ LVL: '..getLvL..'].')
  26.                 else
  27.                     percDMG = math.floor(value*(percent_limit/100))
  28.                     newValue = (value+percDMG)
  29.                     print('True Value: '..value..' // PercDMG: '..percDMG..' // NewValue: '..newValue..' [ML: '..getML..'/ LVL: '..getLvL..'].')
  30.                 end
  31.                 overflow_protection[attacker] = true
  32.                 doPlayerSendTextMessage(ownSummon, MESSAGE_STATUS_DEFAULT, "Your "..getCreatureName(attacker).." deals "..newValue.." [hit "..value.." + "..percDMG.." boost damage] to "..(getMonsterInfo(getCreatureName(cid)).description)..".")
  33.                 doTargetCombatHealth(attacker, cid, combat, -newValue, -newValue, CONST_ME_NONE)
  34.                 return false
  35.             else
  36.                 print('SUMMON ISN\'T BY PLAYER // ATTACKER: '..getCreatureName(attacker)..' -> CID: '..getCreatureName(cid)..'.')
  37.             end
  38.         else
  39.             print('NOT IS A SUMMON // ATTACKER: '..getCreatureName(attacker)..' -> CID: '..getCreatureName(cid)..'.')
  40.         end
  41.     else
  42.         print('SEM PERDA DE VIDA // CID: '..getCreatureName(cid)..'.')
  43.     end
  44. return true
  45. end
Advertisement
Add Comment
Please, Sign In to add comment