[Macro] Análise de dano.


Show Show

Recommended Posts

Fiz esse macro com o objetivo de comparar armas e mensurar ganho de dano através de itens com bônus de skill.

 

Descrição

  Fornece algumas informações sobre o dano causado pelo personagem: Dano máximo, dano médio, dano médio por turno, porcentagem de acertos (Hit%), além de uma funcionalidade que permite ignorar danos abaixo de um valor, o que é útil quando se quer testar apenas a magia sem interferência do dano causado pela arma. 

Comentários

  Recomendo que espere ao menos uns 20 minutos atacando sem pausa pra ter uma noção pelo menos razoável. Quanto mais tempo, mais precisa será a medida.

Demonstração

[Macro] Análise de Dano - YouTube

 

1uq7poo.png

 

 

XwCjkQJ.png

 

3FhZeUQ.png

 

Spoiler

local messageText5 = "your attack"

TempoInicio = now
danoMax = 0
danoMin = 10000
dano2s = 0
HitMedio = 0
danoMinuto = 0 
danoHora = 0
danoDia = 0
danoTotal = 0
nHits = 0
HitPercentage = 0



flagTempo = 0
local TempoSwitch = macro(500, "Tempo Decorrido", function() 
if flagTempo==0 then
  TempoAgora = now
  IntervaloTempo = (TempoAgora - TempoInicio)/1000

  minutos = math.floor(IntervaloTempo/60)
  segundos = IntervaloTempo-minutos*60

  if minutos>0 then
   say('Tempo Decorrido: ' .. minutos .. ' minutos ' .. 'e ' .. segundos .. ' segundos.')
  else
   say('Tempo Decorrido: ' .. IntervaloTempo .. ' segundos.')
  end
  flagTempo = 1
end 
 
end)
macro(500, function() 
 if TempoSwitch.isOff() then
   flagTempo = 0
 end
end)

flag = 0


local danoSwitch = macro(2000, "Fala dano causado", function() 

if flag == 0 then
  TempoAgora = now
  IntervaloTempo = (TempoAgora - TempoInicio)/1000
  dano2s = 2*danoTotal/(IntervaloTempo) 
  danoMinuto = math.round(30*dano2s)
  danoHora = 60*danoMinuto
  HitMedio = math.round(danoTotal/nHits)
  

  say('Dano Mínimo: ' .. danoMin)
  
  schedule(1000, function() 
    say('Dano máximo: ' .. danoMax)
  end)
  schedule(2000, function() 
    say('Dano médio por turno: ' .. dano2s)
  end)
  schedule(3000, function() 
    say('Dano médio por ataque: ' .. HitMedio)
  end)
    schedule(4000, function() 
  say('Dano por minuto: ' .. danoMinuto)
  end)
  schedule(8000, function() 
    --say('Dano por hora: ' .. danoHora)
  end) 
  flag = 1

end

end)


local ResetSwitch = macro(500, "Reset", function() 

TempoInicio = now
danoMax = 0
danoMin = 10000
dano2s = 0
HitMedio = 0
danoMinuto = 0 
danoHora = 0
danoDia = 0
danoTotal = 0
nHits = 0

HitPercentage = 0
end)

macro(3000, function() 
  if not danoSwitch.isOn() then
     flag = 0  

  end
end)

onTextMessage(function(mode, text)


 if string.find(text, messageText5) then
  dano = tonumber(string.match(text, "%d+"))
  if dano > tonumber(storage.IgnorarDano) then
  danoTotal = danoTotal + dano
  nHits = nHits + 1
   if dano<danoMin then
  
     danoMin = dano
  
   end

   if dano>danoMax then
  
     danoMax = dano
  
   end 



 end

 end
end)

addLabel("IgnorarDano", "Ignorar dano abaixo de:", warTab)
addTextEdit("uhfriendpercent", storage.IgnorarDano or "", function(widget, text)   
  storage.IgnorarDano = text
end)



storage.highestDamage = 0
storage.DPS = 0


local height = 50
local widget = setupUI([[
Panel
  height: 400
  width: 200
]], g_ui.getRootWidget())


local DMGLabel = g_ui.loadUIFromString([[
Label
  color: #cd17ff
  background-color: #494949
  opacity: 1
]], widget)

local DPhitLabel = g_ui.loadUIFromString([[
Label
  color: #f25555
  background-color: #494949
  opacity: 1
]], widget)

local DPSLabel = g_ui.loadUIFromString([[
Label
  color: #f25555
  background-color: #494949
  opacity: 1
]], widget)

local tempoLabel = g_ui.loadUIFromString([[
Label
  color: #f25555
  background-color: #494949
  opacity: 1
]], widget)

local HitPercentageLabel = g_ui.loadUIFromString([[
Label
  color: #f25555
  background-color: #494949
  opacity: 1
]], widget)


-- Set Label Positions
DMGLabel:setPosition({y = height + 5, x = 230})
DPSLabel:setPosition({y = height + 18, x = 230})
DPhitLabel:setPosition({y = height + 31, x = 230})
tempoLabel:setPosition({y = height + 57, x = 230})
HitPercentageLabel:setPosition({y = height + 44, x = 230})

macro(100, function()
 
  if DMGLabel:getWidth() < (200 - 30) then
    DMGLabel:setWidth(DMGLabel:getWidth() + 5)
  end
  DMGLabel:setText("Hit máximo: " .. danoMax)



  TempoAgora = now
  IntervaloTempo = (TempoAgora - TempoInicio)/1000
  dano2s = 2*danoTotal/(IntervaloTempo) 
  dano2s = math.round(dano2s)

  if DPSLabel:getWidth() < (200 - 30) then
    DPSLabel:setWidth(DPSLabel:getWidth() + 5)
  end
  DPSLabel:setText("Dano médio por turno: " .. dano2s)


  HitMedio = danoTotal/nHits
  if DPhitLabel:getWidth() < (200 - 30) then
    DPhitLabel:setWidth(DPhitLabel:getWidth() + 5)
  end
  DPhitLabel:setText("Hit médio: " .. math.round(HitMedio))


   TempoAgora = now
  IntervaloTempo = (TempoAgora - TempoInicio)/1000

  minutos = math.floor(IntervaloTempo/60)
  segundos = math.round(IntervaloTempo-minutos*60)

 if tempoLabel:getWidth() < (200 - 30) then
    tempoLabel:setWidth(tempoLabel:getWidth() + 5)
  end
  tempoLabel:setText("Tempo decorrido: " .. minutos .. "min" .. segundos .. "s")

 
  HitPercentage = math.round(100*2*nHits/IntervaloTempo)

if HitPercentageLabel:getWidth() < (200 - 30) then
    HitPercentageLabel:setWidth(HitPercentageLabel:getWidth() + 5)
  end
  HitPercentageLabel:setText("Hit %: " .. HitPercentage)


end)

 

 

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...