User:BadPiggy1024/Sandbox5
Restoring mana
Mana regenerates on its own when not in use until the player's current maximum is reached.
The natural rate of regeneration is modified by whether or not the player is moving and how much current mana a character has. This formula exists to punish reckless mana use – if all mana is spent, the player will have almost no regeneration at all until they stop moving or use a potion. Conversely, when the player does not move (including standing still or being stationary when using hooks) and waits between uses of magic weapons until mana is refilled, mana recovers at its fastest possible rate. Wearing items that increase the maximum mana can thus also increase the rate of recovery, as each use of magic weapons would spend less percentage of maximum mana, giving the player a higher mana regeneration multiplier.
However, mana does not regenerate for a small period after any magic is expended, meaning that to start regenerating mana the player must stop casting spells for a short time. The regeneration cooldown starts the moment the player stops spending mana, so casting weapons like Magic Missile or Flamelash will start the cooldown as soon as it is cast, regardless of how long the projectile is held.
Several items can be used to regenerate mana:
Item | Instant mana restoration | Notes |
---|---|---|
Mana Crystal | 20 | Also increases maximum mana by 20. Can be used a maximum of 9 times on a single character (until a permanent maximum of 200 is reached). |
Lesser Mana Potion | 50 | |
Mana Potion | 100 | |
Greater Mana Potion | 200 | |
Super Mana Potion(Desktop, Console, Old-gen console and Mobile versions) | 300 | |
Lesser Restoration Potion(Old-gen console and 3DS versions) | 50 | Shares a cooldown with most other consumable healing items. |
Restoration Potion | 100 (Old-gen console and 3DS versions) | Shares a cooldown with most other consumable healing items.
Only restores Mana on the Old-gen console version and Nintendo version. |
Mana Regeneration Potion | - | Increased mana regeneration, lasts 7 minutes. |
Mana Regeneration Band | - | While equipped, increases mana by 20 and increases mana regeneration rate, which positively correlates with the current amount of mana left. |
Magic Cuffs | - | While equipped, increases mana by 20 and restores mana when damaged. |
Mana Booster(Desktop, Console and Mobile versions) | - | Provides the Mana Nebula buff, which continually restores mana (10 per second for each level) regardless of current usage or remaining mana. Effects can be stacked up to three times. |
Star | 100 | Dropped from enemies or pots when player does not have full mana, or spawned via activating Star Statues. |
Star Statue | - | Spawns a Star when activated. |
Celestial Magnet(Desktop, Console, Old-gen console and Mobile versions) | - | While equipped, increases the pickup range for Stars. |
Magnet Flower(Desktop, Console and Mobile versions) | - | Uses Mana Potions automatically. Increases the pickup range for Stars. |
Celestial Cuffs(Desktop, Console, Old-gen console and Mobile versions) | - | While equipped, increases mana by 20, restores mana when damaged, and increases the pickup range for Stars. |
Celestial Emblem(Desktop, Console, Old-gen console and Mobile versions) | - | While equipped, increases magic damage and the pickup range for Stars. |
Star in a Bottle | - | Increased mana regeneration when placed nearby. In Desktop version, Console version, and Mobile version, reduces the mana regeneration delay after using magic weapons. |
Technical info
The mana regeneration has a similar mechanism of health regeneration – there is also a mana counter which is increased by a mana regeneration rate every tick.[1] When it reaches 120 or more, it would be reduced by 120 and increase mana by 1. So, 1 mana regeneration rate equals to 0.5 mana per second.[2]
Also, there is a mana regeneration delay, which would be set to a certain number calculated by the formula below (round up after the calculation), if the player used any magic weapons:[3] [math]\displaystyle{ \mathit{mana\ regeneration\ delay} = 0.7\times\left(\left(1-\frac{\mathit{current\ mana}}{\mathit{maximum\ mana}}\right)\times 240 + 45 \right) }[/math]
The mana regeneration delay will be reduced by 1 every tick by default. Certain effects will increase this value:
Factor | Value |
---|---|
Not moving or Mana Regeneration |
+1 |
Arcane Crystal | +0.05 |
Mana Regeneration Band | +1 |
Star in a Bottle | +0.5 |
Additionally, when the Mana Regeneration buff is active, if the mana regeneration delay is greater than 20, it will be set to 20.
Once the mana regeneration delay reaches 0, the mana regeneration rate would be calculated by the formula below:
[math]\displaystyle{ \mathit{Mana\ regeneration\ rate} = \left(\frac{\mathit{maximum\ mana}}{3}+1+\mathit{stationary\ bonus}+\mathit{Arcane\ Crystal\ bonus}+\mathit{mana\ regen\ bonus}\right)\times\mathit{regen\ factor}\times1.15 }[/math]
- The [math]\displaystyle{ \mathit{stationary\ bonus} }[/math] is [math]\displaystyle{ \frac{\mathit{maximum\ mana}}{3} }[/math] when the player is not moving or have the Mana Regeneration buff; otherwise it is 0.
- The [math]\displaystyle{ \mathit{Arcane\ Crystal\ bonus} }[/math] is [math]\displaystyle{ \frac{\mathit{maximum\ mana}}{50} }[/math] when the player have used an Arcane Crystal, otherwise it is 0.
- The [math]\displaystyle{ \mathit{mana\ regen\ bonus} }[/math] is 0 by default. Certain effects will increase this value:
Factor | Value |
---|---|
Mana Regeneration Band | +25 |
Star in a Bottle | +10 |
- The [math]\displaystyle{ \mathit{regen\ factor} }[/math] is [math]\displaystyle{ \frac{\mathit{current\ mana}}{\mathit{maximum\ mana}}\times0.8+0.2 }[/math]. If the Mana Regeneration buff is active, it will be set to 1.
Unlike all other mana-regenerating methods, the Mana Nebula from the Nebula armor periodically regenerates a fixed amount of mana, regardless of mana regeneration delay. There is a Nebula counter that is increased by the same amount of stacks of the Mana Nebula per tick. When the counter reaches 6, it would be reduced by 6 and increase mana by 1.
Tips
- Setting up Star Statues on timers can help giving magic-using players much better rates of magical fire in boss-fighting or enemy-farming situations where there is time to prepare where the player is going to fight. Using the Crystal Ball is also helpful in such situations.
- If a player wants to rely on magical weapons for normal exploration, they should memorize how to best recover mana, even while distracted. To make the most of mana regeneration, the player should practice understanding the timing between when they fire, and when the tone that indicates they have recovered full mana occurs, (so that they fire their next attack at exactly that moment,) and try to remain stationary during times when the mana recovery starts. Firing can be practiced in a safe location like the player's home until they are comfortable with how they regenerate their mana.
- ↑ A tick is a time unit countable by the software. Most of Terraria's updating logic happens every tick. A tick has the length of 1/60th of a second, hence there are 60 ticks in a second and 3600 ticks in a minute.
- ↑ Information taken from the Desktop 1.4.4.9 source code, methods
UpdateManaRegen()
inTerraria.Player.cs
andUpdate()
inTerraria.Player.cs
. - ↑ Information taken from the Desktop 1.4.4.9 source code, method
Update()
inTerraria.Player.cs
. This delay will not be applied if the player uses Space Gun, Gray Zapinator, or Orange Zapinator when wearing the Meteor armor.