If you want the unit's energy regeneration to stop for certain duration after he casts a spell (i.e. a "five second rule" for mana regen) just add an effect to the spell that applies a behavior to the caster. The behavior would have a limited duration and would affect the casters energy regen. Super easy.
If you want to know the truth, the one nearest the buildings probably makes the most sense, and I like, besides the kill chain (I looked into the Void Ray, and Hoo boy, that thing is a mess). So... actually, let's work on that, how would I go about a ranged "detection" of the buildings for an energy regen boost?
The easiest way would be to give the buildings a behavior which invokes a periodic Search effect which invokes an Apply Behavior effect which has a validator that only returns true for your hero, and the applied behavior can modify his energy regen but have a very short duration (so that if he is not near the building, he will lose the behavior very quickly).
This isn't quite the same, but it would be a lot easier to have his regen be modified while he's on creep, because you can simply give him a permanent behavior that modifies his energy regen, and add a validator that disables the behavior when he's not on creep.
The "killing spree" effect would probably be most easily applied with triggers. You can have the trigger run when he kills something, and it gives him a short behavior which stacks, so that if he kills another enemy before it runs out, it gains another stack and the effect is cumulative.
Okay, I made the behavior based off of the "On Creep" Buff. How do I give it to him?
Edit: I figured it out, and it works! Woo! He now has an energy regeneration boost on the creep! Now, I need to balance it. He's regening at 5.6~ energy per second. That's insane. XD
I meant after you cast a spell.
If you want the unit's energy regeneration to stop for certain duration after he casts a spell (i.e. a "five second rule" for mana regen) just add an effect to the spell that applies a behavior to the caster. The behavior would have a limited duration and would affect the casters energy regen. Super easy.
If you want to know the truth, the one nearest the buildings probably makes the most sense, and I like, besides the kill chain (I looked into the Void Ray, and Hoo boy, that thing is a mess). So... actually, let's work on that, how would I go about a ranged "detection" of the buildings for an energy regen boost?
The easiest way would be to give the buildings a behavior which invokes a periodic Search effect which invokes an Apply Behavior effect which has a validator that only returns true for your hero, and the applied behavior can modify his energy regen but have a very short duration (so that if he is not near the building, he will lose the behavior very quickly).
This isn't quite the same, but it would be a lot easier to have his regen be modified while he's on creep, because you can simply give him a permanent behavior that modifies his energy regen, and add a validator that disables the behavior when he's not on creep.
The "killing spree" effect would probably be most easily applied with triggers. You can have the trigger run when he kills something, and it gives him a short behavior which stacks, so that if he kills another enemy before it runs out, it gains another stack and the effect is cumulative.
Okay, I made the behavior based off of the "On Creep" Buff. How do I give it to him?
Edit: I figured it out, and it works! Woo! He now has an energy regeneration boost on the creep! Now, I need to balance it. He's regening at 5.6~ energy per second. That's insane. XD