-- Example:
-- equip(set_combine(sets.precast.LeadenSalute, {waist=optimal_belt(spell)}))
function optimal_belt(spell)
--------------------------------------
-- Basic element relations
--------------------------------------
-- 10% bonus for magic of the day
-- 10% bonus for magic matching single weather
-- 20% bonus for magic matching single weather and day
-- 25% bonus for magic matching double weather
-- 35% bonus for magic matching double weather and day
elements = {}
elements.weak_to = {['Light']='Dark', ['Dark']='Light', ['Fire']='Ice', ['Ice']='Wind', ['Wind']='Earth', ['Earth']='Lightning', ['Lightning']='Water', ['Water']='Fire'}
elements.strong_to = {['Light']='Dark', ['Dark']='Light', ['Fire']='Water', ['Ice']='Fire', ['Wind']='Ice', ['Earth']='Wind', ['Lightning']='Earth', ['Water']='Lightning'}
single_storm_element = 0
for i,v in pairs({Fire=178,Ice=179,Wind=180,Earth=181,Lightning=182,Water=183,Light=184,Dark=185,}) do -- NOTE: SCH 'Single Storm' Buffs Only!
if buffactive[v] then
single_storm_element = i
end
end
double_storm_element = 0
for i,v in pairs({Fire=589,Ice=590,Wind=591,Earth=592,Lightning=593,Water=594,Light=595,Dark=596,}) do -- NOTE: SCH 'Double Storm' Buffs Only!
if buffactive[v] then
double_storm_element = i
end
end
if (double_storm_element == spell.element) and (spell.element ~= elements.weak_to[world.day_element]) then
send_command('@input /echo >>> GEAR MOD: "Hachirin-no-Obi" for double storm (w/o day conflict). (25-35%)')
return "Hachirin-no-Obi"
elseif (spell.element == world.weather_element and S{"Heat waves","Squalls","Sand storms","Gales","Blizzards","Thunderstorms","Stellar glare","Darkness"}:contains(world.weather)) and (spell.element ~= elements.weak_to[world.day_element]) then
send_command('@input /echo >>> GEAR MOD: "Hachirin-no-Obi" double weather (w/o day conflict). (25-35%)')
return "Hachirin-no-Obi"
elseif (spell.element == world.day_element and single_storm_element == spell.element) then
send_command('@input /echo >>> GEAR MOD: "Hachirin-no-Obi" for storm and day. (20%)')
return "Hachirin-no-Obi"
elseif (spell.element == world.day_element and spell.element == world.weather_element) then
send_command('@input /echo >>> GEAR MOD: "Hachirin-no-Obi" for weather and day. (20%)')
return "Hachirin-no-Obi"
elseif (double_storm_element == spell.element) and (spell.element == elements.weak_to[world.day_element]) then
send_command('@input /echo >>> GEAR MOD: "Hachirin-no-Obi" for double storm (with day conflict). (15%)')
return "Hachirin-no-Obi"
elseif (spell.element == world.weather_element and S{"Heat waves","Squalls","Sand storms","Gales","Blizzards","Thunderstorms","Stellar glare","Darkness"}:contains(world.weather)) and (spell.element == elements.weak_to[world.day_element]) then
send_command('@input /echo >>> GEAR MOD: "Hachirin-no-Obi" for double weather (with day conflict). (15%)')
return "Hachirin-no-Obi"
-- Optimal Distance [Varies between 13 and 1.93 yalms]. (11-15%) [Approximately 1.27% per yalm: 13y=1.0, 12y=2.3, 11y=3.5, 10y=4.8, 9y=6.1, 8y=7.4, 7y=8.6, 6y=9.9, 5y=11.2, 4y=12.4, 3y=13.7, 2y=14.9]
elseif spell.target.distance < 5.0 then -- [Ideally < 1.93 yalms]
send_command('@input /echo >>> GEAR MOD: "Orpheus`s Sash" for Optimal Distance [13 to 1.93 yalms]. (11-15%)')
return "Orpheus's Sash"
elseif (single_storm_element == spell.element) and (spell.element ~= elements.weak_to[world.day_element]) then
send_command('@input /echo >>> GEAR MOD: "Hachirin-no-Obi" for single storm (w/o day conflict). (10%)')
return "Hachirin-no-Obi"
elseif (spell.element == world.weather_element) and (spell.element ~= elements.weak_to[world.day_element]) then
send_command('@input /echo >>> GEAR MOD: "Hachirin-no-Obi" for single weather (w/o day conflict). (10%)')
return "Hachirin-no-Obi"
elseif (spell.element == world.day_element) and (spell.element ~= elements.weak_to[world.weather_element]) then
send_command('@input /echo >>> GEAR MOD: "Hachirin-no-Obi" for Matching day (w/o weather conflict). (10%)')
return "Hachirin-no-Obi"
else
return "Orpheus's Sash"
end
end