I wrote a script that can automatically add strike spells to a targetlist.
I hate it when I have an extensive creaturelist and have to add all the strike spells manually, thought I would share.
-- Add best strike spells for each creature in targetlist
local elementToSpell = {{'fire', 'Flame'}, {'energy', 'Energy'}, {'earth', 'Earth'}, {'ice', 'Ice'},}
local useStrongStrike = false
local bestStrike = nil
-- If you use strong spells: Damage difference in percent between strike and strong spell to not use
-- e.g. If creature is weak to energy (110%) and you're a druid (no energy)
-- And the strong spell you can cast would be earth damage, creature has (85%)
-- Then for any value higher than 25 it will not use the strong spell
local damagePercentDiff = 20
foreach settingsentry e 'Targeting/Creatures' do
setsetting(e, 'Setting1/FirstSpell', "No Spell")
setsetting(e, 'Setting1/SecondSpell', "No Spell")
local creatureInfo = creatureinfo(getsetting(e, 'Name'))
if creatureInfo.hp > 0 then
bestStrike = getbestspell(creatureInfo.name).name
if useStrongStrike then
local bestStrongElement = bestelement(creatureInfo.name, true)
local bestElement = bestelement(creatureInfo.name, false)
for _,i in pairs(elementToSpell) do
if i[1] == bestStrongElement then
if creatureInfo[bestElement..'mod']-damagePercentDiff <= creatureInfo[bestStrongElement..'mod'] then
setsetting(e, 'Setting1/FirstSpell', "Strong " .. i[2] .. " Strike")
end
end
end
if getsetting(e, 'Setting1/FirstSpell') ~= "No Spell" then
setsetting(e, 'Setting1/SecondSpell', bestStrike)
else
setsetting(e, 'Setting1/FirstSpell', bestStrike)
end
else
setsetting(e, 'Setting1/FirstSpell', bestStrike)
end
end
end
This keeps into account when names such as Category A or Others are used in the targetlist, it will just set the spells to "No Spell".
I made a parameter that looks for damage difference between strong/weak strike spells, I will probably update the math behind that one soon, this is really basic at the moment, didn't feel like write an extensive code.