Ok so, my turn again.
Reworking my NIN Lua which I haven't touched since september and creating a rule for the "Sange" JA.
For those of you who don't know yet, the Shuriken which doesn't normally get consumed with Daken job trait, it gets consumed during Sange (which brings Daken activation rate to 100%, i.e. once per attack round).
Basically you want to swap your "cool" shuriken that you normally equip in your TP sets, for a "cheap" shuriken to be thrown while Sange is active.
This would be normally very easy, but you want to avoid some situations, like the following:
- There is a small "delay" when using buffactive checks between the server activation and client notification, which means under certain circumstances the "cool" shuriken could still stay equipped for the first second of the JA activation, meaning you could accidentally throw it
- Simply putting the "cheap" shuriken in your Sange precast wouldn't be enough. What if you forget to put the shuriken in your inventory or if you ran out of it?
- player.inventory['shuriken name'] could be used to perform security checks, but from my experience this isn't 100% reliable, so I'd rather not trust it before losing a very rare/expensive item
This is what I thought of, please take your time to read it and tell me if I missed something, or if it's looking "secure" enough.
Code:
function get_sets()
...
sets.TP.ammo = {name="Happo Shuriken +1"}
sets.TP.Basic.Normal = {..., ammo=sets.TP.ammo, ...}
sets.TP.Basic.Acc = ...
sets.TP.NoDW.Normal = ...
...
sets.precast.Sange = {body="Mochizuki Chainmail +1", ammo=empty}
...
end
function precast(spell,action)
if sets.precast[spell.english] then
equip(sets.precast[spell.english])
elseif ...
...
end
if spell.english == "Sange" and not spell.interrupted then
sets.TP.ammo.name = "Hachiya Shuriken"
end
end
Then of course I'd need more stuff in a buff_change function to set the .name back to Happo etc, but I know how to do that myself since I've done it already in other luas and it works.
So... opinions?
Safe enough? Working?