Advertisement
smd111

Dancer Waltz Potency Claculator(self only)

Aug 17th, 2015
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.74 KB | None | 0 0
  1. --Dancer Waltz Potency Claculator
  2. DNC = {}
  3. function DNC.waltz_potency(s)
  4.     local potency = 100
  5.     local tpreduction = 0
  6.     local received_pot = 100
  7.     local waltz_pot = {["Sonia's Plectrum"]=(allied_tags and 10 or 1),["ソニアプレクトラム"]=(allied_tags and 10 or 1),
  8.                        ["Dnc. Casaque +1"]=10,["DRカザク+1"]=10,
  9.                        ["Dancer's Casaque"]=10,["ダンサーカザク"]=10,
  10.                        ["Roundel Earring"]=5,["ラウンデルピアス"]=5,
  11.                        ["Etoile Tiara"]=5,["エトワールティアラ"]=5,
  12.                        ["Etoile Tiara +1"]=5,["ETティアラ+1"]=5,
  13.                        ["Etoile Tiara +2"]=7,["ETティアラ+2"]=7,
  14.                        ["Phurba"]=10,["フルバー"]=10,
  15.                        ["Valseur's Ring"]=3,["ヴァルスールリング"]=3,
  16.                        ["Kheper Bonnet"]=5,["ケペルボンネット"]=5,
  17.                        ["Khepri Bonnet"]=8,["ケプリボンネット"]=8,
  18.                        ["Toetapper Mantle"]=5,["トータッパーマント"]=5,
  19.                        ["Asklepian Ring"]=3,["アスクレピアリング"]=3,
  20.                        ["Maxixi Casaque"]=20,["マシシカザク"]=20,
  21.                        ["Maxixi Casaque +1"]=21,["MXカザク+1"]=21,
  22.                        ["Maxixi Shoes"]=10,["マシシトーシュー"]=10,
  23.                        ["Maxixi Shoes +1"]=10,["MXトーシュー+1"]=10,
  24.                        ["Blitto Needle"]=3,["ブリットニードル"]=3,
  25.                        ["Slither Gloves +1"]=5,["スリザーグローブ+1"]=5,
  26.                        ["Horos Tiara"]=9,["ホロスティアラ"]=9,
  27.                        ["Horos Tiara +1"]=11,["HOティアラ+1"]=11,
  28.                        ["Rhadamanthus"]=7,["ラダマントゥス"]=7,}
  29.     local waltz_received_pot = {["Maxixi Casaque"]=5,["マシシカザク"]=5,
  30.                                 ["Maxixi Casaque +1"]=6,["MXカザク+1"]=6,
  31.                                 ["Asklepian Ring"]=3,["アスクレピアリング"]=3,}
  32.     for _,v2 in pairs(s) do
  33.         if type(v2) == "table" then
  34.             potency = potency + (waltz_pot[v2.name] or 0) received_pot = received_pot + (waltz_received_pot[v2.name] or 0)
  35.             for _,v in ipairs(v2.augments) do
  36.                 potency = potency + tonumber(v:startswith('"Waltz" potency') and string.match(v, '%d+') or '0')
  37.                 tpreduction = tpreduction + tonumber(v:startswith('"Waltz" TP cost') and string.match(v, '%d+') or '0')
  38.             end
  39.         else
  40.             potency = potency + (waltz_pot[v2] or 0) received_pot = received_pot + (waltz_received_pot[v2] or 0)
  41.         end
  42.     end
  43.     if potency > 130 then
  44.         potency = 130
  45.     end
  46.     return s,potency,received_pot,tpreduction
  47. end
  48. function DNC.select_waltz(bpotency,received_pot,tpreduction) -- returns the most usable Waltz for use on your player
  49.     local potency = (bpotency  + (player.main_job == "DNC" and (player.job_points.dnc.waltz_potency*2) or 0) + Contradance_potency)
  50.     local hp_dif = (player.max_hp - player.hp)
  51.     local abilitys = res.job_abilities
  52.     local base = (Player['VIT'] + Player['VIT+']) + (Player['CHR'] + Player['CHR+'])
  53.     local dnc_type
  54.     local h_waltz
  55.     local h_hp
  56.     if hp_dif == 0 then
  57.         return nil,0
  58.     end
  59.     local waltz = {main_job={[1]=0.250,[2]=0.500,[3]=0.750,[4]=1.000,[5]=1.25,},
  60.                    sub_job={[1]=0.125,[2]=0.250,[3]=0.375,},
  61.                    default={[1]={c=60,tp=200,lvl=15,id=190},
  62.                             [2]={c=130,tp=350,lvl=30,id=191},
  63.                             [3]={c=270,tp=500,lvl=45,id=192},
  64.                             [4]={c=450,tp=650,lvl=75,id=193},
  65.                             [5]={c=600,tp=800,lvl=80,id=311},},}
  66.     if player.main_job == "DNC" then
  67.         dnc_type = 'main_job'
  68.     elseif player.sub_job == "DNC" then
  69.         dnc_type = 'sub_job'
  70.     end
  71.     for i,v in ipairs(waltz.default) do
  72.         if player[dnc_type..'_level'] >= v.lvl then
  73.             local hHP=math.floor((((base*waltz[dnc_type][i])+v.c)*(potency/100))*(received_pot/100))
  74.             local hTP=(v.tp-tpreduction)
  75.             if hHP >= hp_dif and player.tp >= hTP then
  76.                 return abilitys[v.id][gearswap.language]
  77.             elseif player.tp >= hTP then
  78.                 h_waltz = v.id
  79.             end
  80.         end
  81.     end
  82.     if h_waltz then
  83.         return abilitys[h_waltz][gearswap.language]
  84.     end
  85. end
  86. --my code used to get the correct healing of waltz (self only)
  87. -- Contradance_potency = 0
  88. -- allied_tags = false
  89. -- function precast(spell)
  90.     -- if spell.type == 'Waltz' then
  91.         -- if spell.target.type == "SELF" and spell.en:startswith('Curing Waltz') then
  92.             -- local set,potency,received_pot,tpreduction = DNC.waltz_potency(sets["Waltz"])
  93.             -- local new_waltz,h_total = DNC.select_waltz(potency,received_pot,tpreduction)
  94.             -- if new_waltz and spell.name ~= new_waltz then
  95.                 -- send_command('input /ja "'..new_waltz..'" <me>')
  96.                 -- cancel_spell()
  97.                 -- return
  98.             -- elseif h_total == 0 then
  99.                 -- add_to_chat(7, 'Canceling '..spell.name..' HP Loss At 0')
  100.                 -- cancel_spell()
  101.                 -- return
  102.             -- else
  103.                 -- if s_waltz_h_a and not showed then
  104.                     -- add_to_chat(7, 'Waltz Set To '..new_waltz)
  105.                 -- end
  106.             -- end
  107.         -- end
  108.     -- end
  109. -- end
  110. -- function buff_change(name,gain,buff_table)
  111.     -- if buff_table.id == 582 then
  112.         -- Contradance_potency = (gain and 100 or 0)
  113.     -- elseif buff_table.id == 267 then
  114.         -- allied_tags = (gain and true or false)
  115.     -- end
  116. -- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement