AstolfoFate

Dex calc.lua

Mar 28th, 2021 (edited)
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getDefense()
  2.   write("What is your dex? ")
  3.   local dex = read()
  4.   local numDex = tonumber(dex)
  5.   local defense = numDex * 3.6
  6.   local passiveDefense = defense * 0.348
  7.   print("Dex: "..numDex)
  8.   print("Defense: "..defense)
  9.   print("Passive Defense: "..passiveDefense)
  10. end
  11.  
  12. function getDexByDefense()
  13.   write("What is your defense? ")
  14.   local defense = read()
  15.   local numDefense = tonumber(defense)
  16.   local dex = numDefense / 3.6
  17.   local passiveDefense = numDefense * 0.348
  18.   print("Dex: "..dex)
  19.   print("Defense: "..numDefense)
  20.   print("Passive Defense: "..passiveDefense)
  21. end
  22.  
  23. function getDexByPDef()
  24.   write("What is your passive defense? ")
  25.   local passiveDefense = read()
  26.   local numPassiveDefense = tonumber(passiveDefense)
  27.   local defense = numPassiveDefense / 0.348
  28.   local dex = defense / 3.6
  29.   print("Dex: "..dex)
  30.   print("Defense: "..defense)
  31.   print("Passive Defense: "..numPassiveDefense)
  32. end
  33.  
  34. print("What are you calculating?\n1. Get Defense by Dex\n2. Get Dex by Defense\n3. Get Dex by Passive Defense")
  35. write("Enter option: ")
  36. local stringOption = read()
  37. local option = tonumber(stringOption)
  38. if option == 1 then
  39.   getDefense()
  40. elseif option == 2 then
  41.   getDexByDefense()
  42. elseif option == 3 then
  43.   getDexByPDef()
  44. else error("That's not an option loser.")
  45. end
  46.  
RAW Paste Data