Difference between revisions of "Attack speed"

From CrawlWiki
Jump to: navigation, search
(Added link to Weapon Speed)
m (Spells: fix vhi)
 
(47 intermediate revisions by 7 users not shown)
Line 1: Line 1:
{{Version012}}
+
{{version031}}
 +
''See [[Weapon Speed]] for tables summarising this information.''
 +
 +
'''Attack speed''' is how fast a player can attack with [[melee weapon]]s, [[ranged weapon]]s, or [[Unarmed Combat]].
  
''See [[Weapon Speed]] for tables summarising this information.''
+
Your attack speed is usually measured in the form of "'''attack delay'''". A normal action takes 1.0 [[decaAut]], or 10 [[aut]], of time. The more aut you take, the slower you act. So if you have a smaller attack delay, you will attack faster.
 +
 
 +
==Weapon Attack Delay==
 +
The following conditions are applied in order:
 +
===Base delay===
 +
All weapons, including [[ranged weapons]] and [[Throwing]] implements, have a base attack delay. When looking at the weapon in the ''''i''''nventory, you'll get the base attack delay (in decaAut). For example, a [[dagger]] has a base delay of 1.0 decaAut (10 aut).
 +
 
 +
The [[Weapon Speed]] page has a complete table of every weapon, in aut.
 +
 
 +
===Skill===
 +
For every 2 levels in the corresponding weapon [[skill]], your attack delay is reduced by 0.1 decaAut. There is a limit - every weapon has a '''minimum delay''', where skill cannot reduce attack speed any further.
 +
 
 +
A weapon's mindelay is usually the ''smaller'' of <code>base delay / 2</code> or 0.7 decaAut. For example, a [[dagger]] has a base delay of 1.0, so it has a mindelay of 0.5. A [[large rock]] has a base delay of 2.0, but its mindelay is still 0.7 decaAut. There are a few exceptions to this rule, such as [[rapier]]s and [[triple crossbow]]s.
 +
 
 +
Unarmed Combat works differently. For every 5.4 [[Unarmed Combat]] skill, attack delay is reduced by 0.1 decaAut.<ref>{{source ref|0.28.0|player-act.cc|272}}</ref> It otherwise works similarly to weapons.
 +
 
 +
===Brands===
 +
Weapon [[brand]]s can modify speed, applied after accounting for skills.
 +
* The [[speed brand]] reduces your weapon delay by x66%.
 +
* The [[heavy]] brand increases your weapon's delay by +50%.
 +
 
 +
===Body Armour===
 +
If you are using a "[[Ranged Weapons|Ranged Weapon]]" (which does ''not'' include [[Throwing]] weapons), then [[body armour]] will slow down your attack speed (after brand). Body armour slows down attacks based on its [[encumbrance rating]].
 +
 
 +
The formula is <code>(encumbrance^2 / 2250) * (90 - 2 * [[Armour (skill)|armor_skill]]) / (3 + str)</code> decaAut.
 +
 
 +
Values for armour encumbrance can be found on the [[Armour]] page. Unlike shields, the penalty cannot be fully eliminated with skill.
 +
 
 +
===Shields===
 +
[[Shield]]s encumber their wielder, slowing down weapon speed (after brands are applied).
 +
 
 +
For EV penalty = <code>0.4 * encumbrance^2 / (5 + [[str]]) * (27 - [[Shields (skill)|sh_skill]]) / 27</code>, shields slow down attacks by <code>1d(EV Penalty) / 10</code> decaAut.<ref>{{source ref|0.30.0|player.cc|5739}}</ref><ref>{{source ref|0.30.0|player-act.cc|306}}</ref> If EV Penalty is not an integer, it is rounded in a weighted fashion before the dice function is rolled.
 +
 
 +
The values for shield encumbrance can be found on the [[Shields]] page. The shield penalty can be reduced to zero with a maxed out shield skill of 27.
 +
 
 +
===Statuses===
 +
* [[Haste]] (including from [[berserk]]) reduces all action delays by a factor of 2/3
 +
