Code:
function pretarget(spell)
...
if spell.type == "Waltz" and spell.target.type == "SELF" and spell.en:startswith('Curing Waltz') then
local new_waltz = (extra.select_waltz() or false)
if new_waltz and spell.en ~= new_waltz then
cancel_spell()
send_command('input /ja "'..new_waltz..'" <me>')
return
end
...
end
function buff_change(name,gain,buff_table)
...
if buff_table.id == 582 then Contradance_potency = (gain and 100 or 0) end
...
end
Contradance_potency = 0
function extra.waltz_potency()
local potency = 0
local waltz_pot = {[14578]=10,[14579]=10,[11302]=10,[11303]=10,[16002]=5,[11478]=5,[11479]=5,[10668]=7,[10751]=3,[10402]=5,[10407]=8,[28635]=5,[10787]=3,
[27825]=20,[27826]=20,[27846]=21,[27847]=21,[28241]=10,[28242]=10,[28262]=10,[28263]=10,[20626]=3,[28002]=5,[26660]=9,[26661]=11,[20610]=7}
for i2,v2 in pairs(sets["Curing Waltz"]) do
if type(v2) == "table" then
local gear = (res.items:with('name', v2.name))
if v2.name == gear[gearswap.language] then potency = potency + waltz_pot[gear.id] end
else
local gear = (res.items:with('name', v2))
if v2 == gear[gearswap.language] then potency = potency + waltz_pot[gear.id] end
end
if potency > 30 then potency = 30 end
end
return potency
end
function extra.select_waltz() -- returns the most usable Waltz for use on your player
local potency = 0
if sets["Curing Waltz"] then potency = extra.waltz_potency() end
potency = potency + (player.job_points.dnc.waltz_potency*2) + Contradance_potency
local add_perc = function(num,per) return (((num/100)*per)+num) end
local hp_dif = player.max_hp - player.hp
local abilitys = res.job_abilities
local waltz_base = waltz_stats.vit + waltz_stats.chr
local dnc_type = "none"
local highest_waltz
local waltz = {
main_job={[1]={heal=math.floor((waltz_base*0.250)+60),tp=200,lvl=15,id=190},[2]={heal=math.floor((waltz_base*0.500)+130),tp=350,lvl=30,id=191},
[3]={heal=math.floor((waltz_base*0.750)+270),tp=500,lvl=45,id=192},[4]={heal=math.floor((waltz_base*1.000)+450),tp=650,lvl=75,id=193},
[5]={heal=math.floor((waltz_base*1.25)+600),tp=800,lvl=80,id=311},},
sub_job={[1]={heal=(math.floor((waltz_base*0.125)+60) > 95 and 95 or math.floor((waltz_base*0.125)+60)),tp=200,lvl=15,id=190},
[2]={heal=(math.floor((waltz_base*0.250)+130) > 200 and 200 or math.floor((waltz_base*0.250)+130)),tp=350,lvl=30,id=191},
[3]={heal=(math.floor((waltz_base*0.375)+270) > 375 and 375 or math.floor((waltz_base*0.375)+270)),tp=500,lvl=45,id=192},},}
if player.main_job == "DNC" then dnc_type = 'main_job'
elseif player.sub_job == "DNC" then dnc_type = 'sub_job' end
for i,v in ipairs(waltz[dnc_type]) do
if add_perc(v.heal,potency) >= hp_dif and player[dnc_type..'_level'] >= v.lvl and player.tp >= v.tp then
return abilitys[v.id][gearswap.language]
elseif player[dnc_type..'_level'] >= v.lvl and player.tp >= v.tp then highest_waltz = v.id end
end
if highest_waltz then return abilitys[highest_waltz][gearswap.language] end
end