Well i can do it by myself if i get the of get mana cost but i think i have to do like KILLCIDE said.
===========================================
MODERATOR NOTE: Accidently merged two posts by different users.
Dark_Axl said:
This is a really tedious spell. As of right now, there's no way to get the mana cost of an ability, so what you will need to do is map the mana cost of every single spell that can be casted in your project (preferably hashtables, but you can use arrays).
Whenever an ability is casted, check if that unit has the "chain link" debuff. If they do, find out which ability was casted, find it's mana cost with however you stored it, then divide that mana cost by the number of units it's linked with, and subtract accordingly. Another thing you will need to watch out for is to give the caster the mana you subtracted from the other units. If not, the caster will loose all the mana it costed for the spell in addition to the other linked units losing their portion of mana.
as the mana cost is distributed evenly to all affected units,
another method to get mana cost of an ability is using the "begin casting an ability" to record the mana before cast and using "starts the effect of an ability" event to record mana after cast.
so when an unit begin cast an ability, check if the unit has the buff,
if yes, save the mana then check the mana after cast using the "starts the effect of an ability" event,
the difference is the mana cost (note: unless some mana burn or mana manipulating effect happen between event)
if that note concern you, the only method available is like KILLCIDE said above, though be reminded that not only you should store the mana cost of every ability, you need to do that for all levels of ability.
and you need to think about few cases, like:
- what if an affected unit has Immolation turned on? (it will cost mana periodically while not triggering cast event)