* [[Okawaru]]'s Finesse ability reduces weapon delay by half. This does ''not'' stack with haste.
 +
* [[Statue Form]], [[Petrify]]ing, and [[Slow]]ness increase all delays by a factor of 3/2. These conditions do stack with haste and with each other.
 +
 
 +
Finally, there is a hard limit of 0.1 decaAut, which no action can go under.
 +
 
 +
==Spells==
 +
Spells can be used for attacking, and are thus included on this page. The vast majority of spells have a base delay of 1.0 decaAut. It can be modified by statuses (Haste, Statue Form, Slow...).
  
When deciding between two different weapons, it can be helpful to understand exactly how attack speed works. Weapon speed in crawl is measured in units of delay.  A character with a small attack delay will swing more frequently than a character with a high attack delay.
+
A few spells attack with your weapon:
 +
* [[Manifold Assault]] uses your attack delay exactly (following the above formulae).
 +
* [[Vhi's Electric Charge]] uses the larger of your attack delay and your [[movement speed|movement delay]].
  
The base attack delay of a weapon is listed upon examination.  For example, examining a handaxe shows that its speed is 130%. To convert this to base delay, simply chop off the last zero. So our handaxe has a base delay of 13.
+
Also, [[Sandblast]] is cast at 1.5 delay, instead of 1.0.
  
Having points in a weapon's associated skill will decrease this delay. Take your weapon skill and divide it by two, rounding down.  Subtract the result from the weapon's base delay to determine your adjusted delay.  So if you have a skill of 2 in axes, your handaxe would have an adjusted delay of 12.  As soon as you reach a skill of 4 in axes, the adjusted delay would decrease to 11.
+
==Movement Based Attacks==
 +
Some attacks are combined with movement. Even if the actual attack delay is not changed, they are mentioned here for completeness.
  
Now, weapons can't just keep getting faster and faster.  All weapons have a minimum delay.  Once reached, more weapon skill won't decrease the delay any further.  To find out the minimum delay for a particular weapon, take the base delay, divide by two, and truncate the remainder.  So, our handaxe with a base delay of 13 has a minimum delay of 6.  That means that our weapon skill can at most lop seven points off of the handaxe's base delay.  Once you hit an axe skill of 14, that handaxe is going to be swinging as fast as it is going to get.
+
===Martial Arts Attacks===
 +
The [[Wu Jian Council]] allows the player to make attacks based on movement.
  
There are a couple of exceptions to the minimum delay calculation. First, if the weapon in question is a short blade and the calculated minimum delay is larger than five, then the minimum delay is adjusted to five. So that saber, even though it has a base delay of 12, has a minimum delay of 5 instead of 6.
+
Under normal circumstances, movement takes the usual amount of time, and make attacks based on that time. For example, lets say you move at 1.0 decaAut. If you have a weapon delay of 0.7, you'll always perform 1 attack on a move (taking 0.7 / 1.0 of the time), and have a 3/7 (0.3 / 0.7) chance for a 2nd attack. As an extreme example, a [[Naga]] (1.4 move delay) with a [[quick blade]] (0.3 attack delay) would attack 4 times per move, with a 50% chance of a 5th attack.
  
The second exception is if the calculated minimum delay is larger than seven. In such a case, the minimum delay is set to seven.  This mostly happens with big two handed weapons. Because of this exception, that executioner axe of yours with a base delay of 20 has a minimum delay of 7 instead of 10.
+
Serpent's Lash treats your movement delay as 1.0 decaAut, regardless of your actual movement delay. Wall Jump counts as 2 actions, so doubles your movement delay.
  
There is a hard-coded minimum player weapon delay of 3. If the calculated minimum delay is less than three it set to three.
+
===Rampaging===
 +
The [[rampaging]] ego lets you take a free step before attacking. If you are 1 space from an enemy, you'll move instantly and then attack at your normal attack delay.
  
The speed brand comes into effect after the check against the minimum attack delay is done. A weapon with the speed brand can actually attack faster than the calculated minimum delay. The speed brand halves delay, rounding up. So a handaxe of speed, at an axe skill of 14, would hit at a delay of 3 instead of 6. An executioner axe of speed would hit at a delay of 4 instead of 7 at an axe skill of 26.
+
==Detailed Calculations==
 +
The formulas above give you a very close approximation to the average attack delay. However, each individual attack can be subject to multiple sources of randomness:
  
A shield can potentially add extra delay to your attacks. To calculate the delay added, you first need to know your adjusted shield penalty.  
+
* If your weapon delay (post-skill, post-brand) is in fractional [[aut]], then it is rounded in a weighted fashion. For example, if you "average" attack is at 5.1 aut (0.51 decaAut), then you have a 10% chance to attack at 6 aut, and 90% chance to attack at 5 aut.
  
(adjusted shield penalty) = (base shield penalty) - (shield skill)/(racial divider)
+
* If you wear a [[shield]], the shield's penalty is also rounded in a weighted fashion. The EV penalty (<code>2/5 * encumbrance^2 / (5 + [[str]]) * (27 - [[Shields (skill)|sh_skill]]) / 27</code>) is calculated, then roudnd.
  
The base shield penalty is 1/3/5 for bucklers/shields/large shields, and the racial divider is 3/5/7/9 for ogres/humans/kobolds/spriggans.  Throw away any remainder on the division.  So a normal size race would have an adjusted shield penalty of 0 when wielding a buckler at shield skill 5, a medium shield at shield skill 15, and a large shield at shield skill 25.
+
* If you are using a [[ranged weapon]], then the penalty from [[body armour]] is also rounded in a weighted fashion, then added to delay.
  
If you are wielding a one handed weapon, two random integers are chosen between 1 and your adjusted shield penalty.  The smaller one is used as the delay added by the shield.  So your delay with a shield, on average, will be smaller when wielding a one handed weapon than when wielding a hand and a half weapon.  In either case though, once your adjusted shield penalty reaches zero there is no added delay.
+
This can result in a wider range of attack delays than the averaging of fractional delays would imply.
  
At this point, if the weapon delay plus the shield delay is less than three, it is set to three. There is no real way that this could happen though, as crawl is kind of funny like that. You'll never get something less than three out of the weapon delay calculation, since even a dagger of speed would spit out a delay of three.
+
===Example===
 +
Take a human wielding a short sword and buckler. The human has a [[short blade|short blade skill]] of 7.5, shield skill of 4, and strength of 15. The [[buckler]]'s encumbrance is 5.
  
So, now we have an adjusted speed, of our weapon, plus our shield. We aren't done yet. If we are slowed, this value is multiplied by 1.5. If we are hasted or berserked, it is divided by 1.5.  If we are a statue, it is multiplied by 1.5.  Under finesse, it is divided by 2. The result of this calculation is an integer, but the rounding is randomized, weighted by the reminder.
+
* The short sword has a base delay of 11 aut, which is reduced to 7.25 aut from skill. -> (75% for 7 aut, 25% for 8 aut)
 +
* The shield gives a penalty of 1d(0.40) -> (40% chance of +1, 60% for +0).
  
What does that mean, you ask?  Say you are wielding a demon whip, and have enough mace skill to reach the minimum delay of 5. You berserk. The berserk divider is 1.5, so your delay value is 3.333.  Delays must be integer values though, so 2/3 of the time your delay will be rounded to 3, and 1/3 of the time your delay will be rounded to 4.  In effect, you get your delay of 3.333.
+
{| class="wikitable"
 +
|- align="center"
 +
!
 +
!colspan="3"|Delays
 +
|-
 +
! Source !! 7 !! 8 !! 9
 +
|-
 +
|Post-skill delay
 +
| 75% || 25% ||
 +
|-
 +
|Shield penalty
 +
| (75% * 60%) || (75% * 40%)<br>(25% * 60%) || (25% * 40%)
 +
|-
 +
|Final
 +
| 45% || 45% || 10%
 +
|}
 +
   
 +
Average delay = 7.6 aut. Looking at the average alone, you may think that you can only swing at 7 (40%) or 8 (60%) aut. However, there are 3 possible delays - 7, 8, and 9 aut - as shown above.
  
The smallest delay you are allowed to swing with is two. If the calculation spits out a value less than two it is set to two. This can happen when you finesse with weapons that have an adjusted weapon delay of three, assuming no any extra delay introduced from a shield. For example, this could happen with quickblades, any short blade of speed, demon whips of speed, and so on. That means that the speed bonus of finesse only works at partial effectiveness for attacks with these weapons.  Finesse will reduce the delay from 3 to 2, and not to an average of 1.5.
+
==History==
 +
*Prior to [[0.31]], there was a hard minimum attack delay of 0.2 decaAut.
 +
*Prior to [[0.29]], body armour did not penalize [[Ranged Weapons]].
 +
*Prior to [[0.28]], the [[shield]] penalty formula was different. Certain skill thresholds (4 skill for buckler, 15 for kite shield, 25 for tower shield) negated it.
 +
*Prior to [[0.27]], the shield attack penalty was smaller (equal to the smaller of {1d(EV_penalty), 1d(EV_penalty)}).
 +
*Prior to [[0.16]], the amount of skill required to negate penalties for wearing a shield was more complex.
  
The functions which calculate the delay can be found in melee_attack.cc.  See melee_attack::calc_attack_delay and its sub-functions.
+
==References==
 +
<references/>
  
http://git.develz.org/?p=crawl.git;a=blob;f=crawl-ref/source/melee_attack.cc
 
 
[[Category:Game mechanics]]
 
[[Category:Game mechanics]]

Latest revision as of 11:27, 15 January 2024

Version 0.31: This article is up to date for the latest stable release of Dungeon Crawl Stone Soup.

See Weapon Speed for tables summarising this information.

Attack speed is how fast a player can attack with melee weapons, ranged weapons, or Unarmed Combat.

Your attack speed is usually measured in the form of "attack delay". A normal action takes 1.0 decaAut, or 10 aut, of time. The more aut you take, the slower you act. So if you have a smaller attack delay, you will attack faster.

Weapon Attack Delay

The following conditions are applied in order:

Base delay

All weapons, including ranged weapons and Throwing implements, have a base attack delay. When looking at the weapon in the 'i'nventory, you'll get the base attack delay (in decaAut). For example, a dagger has a base delay of 1.0 decaAut (10 aut).

The Weapon Speed page has a complete table of every weapon, in aut.

Skill

For every 2 levels in the corresponding weapon skill, your attack delay is reduced by 0.1 decaAut. There is a limit - every weapon has a minimum delay, where skill cannot reduce attack speed any further.

A weapon's mindelay is usually the smaller of base delay / 2 or 0.7 decaAut. For example, a dagger has a base delay of 1.0, so it has a mindelay of 0.5. A large rock has a base delay of 2.0, but its mindelay is still 0.7 decaAut. There are a few exceptions to this rule, such as rapiers and triple crossbows.

Unarmed Combat works differently. For every 5.4 Unarmed Combat skill, attack delay is reduced by 0.1 decaAut.[1] It otherwise works similarly to weapons.

Brands

Weapon brands can modify speed, applied after accounting for skills.

  • The speed brand reduces your weapon delay by x66%.
  • The heavy brand increases your weapon's delay by +50%.

Body Armour

If you are using a "Ranged Weapon" (which does not include Throwing weapons), then body armour will slow down your attack speed (after brand). Body armour slows down attacks based on its encumbrance rating.

The formula is (encumbrance^2 / 2250) * (90 - 2 * armor_skill) / (3 + str) decaAut.

Values for armour encumbrance can be found on the Armour page. Unlike shields, the penalty cannot be fully eliminated with skill.

Shields

Shields encumber their wielder, slowing down weapon speed (after brands are applied).

For EV penalty = 0.4 * encumbrance^2 / (5 + str) * (27 - sh_skill) / 27, shields slow down attacks by 1d(EV Penalty) / 10 decaAut.[2][3] If EV Penalty is not an integer, it is rounded in a weighted fashion before the dice function is rolled.

The values for shield encumbrance can be found on the Shields page. The shield penalty can be reduced to zero with a maxed out shield skill of 27.

Statuses

  • Haste (including from berserk) reduces all action delays by a factor of 2/3
  • Okawaru's Finesse ability reduces weapon delay by half. This does not stack with haste.
  • Statue Form, Petrifying, and Slowness increase all delays by a factor of 3/2. These conditions do stack with haste and with each other.

Finally, there is a hard limit of 0.1 decaAut, which no action can go under.

Spells

Spells can be used for attacking, and are thus included on this page. The vast majority of spells have a base delay of 1.0 decaAut. It can be modified by statuses (Haste, Statue Form, Slow...).

A few spells attack with your weapon:

Also, Sandblast is cast at 1.5 delay, instead of 1.0.

Movement Based Attacks

Some attacks are combined with movement. Even if the actual attack delay is not changed, they are mentioned here for completeness.

Martial Arts Attacks

The Wu Jian Council allows the player to make attacks based on movement.

Under normal circumstances, movement takes the usual amount of time, and make attacks based on that time. For example, lets say you move at 1.0 decaAut. If you have a weapon delay of 0.7, you'll always perform 1 attack on a move (taking 0.7 / 1.0 of the time), and have a 3/7 (0.3 / 0.7) chance for a 2nd attack. As an extreme example, a Naga (1.4 move delay) with a quick blade (0.3 attack delay) would attack 4 times per move, with a 50% chance of a 5th attack.

Serpent's Lash treats your movement delay as 1.0 decaAut, regardless of your actual movement delay. Wall Jump counts as 2 actions, so doubles your movement delay.

Rampaging

The rampaging ego lets you take a free step before attacking. If you are 1 space from an enemy, you'll move instantly and then attack at your normal attack delay.

Detailed Calculations

The formulas above give you a very close approximation to the average attack delay. However, each individual attack can be subject to multiple sources of randomness:

  • If your weapon delay (post-skill, post-brand) is in fractional aut, then it is rounded in a weighted fashion. For example, if you "average" attack is at 5.1 aut (0.51 decaAut), then you have a 10% chance to attack at 6 aut, and 90% chance to attack at 5 aut.
  • If you wear a shield, the shield's penalty is also rounded in a weighted fashion. The EV penalty (2/5 * encumbrance^2 / (5 + str) * (27 - sh_skill) / 27) is calculated, then roudnd.
  • If you are using a ranged weapon, then the penalty from body armour is also rounded in a weighted fashion, then added to delay.

This can result in a wider range of attack delays than the averaging of fractional delays would imply.

Example

Take a human wielding a short sword and buckler. The human has a short blade skill of 7.5, shield skill of 4, and strength of 15. The buckler's encumbrance is 5.

  • The short sword has a base delay of 11 aut, which is reduced to 7.25 aut from skill. -> (75% for 7 aut, 25% for 8 aut)
  • The shield gives a penalty of 1d(0.40) -> (40% chance of +1, 60% for +0).
Delays
Source 7 8 9
Post-skill delay 75% 25%
Shield penalty (75% * 60%) (75% * 40%)
(25% * 60%)
(25% * 40%)
Final 45% 45% 10%

Average delay = 7.6 aut. Looking at the average alone, you may think that you can only swing at 7 (40%) or 8 (60%) aut. However, there are 3 possible delays - 7, 8, and 9 aut - as shown above.

History

  • Prior to 0.31, there was a hard minimum attack delay of 0.2 decaAut.
  • Prior to 0.29, body armour did not penalize Ranged Weapons.
  • Prior to 0.28, the shield penalty formula was different. Certain skill thresholds (4 skill for buckler, 15 for kite shield, 25 for tower shield) negated it.
  • Prior to 0.27, the shield attack penalty was smaller (equal to the smaller of {1d(EV_penalty), 1d(EV_penalty)}).
  • Prior to 0.16, the amount of skill required to negate penalties for wearing a shield was more complex.

References