Use time

From Terraria Wiki
Jump to navigation Jump to search

Use time is a statistic that applies to weapons, tools and other usable items. It determines the time that must pass, after use, before the same item or another item can be used again. In basic terms, this is the "rate of fire", as measured in game ticks[1]. A lower use time means a faster weapon. The shortswords, for example, usually have a use time between 10 and 13, meaning that they can be used in quick succession, as compared to the exceptionally slow Volcano, which has a use time of 40 – a much slower weapon which cannot be used as often.

Use time is particularly useful in comparing the speed of tools and weapons. The in-game tooltips for these items automatically group these values into categories like "Very fast" or "Very slow". They are grouped as following:

Value In-game text
≤8 Insanely fast speed
9–20 Very fast speed
21–25 Fast speed
26–30 Average speed
31–35 Slow speed
36–45 Very slow speed
46–55 Extremely slow speed
≥56 Snail speed

Technical info

Several statistics are used to determine the use behavior of an item: useTime[2], useAnimation[3], and reuseDelay[4]. All these values are in ticks[1].

  • useTime determines time between actual uses of the item, i.e., the interval between the item taking effect.
  • useAnimation, as its name suggests, is the duration of animation of each item use, i.e., the item's behavior after a single Use / Attack key input.
  • reuseDelay determines how many ticks before an item can be used again. This is usually used for balancing weapons that would have extremely high fire rate otherwise. This stat is also commonly referenced to as "use delay".

Internally, two tick counters, itemTime and itemAnimation, corresponding to useTime and useAnimation are applied to a player. When an item is used, the game checks for its useTime and useAnimation, applies all attack speed bonuses, then adds the resulting ticks to their respective counter. These counters are reduced by 1 per tick, and as long as they are above zero, the player is considered using the item and several actions are disabled for the duration. For most items, useTime is equal to useAnimation, meaning that the item would be used only once per Use / Attack key input. Some items have their useTime stat less than useAnimation, which causes them to be used multiple times per Use / Attack key input.

Times of use per Use / Attack key input
[math]\displaystyle{ \text{Times of use}=\lceil\frac{\mathit{useAnimation}}{\mathit{useTime}}\rceil }[/math]
  • [math]\displaystyle{ \lceil{x}\rceil }[/math] is the ceiling function (round up to the nearest integer).

reuseDelay is applied after the itemAnimation counter turns to zero. This will add value of reuseDelay to both counters, making the player have to wait a few more ticks before they can use item.

On this wiki, the useAnimation stat is displayed in infoboxes as the "use time" stat. The useTime stat is only displayed for tools as their "tool speed" stat (since this stat have no effect on the function of other items in most cases).

On Desktop version Desktop version, certain actions are disabled when the itemTime or itemAnimation tick counters are not zero:

  • Actions that involve interaction with items in inventory, including:[5]
  • Swapping Loadouts(Desktop, Console and Mobile versions).[6]
  • The Digging Molecart(Desktop, Console and Mobile versions)'s mining and Minecart Track placing.
  • Interaction with most game interface elements. This can be observed by turning on autopause and opening inventory when using an item. Apart from the Duplication Menu, other functions of Journey Mode Power Menu will still be functional.[7]

Several hotkeys will still be functional, including Quick Heal, Quick Mana, Quick Buff, Grapple, and Quick Mount.

For exmaple:

  • Pickaxes use useTime to determine how fast they can hit tiles (which is the tool speed displayed on this wiki); their useAnimation determines how fast they deal melee damage (which is the duration of the swinging animation).
  • The Golden Shower has a useTime of 6 and a useAnimation of 18, causing it firing 3 times per Use / Attack key input.
  • The Clockwork Assault Rifle has a useTime of 4 and a useAnimation of 12, causing it firing 3 times per Use / Attack key input. It also has a reuseDelay of 14, adding 14-tick interval between the three round bursts.

Special conditons

Use limit

The following weapons are specially coded to only fire a specific amount of times per use, based on their useAnimation: Tome of Infinite Wisdom(Desktop, Console and Mobile versions) (4 times), Nightglow(Desktop, Console and Mobile versions) (4 times), and Eventide(Desktop, Console and Mobile versions) (5 times).[8]

Swinging items

For items that are swung overhead (melee weapons, pickaxes, etc.), the length of their swinging animation is related to useAnimation. A single target will only be hit once during one swinging animation.

Projectile melee weapons

The following projectile melee weapons have their projectiles' shoot rate based on their useTime stat, which differs from their standard use time (the useAnimation), so they might not shoot a projectile on every swing. These shoot rates can only be changed by modifiers as only modifiers can affect useTime. However, if such a weapon's useTime is less than its useAnimation, it still cannot shoot a projectile again until the swing finishes.

