Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local eventName = "00testing"
- local percent_limit = 500
- function onStatsChange(cid, attacker, type, combat, value)
- print('LUTA OCORRENDO')
- if type == STATSCHANGE_HEALTHLOSS and value >= 1 then
- -- print('LIST TARGET: '..getMonsterTargetList(attacker)[1]..'') -- Retorna UID
- registerCreatureEvent(getCreatureTarget(attacker), eventName)
- print('REGISTRANDO EVENTO EM: '..getCreatureName(attacker):lower()..' ATACANDO UM '..getCreatureName(getCreatureTarget(attacker)):lower()..'.')
- if getCreatureMaster(attacker) then
- ownSummon = getCreatureMaster(attacker)
- print('TEMOS: '..getCreatureName(attacker):lower()..' ATACANDO UM '..getCreatureName(cid):lower()..'.')
- if isPlayer(ownSummon) then
- local overflow_protection = {}
- if overflow_protection[attacker] then
- overflow_protection[attacker] = nil
- return true
- end
- getML = getPlayerMagLevel(ownSummon)
- getLvL = getPlayerLevel(ownSummon)
- addDMG = getML + getLvL -- Percent
- if addDMG < percent_limit then
- percDMG = math.floor(value*(addDMG/100))
- newValue = (value+percDMG)
- print('True Value: '..value..' // PercDMG: '..percDMG..' // NewValue: '..newValue..' [ML: '..getML..'/ LVL: '..getLvL..'].')
- else
- percDMG = math.floor(value*(percent_limit/100))
- newValue = (value+percDMG)
- print('True Value: '..value..' // PercDMG: '..percDMG..' // NewValue: '..newValue..' [ML: '..getML..'/ LVL: '..getLvL..'].')
- end
- overflow_protection[attacker] = true
- doPlayerSendTextMessage(ownSummon, MESSAGE_STATUS_DEFAULT, "Your "..getCreatureName(attacker).." deals "..newValue.." [hit "..value.." + "..percDMG.." boost damage] to "..(getMonsterInfo(getCreatureName(cid)).description)..".")
- doTargetCombatHealth(attacker, cid, combat, -newValue, -newValue, CONST_ME_NONE)
- return false
- else
- print('SUMMON ISN\'T BY PLAYER // ATTACKER: '..getCreatureName(attacker)..' -> CID: '..getCreatureName(cid)..'.')
- end
- else
- print('NOT IS A SUMMON // ATTACKER: '..getCreatureName(attacker)..' -> CID: '..getCreatureName(cid)..'.')
- end
- else
- print('SEM PERDA DE VIDA // CID: '..getCreatureName(cid)..'.')
- end
- return true
- end
Advertisement
Add Comment
Please, Sign In to add comment