Is code like this:
Code:
<var cmd="setcalc Type_Minimum_CTR (1 - (%Type_Trait_CTR))" />
Supposed to be:
Code:
<var cmd="setcalc Type_Minimum_CTR (1 - ($%Type_Trait_CTR))" />
?
Lots of other minor typos, but can be worked out later.
Code:
<if type="WhiteMagic|BlackMagic">
<if advanced='(Instant_Cast_CTR)*(Addle_Minimum_CTR)*($Fast_Cast_Minimum_CTR)*(Type_Minimum_CTR)*(Skill_Minimum_CTR)*(Element_Minimum_CTR)*($$Book_Arts_Minimum_CTR)*(Spell_Name_Minimum_CTR) < (1.5/%Castime)'>
<var cmd="set Cast_When precast" />
</if>
<elseif advanced='(Instant_Cast_CTR)*(Addle_Minimum_CTR)*($Fast_Cast_1_Total_CTR)*(Type_Minimum_CTR)*(Skill_Minimum_CTR)*(Element_Minimum_CTR)*($$Book_Arts_Minimum_CTR)*(Spell_Name_Minimum_CTR) < (1.5/%Castime)'>
<var cmd="set Cast_When midcast" />
</elseif>
<elseif advanced='(Instant_Cast_CTR)*(Addle_Minimum_CTR)*($Fast_Cast_2_Total_CTR)*(Type_Minimum_CTR)*(Skill_Minimum_CTR)*(Element_Minimum_CTR)*($$Book_Arts_Minimum_CTR)*(Spell_Name_Minimum_CTR) < (1.5/%Castime)'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Medium" />
</elseif>
<elseif advanced='(Instant_Cast_CTR)*(Addle_Minimum_CTR)*($Fast_Cast_2_Total_CTR)*(Type_Total_CTR)*(Skill_Minimum_CTR)*(Element_Minimum_CTR)*($$Book_Arts_Minimum_CTR)*(Spell_Name_Minimum_CTR) < (1.5/%Castime)'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum" />
</elseif>
<elseif advanced='(Instant_Cast_CTR)*(Addle_Minimum_CTR)*($Fast_Cast_2_Total_CTR)*(Type_Total_CTR)*(Skill_Total_CTR)*(Element_Minimum_CTR)*($$Book_Arts_Minimum_CTR)*(Spell_Name_Minimum_CTR) < (1.5/%Castime)'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum|%Type_CTR" />
</elseif>
<elseif advanced='(Instant_Cast_CTR)*(Addle_Minimum_CTR)*($Fast_Cast_2_Total_CTR)*(Type_Total_CTR)*(Skill_Total_CTR)*(Element_Total_CTR)*($$Book_Arts_Minimum_CTR)*(Spell_Name_Minimum_CTR) < (1.5/%Castime)'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum|%Type_CTR|%Skill_CTR" />
</elseif>
<elseif advanced='(Instant_Cast_CTR)*(Addle_Minimum_CTR)*($Fast_Cast_2_Total_CTR)*(Type_Total_CTR)*(Skill_Total_CTR)*(Element_Total_CTR)*($$Book_Arts_Total_CTR)*(Spell_Name_Minimum_CTR) < (1.5/%Castime)'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum|%Type_CTR|%Skill_CTR|%SpellElement_CTR" />
</elseif>
<elseif advanced='(Instant_Cast_CTR)*(Addle_Minimum_CTR)*($Fast_Cast_2_Total_CTR)*(Type_Total_CTR)*(Skill_Total_CTR)*(Element_Total_CTR)*($$Book_Arts_Total_CTR)*(Spell_Name_Total_CTR) < (1.5/%Castime)'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum|%Type_CTR|%Skill_CTR|%SpellElement_CTR|$Book_Arts_CTR" />
</elseif>
<else>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum|%Type_CTR|%Skill_CTR|%SpellElement_CTR|$Book_Arts_CTR|%Spell_CTR" />
</else>
</if>
Seems overly verbose. Could be simplified.
Example: Every single IF check compares against (1.5/%Castime). There's no reason to recalculate that so many times.
Code:
<var cmd="setcalc CompareCastTime 1.5/%Casttime" />
Am also not really sure of how you derived that value. Is the purpose to only use enough fast cast to get cast times below 1.5 seconds? That seems like a rather high threshhold. I'd expect you'd want it to be less than 1 second, though going conservatively, probably not less than 0.8. Maybe have a variable set to define that target threshhold.
Most variables are switching Minimum to Total. Sequential shifts allow for progressive comparisons. This makes lots of indents, but greatly reduces the number of computations.
Code:
<var cmd="setcalc CompareTimeReduction Instant_Cast_CTR * Addle_Minimum_CTR * $Fast_Cast_Minimum_CTR * Type_Minimum_CTR * Skill_Minimum_CTR * Element_Minimum_CTR * $$Book_Arts_Minimum_CTR * Spell_Name_Minimum_CTR" />
<if advanced='$CompareTimeReduction < $CompareCastTime'>
<var cmd="set Cast_When precast" />
</if>
<else>
<var cmd="setcalc CompareTimeReduction CompareTimeReduction * $Fast_Cast_1_Total_CTR / $Fast_Cast_Minimum_CTR" />
<if advanced='$CompareTimeReduction < $CompareCastTime'>
<var cmd="set Cast_When midcast" />
</if>
<else>
<var cmd="setcalc CompareTimeReduction CompareTimeReduction * $Fast_Cast_2_Total_CTR / $Fast_Cast_1_Total_CTR" />
<if advanced='$CompareTimeReduction < $CompareCastTime'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Medium" />
</if>
<else>
<var cmd="setcalc CompareTimeReduction CompareTimeReduction * $Type_Total_CTR / $Type_Minimum_CTR" />
<if advanced='$CompareTimeReduction < $CompareCastTime'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum" />
</if>
<else>
... etc, keep addding ( * Total / Minimum ) for each successive variable change.
</else>
</else>
</else>
<else>
This also makes it easier to see what change is being made at each stage of this long comparison run.
Blue magic, ninjutsu and summoning magic can all be condensed into the WhiteMagic/BlackMagic comparison set by just having Skill_*_CTR and $Book_*_CTR set to 1 for the appropriate skill types.
Or if you prefer, perhaps even include the brd-uniques in the grand original calculation (also set to 1 for anything other than brd stuff), and then have an extra <elseif> filter, such as:
Code:
...
<var cmd="setcalc CompareTimeReduction CompareTimeReduction * $Element_Total_CTR / $Element_Minimum_CTR" />
<if advanced='$CompareTimeReduction < $CompareCastTime'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum" />
</if>
<elseif type="WhiteMagic|BlackMagic">
<var cmd="setcalc CompareTimeReduction CompareTimeReduction * $Skill_Total_CTR / $Skill_Minimum_CTR" />
<if advanced='$CompareTimeReduction < $CompareCastTime'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum" />
</if>
<else>
<var cmd="setcalc CompareTimeReduction CompareTimeReduction * $$Book_Arts_Total_CTR / $$Book_Arts_Minimum_CTR" />
<if advanced='$CompareTimeReduction < $CompareCastTime'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum" />
</if>
<else>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum|%Type_CTR|%Skill_CTR|%SpellElement_CTR|$Book_Arts_CTR" />
</else>
</else>
</elseif>
<elseif type="BardSong">
<var cmd="setcalc CompareTimeReduction CompareTimeReduction * $Nightingale_Total_CTR / $Nightingale_Minimum_CTR" />
<if advanced='$CompareTimeReduction < $CompareCastTime'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum" />
</if>
<else>
<var cmd="setcalc CompareTimeReduction CompareTimeReduction * $Troubadour_Total_CTR / $Troubadour_Minimum_CTR" />
<if advanced='$CompareTimeReduction < $CompareCastTime'>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum" />
</if>
<else>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum|%Type_CTR|%Skill_CTR|%SpellElement_CTR|%Spell_CTR|Nightingale_CTR|Troubadour_CTR" />
</else>
</else>
</elseif>
<else>
<var cmd="set Cast_When midcast" />
<equip when="precast" set="Fast_Cast_Maximum|%Type_CTR|%Skill_CTR|%SpellElement_CTR|%Spell_CTR" />
</else>
Note: I didn't go back and fix all the sets being equipped to match the comparison.
Basically, all value switches apply to all spell types, except Skill and Book_Arts which only apply to white/black magic, and Troubadour/Nightingale which only apply to bard songs. This greatly reduces the number of redundant comparisons.