(Desktop, Console and Mobile versions) The following projectile melee weapons have the shootsEveryUse ability, which causes them to shoot a projectile every time they are used. However, if such a weapon's useTime is less than its useAnimation, it still cannot shoot a projectile again until the swing finishes.

Combined with autoswing

Autoswinging items are items that have the autoReuse attribute, i.e. having the Autoswing autoswing icon displayed on its infobox on this wiki. When such an item reaches one tick before its animation ends, it immediately skips to start a new animation (a new use of the item).[9]

This is fine for most of the items, as the game adds one tick to their useAnimation in the calculation process (see calculation below). However, this step is the last step in the whole process; the calculation for melee weapons are done earlier, therefore skipping this step. This means that the actual use time (useAnimation) of autoswing melee weapons is one tick lower than the useAnimation stated in the source code, in the item's tooltip, and here on the wiki.

Calculation

The calculation of time taken for item use triggered by a single Use / Attack key input uses different formula based on the type of item.[10]

However, before all calculations, the effect of modifiers are applied first, acting as a direct change to specific item stats. useTime, useAnimation, and reuseDelay are affected, using the following formula:

[math]\displaystyle{ \text{New stat} = \operatorname{round}(\text{Original stat}\times\mathit{Modifier}) }[/math]

  • The [math]\displaystyle{ \operatorname{round} }[/math] operator rounds the value to the nearest integer, and to the nearest even number if it is halfway between two integers.
  • [math]\displaystyle{ \mathit{Modifier} }[/math] is the modifier's boost to speed, in decimal. For example, the Light modifier gives +15% speed, which means [math]\displaystyle{ \mathit{Modifier}=1-0.15=0.85 }[/math].

