0
\$\begingroup\$

Suppose my mana regeneration rate was calculated in this way:

ManaRegenRate = 0.01 × (BaseManaRegen + ManaRegenMultiplier × Willpower) × TotalMana

Where willpower is my attribute ranging from 0 to 100 and BaseManaRegen and ManaRegenMultiplier are some constants.

With this formula I would get mana regenerated per second.

How could I rearrange this formula to get the total amount of seconds to regenerate mana from 0 to full?

\$\endgroup\$
  • 1
    \$\begingroup\$ Can't you just do something like timeToFullMana = FullMana / ManaRegenRate ? \$\endgroup\$ – TomTsagk Oct 25 at 15:15
3
\$\begingroup\$

Assuming your "ManaRegenRate" is the mana regenerated per second, you just have to divide the TotalMana through the mana regen rate.

$$ TotalMana \over 0.01 × (BaseManaRegen + ManaRegenMultiplier × Willpower) × TotalMana $$

But because TotalMana appears on both sides of the fraction, you can simplify the fraction by removing it and arrive at:

$$ 1 \over 0.01 × (BaseManaRegen + ManaRegenMultiplier × Willpower) $$

You might notice that the time it takes to fully regenerate mana in your game is completely independent from how much mana the character can actually have.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.