mob
proc
skillCall(i)
switch(i)
if(1)
skillUse(skillOne)
skillUse(i)
switch(i)
if("Skill One")
if("Skill Two")
// etc
Problem description:
You have 5 variables - skillOne, skillTwo, et cetera. These are defined when you pick a character. The reason I don't wish to use a verb for this is because I can not change the name at run-time, though feel free to let me know otherwise (or, if I can just use a verb and have a proc just append "On Cooldown" to the end of a name).
I am wondering if there is a better way of doing this.
Skills - singleton datums stored in a global associative list (indexed by skill.id, a unique string)
Cooldowns - a list of cooldown ids and the world.time value of the end of the cooldown.
Example usage:
Skill datums are polymorphic in nature:
Expand on the skills polymorphically rather than just building all the behavior into the single skill datum.
A few notes here. The reason I'm modifying Read() and Write() is so that you can save cooldowns, as world.time starts from 0 every time the server starts. I'm also changing the hotbar list. The hotbar list stores /skill datums, but you don't want to save them, because they might change, or even be removed! Loading an invalid object prototype is a recipe for disaster.
Instead, we save the string id of the skill, and on next load, we convert it back into an object based on what skills are in the global list.
Pick through this at your own pace. It might seem complex, but it's actually all very simple.