All formulas below use this new stat for calculation.

  • Weapon Modifier Bonus Modified useAnimation Actual bonus[a]
    Megashark
    Megashark
    Base useAnimation: 7
    Unreal +10% speed 6 +14% speed (+4%)
    Rapid +15% speed 6 +14% speed (-1%)
    Musket
    Musket
    Base useAnimation: 32
    Nimble +5% speed 30 +6% speed (+1%)
    Unreal +10% speed 29 +9% speed (-1%)
    Rapid +15% speed 27 +16% speed (+1%)
  • The total time of item use is then calculated by the following formulas. Note that a given item corresponds to one and only one formula below.

    For items that deal melee damage:

    [math]\displaystyle{ \text{Total time} = \left\lfloor\mathit{useAnimation}\times\frac{1}{1+\mathit{Melee\ speed}\times\mathit{Melee\ speed\ multiplier}}\right\rfloor+\mathit{reuseDelay} }[/math]

    • [math]\displaystyle{ \left\lfloor{x}\right\rfloor }[/math] is the floor function (round down to the nearest integer).
    • [math]\displaystyle{ \mathit{Melee\ speed} }[/math] is the sum of melee speed bonuses in decimals, starting at 0. For example, 10% increased melee speed means +0.1.
    • [math]\displaystyle{ \mathit{Melee\ speed\ multiplier} }[/math] is [math]\displaystyle{ 1 }[/math] for most weapons. See table below for weapons with a different value:[11]
    Item Multiplier
    Terra Blade 0.75
    Bladed Glove 0.5
    Fetid Baghnakhs 0.25
    Psycho Knife 0.33

    For whips:

    [math]\displaystyle{ \text{Total time} = \left\lfloor\mathit{useAnimation}\times\frac{1}{1+\mathit{Melee\ speed}+\mathit{Whip\ speed\ buff}}\times\frac{1}{\mathit{Whip\ speed\ set\ bonus}}\right\rfloor+\mathit{reuseDelay} }[/math]

    • [math]\displaystyle{ \mathit{Melee\ speed} }[/math] is the sum of melee speed bonuses in decimals, starting at 0. For example, 10% increased melee speed means +0.1.
    • [math]\displaystyle{ \mathit{Whip\ speed\ buff} }[/math] is the sum of whip speed bonuses from buffs in decimals, starting at 0. For example, 12% increased whip speed of Jungle's Fury means +0.12.
    • [math]\displaystyle{ \mathit{Whip\ speed\ set\ bonus} }[/math] is whip speed bonuses from set bonus, which is 1 when no set bonus is in effect. Currently, only the Obsidian armor provides this bonus, changing this value to 1.15.
    • Currently, all whips have a [math]\displaystyle{ \mathit{reuseDelay} }[/math] of 0.

    For blocks:

    [math]\displaystyle{ \text{Total time} = \left\lfloor\mathit{useAnimation}\times\frac{1}{1+\mathit{Block\ speed}}\right\rfloor+\mathit{reuseDelay} }[/math]

    • [math]\displaystyle{ \mathit{Block\ speed} }[/math] is 0 by default; some items add a specific value to it.
    • Currently, all blocks have a [math]\displaystyle{ \mathit{reuseDelay} }[/math] of 0.
    Item Value
    Ambrosia +0.05
    Builder Potion +0.25
    Brick Layer
    (or its upgrades)
    +0.5

    For walls:

    [math]\displaystyle{ \text{Total time} = \left\lfloor\mathit{useAnimation}\times\frac{1}{1+\mathit{Wall\ speed}}\right\rfloor+\mathit{reuseDelay} }[/math]

    • [math]\displaystyle{ \mathit{Wall\ speed} }[/math] is 0 by default; some items add a specific value to it.
    • Currently, all walls have a [math]\displaystyle{ \mathit{reuseDelay} }[/math] of 0.
    Item Value
    Ambrosia +0.05
    Builder Potion +0.25
    Portable Cement Mixer
    (or its upgrades)
    +0.5

    For rest of the items that can autoswing (autoReuse = true), has a reuseDelay of 0, useTime is no more than useAnimation, can shoot projectile, and has a use style of 5 (see below for a list of applicable items):

    [math]\displaystyle{ \text{Total time} = \mathit{useAnimation}+1 }[/math]

  • For the other items:

    [math]\displaystyle{ \text{Total time} = \mathit{useAnimation} }[/math]

    Notes

    • The "fire rate" per second is calculated by dividing ticks per second (60) by the item's use time: [math]\displaystyle{ \mathit{fire\ rate} = \frac{60}{\mathit{use\ time}} }[/math]
    For instance, a Megashark has a use time of 7. Its rate of fire can be calculated by inserting this in the formula above: [math]\displaystyle{ \mathit{fire\ rate} = \frac{60}{ 7 } \approx 8.57 }[/math]
    Multiplying this with 60 reveals the rate of fire per minute, which is about 514.29 rounds per minute for the Megashark.
    • Certain items' use condition are not solely based on its use time. For example, recovery potions like Mushrooms and Lesser Healing Potions have a special cooldown period; flails and boomerangs must return before being fired again.
    • The animation skipping feature of autoswing melee weapons has great impact on use time in some cases. For example, A Light Meowmere has a use time of 12. With 141% melee speed bonus, its use time becomes 4.98, which is rounded down to 4, equal to 200% melee speed bonus. Considering the skip, actual use time has been reduced from 11 to 3, which is equal to 267% melee speed bonus.

    History

    • Desktop 1.0.6:
      • The tooltip text "Very fast" is now applied to all items up to a use time of 20. Shifted the other groups accordingly:
        • "Very fast" is now 9–20 instead of 9–15.
        • "Fast" is now 21–25 instead of 16–20.
        • "Average" is now 25–30 instead of 21–25.
        • "Slow" is now 31–35 instead of 26–30.
        • "Very slow" is now 36–45 instead of 31–40.
        • "Extremely slow" is now 46–55 instead of 41–50.
        • "Snail" is now ≥56 instead of ≥51.
    As a result, some items are now listed as being faster even though their actual use time did not change.
    • Desktop 1.0.3: Fixed a typo in a use time tooltip text: "Extremly slow speed" → "Extremely slow speed".

    References

    1. 1.0 1.1 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.
    2. Information taken from the Desktop version Desktop 1.4.4.9 source code, field useTime in Terraria.Item.cs.
    3. Information taken from the Desktop version Desktop 1.4.4.9 source code, field useAnimation in Terraria.Item.cs.
    4. Information taken from the Desktop version Desktop 1.4.4.9 source code, field reuseDelay in Terraria.Item.cs.
    5. Information taken from the Desktop version Desktop 1.4.4.9 source code, method LeftClick() in Terraria.UI.ItemSlot.cs.
    6. Information taken from the Desktop version Desktop 1.4.4.9 source code, method TrySwitchingLoadout() in Terraria.Player.cs.
    7. Information taken from the Desktop version Desktop 1.4.4.9 source code, method HoverOverCraftingItemButton() in Terraria.Main.cs and property IgnoreMouseInterface in Terraria.GameInput.PlayerInput.cs.
    8. Information taken from the Desktop version Desktop 1.4.4.9 source code, method ItemCheck_OwnerOnlyCode() in Terraria.Player.cs.
    9. Information taken from the Desktop version Desktop 1.4.4.9 source code, methods ApplyItemAnimation() in Terraria.Player.cs and ItemCheck_HandleMPItemAnimation() in Terraria.Player.cs.
    10. Information taken from the Desktop version Desktop 1.4.4.9 source code, methods Update() in Terraria.Player.cs, CapAttackSpeeds() in Terraria.Player.cs, and ApplyItemAnimation() in Terraria.Player.cs.
    11. Information taken from the Desktop version Desktop 1.4.4.9 source code, field Sets.BonusMeleeSpeedMultiplier in Terraria.ID.ItemID.cs.
    1. The percentage shown in-game.