How to easily trigger cooldown and mana cost of the ability

I discovered that you can start cooldown and spend mana needed for the ability using this:

ability:UseResources(true,true,true)

link to API

When you use this, ability has no effect (nothing happens) but it goes on cooldown, mana is spent and even gold is spent if your ability has AbilityGoldCost. If you don't know why is this useful, its because:

1) You can use ability:UseResources(false,false,true) instead of this:

local level = ability:GetLevel() - 1
local cooldown = ability:GetCooldown(level)
ability:StartCooldown(cooldown)

or ability:UseResources(true,false,false) instead of this:

local mana_cost = ability:GetManaCost(-1)
caster:SpendMana(mana_cost, ability)

2) It works how it should with cooldown reduction and mana cost reduction modifiers.

Comments